aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2011-05-06 02:15:51 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2011-05-11 07:20:53 -0400
commit55978cc20efca8c40a7f4500df868e3d2ac8c025 (patch)
tree5bfd84d6cdda8a224ab092e30057cc9052afa984 /drivers/video/omap2
parent702d144845086cacf8bb4f23196189f260c250e2 (diff)
OMAP: DSS2: Remove usage of struct dispc_reg
struct dispc_reg was originally used while migrating from old omapfb to catch cases where the arguments to dispc_read_reg/dispc_write_reg were in wrong order, since old omapfb had the arguments in reverse order. Remove this struct and use u16 instead Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/dss/dispc.c12
-rw-r--r--drivers/video/omap2/dss/dispc.h156
2 files changed, 82 insertions, 86 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 698d418c5c5..10e9e8c16db 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -112,20 +112,20 @@ static struct {
112 112
113static void _omap_dispc_set_irqs(void); 113static void _omap_dispc_set_irqs(void);
114 114
115static inline void dispc_write_reg(const struct dispc_reg idx, u32 val) 115static inline void dispc_write_reg(const u16 idx, u32 val)
116{ 116{
117 __raw_writel(val, dispc.base + idx.idx); 117 __raw_writel(val, dispc.base + idx);
118} 118}
119 119
120static inline u32 dispc_read_reg(const struct dispc_reg idx) 120static inline u32 dispc_read_reg(const u16 idx)
121{ 121{
122 return __raw_readl(dispc.base + idx.idx); 122 return __raw_readl(dispc.base + idx);
123} 123}
124 124
125#define SR(reg) \ 125#define SR(reg) \
126 dispc.ctx[(DISPC_##reg).idx / sizeof(u32)] = dispc_read_reg(DISPC_##reg) 126 dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg)
127#define RR(reg) \ 127#define RR(reg) \
128 dispc_write_reg(DISPC_##reg, dispc.ctx[(DISPC_##reg).idx / sizeof(u32)]) 128 dispc_write_reg(DISPC_##reg, dispc.ctx[DISPC_##reg / sizeof(u32)])
129 129
130void dispc_save_context(void) 130void dispc_save_context(void)
131{ 131{
diff --git a/drivers/video/omap2/dss/dispc.h b/drivers/video/omap2/dss/dispc.h
index 05e56621d1f..d45f010d75d 100644
--- a/drivers/video/omap2/dss/dispc.h
+++ b/drivers/video/omap2/dss/dispc.h
@@ -21,247 +21,243 @@
21#ifndef __OMAP2_DISPC_REG_H 21#ifndef __OMAP2_DISPC_REG_H
22#define __OMAP2_DISPC_REG_H 22#define __OMAP2_DISPC_REG_H
23 23
24struct dispc_reg { u16 idx; };
25
26#define DISPC_REG(idx) ((const struct dispc_reg) { idx })
27
28/* DISPC common registers */ 24/* DISPC common registers */
29#define DISPC_REVISION DISPC_REG(0x0000) 25#define DISPC_REVISION 0x0000
30#define DISPC_SYSCONFIG DISPC_REG(0x0010) 26#define DISPC_SYSCONFIG 0x0010
31#define DISPC_SYSSTATUS DISPC_REG(0x0014) 27#define DISPC_SYSSTATUS 0x0014
32#define DISPC_IRQSTATUS DISPC_REG(0x0018) 28#define DISPC_IRQSTATUS 0x0018
33#define DISPC_IRQENABLE DISPC_REG(0x001C) 29#define DISPC_IRQENABLE 0x001C
34#define DISPC_CONTROL DISPC_REG(0x0040) 30#define DISPC_CONTROL 0x0040
35#define DISPC_CONFIG DISPC_REG(0x0044) 31#define DISPC_CONFIG 0x0044
36#define DISPC_CAPABLE DISPC_REG(0x0048) 32#define DISPC_CAPABLE 0x0048
37#define DISPC_LINE_STATUS DISPC_REG(0x005C) 33#define DISPC_LINE_STATUS 0x005C
38#define DISPC_LINE_NUMBER DISPC_REG(0x0060) 34#define DISPC_LINE_NUMBER 0x0060
39#define DISPC_GLOBAL_ALPHA DISPC_REG(0x0074) 35#define DISPC_GLOBAL_ALPHA 0x0074
40#define DISPC_CONTROL2 DISPC_REG(0x0238) 36#define DISPC_CONTROL2 0x0238
41#define DISPC_CONFIG2 DISPC_REG(0x0620) 37#define DISPC_CONFIG2 0x0620
42#define DISPC_DIVISOR DISPC_REG(0x0804) 38#define DISPC_DIVISOR 0x0804
43 39
44/* DISPC overlay registers */ 40/* DISPC overlay registers */
45#define DISPC_OVL_BA0(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 41#define DISPC_OVL_BA0(n) (DISPC_OVL_BASE(n) + \
46 DISPC_BA0_OFFSET(n)) 42 DISPC_BA0_OFFSET(n))
47#define DISPC_OVL_BA1(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 43#define DISPC_OVL_BA1(n) (DISPC_OVL_BASE(n) + \
48 DISPC_BA1_OFFSET(n)) 44 DISPC_BA1_OFFSET(n))
49#define DISPC_OVL_POSITION(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 45#define DISPC_OVL_POSITION(n) (DISPC_OVL_BASE(n) + \
50 DISPC_POS_OFFSET(n)) 46 DISPC_POS_OFFSET(n))
51#define DISPC_OVL_SIZE(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 47#define DISPC_OVL_SIZE(n) (DISPC_OVL_BASE(n) + \
52 DISPC_SIZE_OFFSET(n)) 48 DISPC_SIZE_OFFSET(n))
53#define DISPC_OVL_ATTRIBUTES(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 49#define DISPC_OVL_ATTRIBUTES(n) (DISPC_OVL_BASE(n) + \
54 DISPC_ATTR_OFFSET(n)) 50 DISPC_ATTR_OFFSET(n))
55#define DISPC_OVL_FIFO_THRESHOLD(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 51#define DISPC_OVL_FIFO_THRESHOLD(n) (DISPC_OVL_BASE(n) + \
56 DISPC_FIFO_THRESH_OFFSET(n)) 52 DISPC_FIFO_THRESH_OFFSET(n))
57#define DISPC_OVL_FIFO_SIZE_STATUS(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 53#define DISPC_OVL_FIFO_SIZE_STATUS(n) (DISPC_OVL_BASE(n) + \
58 DISPC_FIFO_SIZE_STATUS_OFFSET(n)) 54 DISPC_FIFO_SIZE_STATUS_OFFSET(n))
59#define DISPC_OVL_ROW_INC(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 55#define DISPC_OVL_ROW_INC(n) (DISPC_OVL_BASE(n) + \
60 DISPC_ROW_INC_OFFSET(n)) 56 DISPC_ROW_INC_OFFSET(n))
61#define DISPC_OVL_PIXEL_INC(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 57#define DISPC_OVL_PIXEL_INC(n) (DISPC_OVL_BASE(n) + \
62 DISPC_PIX_INC_OFFSET(n)) 58 DISPC_PIX_INC_OFFSET(n))
63#define DISPC_OVL_WINDOW_SKIP(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 59#define DISPC_OVL_WINDOW_SKIP(n) (DISPC_OVL_BASE(n) + \
64 DISPC_WINDOW_SKIP_OFFSET(n)) 60 DISPC_WINDOW_SKIP_OFFSET(n))
65#define DISPC_OVL_TABLE_BA(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 61#define DISPC_OVL_TABLE_BA(n) (DISPC_OVL_BASE(n) + \
66 DISPC_TABLE_BA_OFFSET(n)) 62 DISPC_TABLE_BA_OFFSET(n))
67#define DISPC_OVL_FIR(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 63#define DISPC_OVL_FIR(n) (DISPC_OVL_BASE(n) + \
68 DISPC_FIR_OFFSET(n)) 64 DISPC_FIR_OFFSET(n))
69#define DISPC_OVL_PICTURE_SIZE(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 65#define DISPC_OVL_PICTURE_SIZE(n) (DISPC_OVL_BASE(n) + \
70 DISPC_PIC_SIZE_OFFSET(n)) 66 DISPC_PIC_SIZE_OFFSET(n))
71#define DISPC_OVL_ACCU0(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 67#define DISPC_OVL_ACCU0(n) (DISPC_OVL_BASE(n) + \
72 DISPC_ACCU0_OFFSET(n)) 68 DISPC_ACCU0_OFFSET(n))
73#define DISPC_OVL_ACCU1(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 69#define DISPC_OVL_ACCU1(n) (DISPC_OVL_BASE(n) + \
74 DISPC_ACCU1_OFFSET(n)) 70 DISPC_ACCU1_OFFSET(n))
75#define DISPC_OVL_FIR_COEF_H(n, i) DISPC_REG(DISPC_OVL_BASE(n) + \ 71#define DISPC_OVL_FIR_COEF_H(n, i) (DISPC_OVL_BASE(n) + \
76 DISPC_FIR_COEF_H_OFFSET(n, i)) 72 DISPC_FIR_COEF_H_OFFSET(n, i))
77#define DISPC_OVL_FIR_COEF_HV(n, i) DISPC_REG(DISPC_OVL_BASE(n) + \ 73#define DISPC_OVL_FIR_COEF_HV(n, i) (DISPC_OVL_BASE(n) + \
78 DISPC_FIR_COEF_HV_OFFSET(n, i)) 74 DISPC_FIR_COEF_HV_OFFSET(n, i))
79#define DISPC_OVL_CONV_COEF(n, i) DISPC_REG(DISPC_OVL_BASE(n) + \ 75#define DISPC_OVL_CONV_COEF(n, i) (DISPC_OVL_BASE(n) + \
80 DISPC_CONV_COEF_OFFSET(n, i)) 76 DISPC_CONV_COEF_OFFSET(n, i))
81#define DISPC_OVL_FIR_COEF_V(n, i) DISPC_REG(DISPC_OVL_BASE(n) + \ 77#define DISPC_OVL_FIR_COEF_V(n, i) (DISPC_OVL_BASE(n) + \
82 DISPC_FIR_COEF_V_OFFSET(n, i)) 78 DISPC_FIR_COEF_V_OFFSET(n, i))
83#define DISPC_OVL_PRELOAD(n) DISPC_REG(DISPC_OVL_BASE(n) + \ 79#define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \
84 DISPC_PRELOAD_OFFSET(n)) 80 DISPC_PRELOAD_OFFSET(n))
85 81
86/* DISPC manager/channel specific registers */ 82/* DISPC manager/channel specific registers */
87static inline struct dispc_reg DISPC_DEFAULT_COLOR(enum omap_channel channel) 83static inline u16 DISPC_DEFAULT_COLOR(enum omap_channel channel)
88{ 84{
89 switch (channel) { 85 switch (channel) {
90 case OMAP_DSS_CHANNEL_LCD: 86 case OMAP_DSS_CHANNEL_LCD:
91 return DISPC_REG(0x004C); 87 return 0x004C;
92 case OMAP_DSS_CHANNEL_DIGIT: 88 case OMAP_DSS_CHANNEL_DIGIT:
93 return DISPC_REG(0x0050); 89 return 0x0050;
94 case OMAP_DSS_CHANNEL_LCD2: 90 case OMAP_DSS_CHANNEL_LCD2:
95 return DISPC_REG(0x03AC); 91 return 0x03AC;
96 default: 92 default:
97 BUG(); 93 BUG();
98 } 94 }
99} 95}
100 96
101static inline struct dispc_reg DISPC_TRANS_COLOR(enum omap_channel channel) 97static inline u16 DISPC_TRANS_COLOR(enum omap_channel channel)
102{ 98{
103 switch (channel) { 99 switch (channel) {
104 case OMAP_DSS_CHANNEL_LCD: 100 case OMAP_DSS_CHANNEL_LCD:
105 return DISPC_REG(0x0054); 101 return 0x0054;
106 case OMAP_DSS_CHANNEL_DIGIT: 102 case OMAP_DSS_CHANNEL_DIGIT:
107 return DISPC_REG(0x0058); 103 return 0x0058;
108 case OMAP_DSS_CHANNEL_LCD2: 104 case OMAP_DSS_CHANNEL_LCD2:
109 return DISPC_REG(0x03B0); 105 return 0x03B0;
110 default: 106 default:
111 BUG(); 107 BUG();
112 } 108 }
113} 109}
114 110
115static inline struct dispc_reg DISPC_TIMING_H(enum omap_channel channel) 111static inline u16 DISPC_TIMING_H(enum omap_channel channel)
116{ 112{
117 switch (channel) { 113 switch (channel) {
118 case OMAP_DSS_CHANNEL_LCD: 114 case OMAP_DSS_CHANNEL_LCD:
119 return DISPC_REG(0x0064); 115 return 0x0064;
120 case OMAP_DSS_CHANNEL_DIGIT: 116 case OMAP_DSS_CHANNEL_DIGIT:
121 BUG(); 117 BUG();
122 case OMAP_DSS_CHANNEL_LCD2: 118 case OMAP_DSS_CHANNEL_LCD2:
123 return DISPC_REG(0x0400); 119 return 0x0400;
124 default: 120 default:
125 BUG(); 121 BUG();
126 } 122 }
127} 123}
128 124
129static inline struct dispc_reg DISPC_TIMING_V(enum omap_channel channel) 125static inline u16 DISPC_TIMING_V(enum omap_channel channel)
130{ 126{
131 switch (channel) { 127 switch (channel) {
132 case OMAP_DSS_CHANNEL_LCD: 128 case OMAP_DSS_CHANNEL_LCD:
133 return DISPC_REG(0x0068); 129 return 0x0068;
134 case OMAP_DSS_CHANNEL_DIGIT: 130 case OMAP_DSS_CHANNEL_DIGIT:
135 BUG(); 131 BUG();
136 case OMAP_DSS_CHANNEL_LCD2: 132 case OMAP_DSS_CHANNEL_LCD2:
137 return DISPC_REG(0x0404); 133 return 0x0404;
138 default: 134 default:
139 BUG(); 135 BUG();
140 } 136 }
141} 137}
142 138
143static inline struct dispc_reg DISPC_POL_FREQ(enum omap_channel channel) 139static inline u16 DISPC_POL_FREQ(enum omap_channel channel)
144{ 140{
145 switch (channel) { 141 switch (channel) {
146 case OMAP_DSS_CHANNEL_LCD: 142 case OMAP_DSS_CHANNEL_LCD:
147 return DISPC_REG(0x006C); 143 return 0x006C;
148 case OMAP_DSS_CHANNEL_DIGIT: 144 case OMAP_DSS_CHANNEL_DIGIT:
149 BUG(); 145 BUG();
150 case OMAP_DSS_CHANNEL_LCD2: 146 case OMAP_DSS_CHANNEL_LCD2:
151 return DISPC_REG(0x0408); 147 return 0x0408;
152 default: 148 default:
153 BUG(); 149 BUG();
154 } 150 }
155} 151}
156 152
157static inline struct dispc_reg DISPC_DIVISORo(enum omap_channel channel) 153static inline u16 DISPC_DIVISORo(enum omap_channel channel)
158{ 154{
159 switch (channel) { 155 switch (channel) {
160 case OMAP_DSS_CHANNEL_LCD: 156 case OMAP_DSS_CHANNEL_LCD:
161 return DISPC_REG(0x0070); 157 return 0x0070;
162 case OMAP_DSS_CHANNEL_DIGIT: 158 case OMAP_DSS_CHANNEL_DIGIT:
163 BUG(); 159 BUG();
164 case OMAP_DSS_CHANNEL_LCD2: 160 case OMAP_DSS_CHANNEL_LCD2:
165 return DISPC_REG(0x040C); 161 return 0x040C;
166 default: 162 default:
167 BUG(); 163 BUG();
168 } 164 }
169} 165}
170 166
171/* Named as DISPC_SIZE_LCD, DISPC_SIZE_DIGIT and DISPC_SIZE_LCD2 in TRM */ 167/* Named as DISPC_SIZE_LCD, DISPC_SIZE_DIGIT and DISPC_SIZE_LCD2 in TRM */
172static inline struct dispc_reg DISPC_SIZE_MGR(enum omap_channel channel) 168static inline u16 DISPC_SIZE_MGR(enum omap_channel channel)
173{ 169{
174 switch (channel) { 170 switch (channel) {
175 case OMAP_DSS_CHANNEL_LCD: 171 case OMAP_DSS_CHANNEL_LCD:
176 return DISPC_REG(0x007C); 172 return 0x007C;
177 case OMAP_DSS_CHANNEL_DIGIT: 173 case OMAP_DSS_CHANNEL_DIGIT:
178 return DISPC_REG(0x0078); 174 return 0x0078;
179 case OMAP_DSS_CHANNEL_LCD2: 175 case OMAP_DSS_CHANNEL_LCD2:
180 return DISPC_REG(0x03CC); 176 return 0x03CC;
181 default: 177 default:
182 BUG(); 178 BUG();
183 } 179 }
184} 180}
185 181
186static inline struct dispc_reg DISPC_DATA_CYCLE1(enum omap_channel channel) 182static inline u16 DISPC_DATA_CYCLE1(enum omap_channel channel)
187{ 183{
188 switch (channel) { 184 switch (channel) {
189 case OMAP_DSS_CHANNEL_LCD: 185 case OMAP_DSS_CHANNEL_LCD:
190 return DISPC_REG(0x01D4); 186 return 0x01D4;
191 case OMAP_DSS_CHANNEL_DIGIT: 187 case OMAP_DSS_CHANNEL_DIGIT:
192 BUG(); 188 BUG();
193 case OMAP_DSS_CHANNEL_LCD2: 189 case OMAP_DSS_CHANNEL_LCD2:
194 return DISPC_REG(0x03C0); 190 return 0x03C0;
195 default: 191 default:
196 BUG(); 192 BUG();
197 } 193 }
198} 194}
199 195
200static inline struct dispc_reg DISPC_DATA_CYCLE2(enum omap_channel channel) 196static inline u16 DISPC_DATA_CYCLE2(enum omap_channel channel)
201{ 197{
202 switch (channel) { 198 switch (channel) {
203 case OMAP_DSS_CHANNEL_LCD: 199 case OMAP_DSS_CHANNEL_LCD:
204 return DISPC_REG(0x01D8); 200 return 0x01D8;
205 case OMAP_DSS_CHANNEL_DIGIT: 201 case OMAP_DSS_CHANNEL_DIGIT:
206 BUG(); 202 BUG();
207 case OMAP_DSS_CHANNEL_LCD2: 203 case OMAP_DSS_CHANNEL_LCD2:
208 return DISPC_REG(0x03C4); 204 return 0x03C4;
209 default: 205 default:
210 BUG(); 206 BUG();
211 } 207 }
212} 208}
213 209
214static inline struct dispc_reg DISPC_DATA_CYCLE3(enum omap_channel channel) 210static inline u16 DISPC_DATA_CYCLE3(enum omap_channel channel)
215{ 211{
216 switch (channel) { 212 switch (channel) {
217 case OMAP_DSS_CHANNEL_LCD: 213 case OMAP_DSS_CHANNEL_LCD:
218 return DISPC_REG(0x01DC); 214 return 0x01DC;
219 case OMAP_DSS_CHANNEL_DIGIT: 215 case OMAP_DSS_CHANNEL_DIGIT:
220 BUG(); 216 BUG();
221 case OMAP_DSS_CHANNEL_LCD2: 217 case OMAP_DSS_CHANNEL_LCD2:
222 return DISPC_REG(0x03C8); 218 return 0x03C8;
223 default: 219 default:
224 BUG(); 220 BUG();
225 } 221 }
226} 222}
227 223
228static inline struct dispc_reg DISPC_CPR_COEF_R(enum omap_channel channel) 224static inline u16 DISPC_CPR_COEF_R(enum omap_channel channel)
229{ 225{
230 switch (channel) { 226 switch (channel) {
231 case OMAP_DSS_CHANNEL_LCD: 227 case OMAP_DSS_CHANNEL_LCD:
232 return DISPC_REG(0x0220); 228 return 0x0220;
233 case OMAP_DSS_CHANNEL_DIGIT: 229 case OMAP_DSS_CHANNEL_DIGIT:
234 BUG(); 230 BUG();
235 case OMAP_DSS_CHANNEL_LCD2: 231 case OMAP_DSS_CHANNEL_LCD2:
236 return DISPC_REG(0x03BC); 232 return 0x03BC;
237 default: 233 default:
238 BUG(); 234 BUG();
239 } 235 }
240} 236}
241 237
242static inline struct dispc_reg DISPC_CPR_COEF_G(enum omap_channel channel) 238static inline u16 DISPC_CPR_COEF_G(enum omap_channel channel)
243{ 239{
244 switch (channel) { 240 switch (channel) {
245 case OMAP_DSS_CHANNEL_LCD: 241 case OMAP_DSS_CHANNEL_LCD:
246 return DISPC_REG(0x0224); 242 return 0x0224;
247 case OMAP_DSS_CHANNEL_DIGIT: 243 case OMAP_DSS_CHANNEL_DIGIT:
248 BUG(); 244 BUG();
249 case OMAP_DSS_CHANNEL_LCD2: 245 case OMAP_DSS_CHANNEL_LCD2:
250 return DISPC_REG(0x03B8); 246 return 0x03B8;
251 default: 247 default:
252 BUG(); 248 BUG();
253 } 249 }
254} 250}
255 251
256static inline struct dispc_reg DISPC_CPR_COEF_B(enum omap_channel channel) 252static inline u16 DISPC_CPR_COEF_B(enum omap_channel channel)
257{ 253{
258 switch (channel) { 254 switch (channel) {
259 case OMAP_DSS_CHANNEL_LCD: 255 case OMAP_DSS_CHANNEL_LCD:
260 return DISPC_REG(0x0228); 256 return 0x0228;
261 case OMAP_DSS_CHANNEL_DIGIT: 257 case OMAP_DSS_CHANNEL_DIGIT:
262 BUG(); 258 BUG();
263 case OMAP_DSS_CHANNEL_LCD2: 259 case OMAP_DSS_CHANNEL_LCD2:
264 return DISPC_REG(0x03B4); 260 return 0x03B4;
265 default: 261 default:
266 BUG(); 262 BUG();
267 } 263 }