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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2016 Nexell Co., Ltd.
*
* Author: junghyun, kim <jhkim@nexell.co.kr>
*/
#include <linux/types.h>
#include <linux/io.h>
#include "s5pxx18_soc_disptop.h"
#include "s5pxx18_soc_lvds.h"
#ifndef pow
static inline unsigned int pow(int a, int b)
{
if (b == 0)
return 1;
else
return a * pow(a, b - 1);
}
#endif
static struct nx_lvds_register_set *__g_pregister[NUMBER_OF_LVDS_MODULE];
int nx_lvds_initialize(void)
{
static int binit;
u32 i;
if (binit == 0) {
for (i = 0; i < NUMBER_OF_LVDS_MODULE; i++)
__g_pregister[i] = NULL;
binit = 1;
}
return 1;
}
u32 nx_lvds_get_number_of_module(void)
{
return NUMBER_OF_LVDS_MODULE;
}
u32 nx_lvds_get_size_of_register_set(void)
{
return sizeof(struct nx_lvds_register_set);
}
void nx_lvds_set_base_address(u32 module_index, void *base_address)
{
__g_pregister[module_index] =
(struct nx_lvds_register_set *)base_address;
}
void *nx_lvds_get_base_address(u32 module_index)
{
return (void *)__g_pregister[module_index];
}
u32 nx_lvds_get_physical_address(u32 module_index)
{
const u32 physical_addr[] = PHY_BASEADDR_LVDS_LIST;
return physical_addr[module_index];
}
int nx_lvds_open_module(u32 module_index)
{
return true;
}
int nx_lvds_close_module(u32 module_index)
{
return true;
}
int nx_lvds_check_busy(u32 module_index)
{
return false;
}
void nx_lvds_set_lvdsctrl0(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsctrl0);
}
void nx_lvds_set_lvdsctrl1(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsctrl1);
}
void nx_lvds_set_lvdsctrl2(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsctrl2);
}
void nx_lvds_set_lvdsctrl3(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsctrl3);
}
void nx_lvds_set_lvdsctrl4(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsctrl4);
}
void nx_lvds_set_lvdstmode0(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdstmode0);
}
void nx_lvds_set_lvdsloc0(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc0);
}
void nx_lvds_set_lvdsloc1(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc1);
}
void nx_lvds_set_lvdsloc2(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc2);
}
void nx_lvds_set_lvdsloc3(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc3);
}
void nx_lvds_set_lvdsloc4(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc4);
}
void nx_lvds_set_lvdsloc5(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc5);
}
void nx_lvds_set_lvdsloc6(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdsloc6);
}
void nx_lvds_set_lvdslocmask0(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdslocmask0);
}
void nx_lvds_set_lvdslocmask1(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdslocmask1);
}
void nx_lvds_set_lvdslocpol0(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdslocpol0);
}
void nx_lvds_set_lvdslocpol1(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
writel(regvalue, &pregister->lvdslocpol1);
}
void nx_lvds_set_lvdsdummy(u32 module_index, u32 regvalue)
{
register struct nx_lvds_register_set *pregister;
u32 oldvalue;
pregister = __g_pregister[module_index];
oldvalue = readl(&pregister->lvdsctrl1) & 0x00ffffff;
writel(oldvalue | ((regvalue & 0xff) << 24), &pregister->lvdsctrl1);
}
u32 nx_lvds_get_lvdsdummy(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
u32 oldvalue;
pregister = __g_pregister[module_index];
oldvalue = readl(&pregister->lvdsctrl1);
oldvalue = oldvalue >> 24;
return oldvalue;
}
u32 nx_lvds_get_lvdsctrl0(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
return (u32)readl(&pregister->lvdsctrl0);
}
u32 nx_lvds_get_lvdsctrl1(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
return (u32)readl(&pregister->lvdsctrl1);
}
u32 nx_lvds_get_lvdsctrl2(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
return (u32)readl(&pregister->lvdsctrl2);
}
u32 nx_lvds_get_lvdsctrl3(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
return (u32)readl(&pregister->lvdsctrl3);
}
u32 nx_lvds_get_lvdsctrl4(u32 module_index)
{
register struct nx_lvds_register_set *pregister;
pregister = __g_pregister[module_index];
return (u32)readl(&pregister->lvdsctrl4);
}
|