1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
/* linux/drivers/video/samsung/s3cfb_mdnie.c
*
* Register interface file for Samsung mDNIe driver
*
* Copyright (c) 2009 Samsung Electronics
* http://www.samsungsemi.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include "s3cfb.h"
#include "s3cfb_ielcd_kona.h"
#include "s3cfb_mdnie_kona.h"
#include "mdnie_kona.h"
#define s3c_mdnie_read(addr) __raw_readl(s3c_mdnie_base + addr*4)
#define s3c_mdnie_write(addr, val) __raw_writel(val, s3c_mdnie_base + addr*4)
static struct resource *s3c_mdnie_mem;
static void __iomem *s3c_mdnie_base;
int mdnie_write(unsigned int addr, unsigned int val)
{
return s3c_mdnie_write(addr, val);
}
int mdnie_mask(void)
{
return s3c_mdnie_write(MDNIE_REG_MASK, 0x9FFF);
}
int mdnie_unmask(void)
{
return s3c_mdnie_write(MDNIE_REG_MASK, 0);
}
int mdnie_set_size(unsigned int hsize, unsigned int vsize)
{
unsigned int reg;
/* Bank0 Select : DO NOT REMOVE THIS LINE */
s3c_mdnie_write(MDNIE_REG_BANK_SEL, 0);
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
/* Input Data Unmask */
reg = s3c_mdnie_read(S3C_MDNIE_rR1);
reg &= ~S3C_MDNIE_INPUT_DATA_ENABLE;
s3c_mdnie_write(S3C_MDNIE_rR1, reg);
#endif
/* LCD width */
reg = s3c_mdnie_read(MDNIE_REG_WIDTH);
reg &= ~S3C_MDNIE_SIZE_MASK;
reg |= S3C_MDNIE_HSIZE(hsize);
s3c_mdnie_write(MDNIE_REG_WIDTH, reg);
/* LCD height */
reg = s3c_mdnie_read(MDNIE_REG_HEIGHT);
reg &= ~S3C_MDNIE_SIZE_MASK;
reg |= S3C_MDNIE_VSIZE(vsize);
s3c_mdnie_write(MDNIE_REG_HEIGHT, reg);
mdnie_unmask();
return 0;
}
int mdnie_display_on(struct s3cfb_global *ctrl)
{
mdnie_set_size(ctrl->lcd->width, ctrl->lcd->height);
ielcd_init_global(ctrl);
ielcd_display_on();
if (!IS_ERR_OR_NULL(g_mdnie))
g_mdnie->enable = TRUE;
return 0;
}
int mdnie_display_off(void)
{
if (!IS_ERR_OR_NULL(g_mdnie))
g_mdnie->enable = FALSE;
return ielcd_display_off();
}
static int mdnie_hw_init(void)
{
s3c_mdnie_mem = request_mem_region(S3C_MDNIE_PHY_BASE, S3C_MDNIE_MAP_SIZE, "mdnie");
if (IS_ERR_OR_NULL(s3c_mdnie_mem)) {
pr_err("%s: fail to request_mem_region\n", __func__);
return -ENOENT;
}
s3c_mdnie_base = ioremap(S3C_MDNIE_PHY_BASE, S3C_MDNIE_MAP_SIZE);
if (IS_ERR_OR_NULL(s3c_mdnie_base)) {
pr_err("%s: fail to ioremap\n", __func__);
return -ENOENT;
}
return 0;
}
void mdnie_setup(void)
{
mdnie_hw_init();
ielcd_hw_init();
}
MODULE_DESCRIPTION("EXYNOS mDNIe Device Driver");
MODULE_LICENSE("GPL");
|