upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / msm / mdp_hw_init.c
1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17
18 #include "mdp.h"
19
20 /* mdp primary csc limit vector */
21 uint32 mdp_plv[] = { 0x10, 0xeb, 0x10, 0xf0 };
22
23 /* Color Coefficient matrix for YUV -> RGB */
24 struct mdp_ccs mdp_ccs_yuv2rgb = {
25         MDP_CCS_YUV2RGB,
26         {
27                 0x254,
28                 0x000,
29                 0x331,
30                 0x254,
31                 0xff38,
32                 0xfe61,
33                 0x254,
34                 0x409,
35                 0x000,
36         },
37         {
38 #ifdef CONFIG_FB_MSM_MDP31
39                 0x1f0,
40                 0x180,
41                 0x180
42 #else
43                 0x10,
44                 0x80,
45                 0x80
46 #endif
47         }
48 };
49
50 /* Color Coefficient matrix for RGB -> YUV */
51 struct mdp_ccs mdp_ccs_rgb2yuv = {
52         MDP_CCS_RGB2YUV,
53         {
54                 0x83,
55                 0x102,
56                 0x32,
57                 0xffb5,
58                 0xff6c,
59                 0xe1,
60                 0xe1,
61                 0xff45,
62                 0xffdc,
63         },
64 #ifdef CONFIG_FB_MSM_MDP31
65         {
66                 0x10,
67                 0x80,
68                 0x80
69         }
70 #endif
71 };
72
73 static void mdp_load_lut_param(void)
74 {
75         outpdw(MDP_BASE + 0x40800, 0x0);
76         outpdw(MDP_BASE + 0x40804, 0x151515);
77         outpdw(MDP_BASE + 0x40808, 0x1d1d1d);
78         outpdw(MDP_BASE + 0x4080c, 0x232323);
79         outpdw(MDP_BASE + 0x40810, 0x272727);
80         outpdw(MDP_BASE + 0x40814, 0x2b2b2b);
81         outpdw(MDP_BASE + 0x40818, 0x2f2f2f);
82         outpdw(MDP_BASE + 0x4081c, 0x333333);
83         outpdw(MDP_BASE + 0x40820, 0x363636);
84         outpdw(MDP_BASE + 0x40824, 0x393939);
85         outpdw(MDP_BASE + 0x40828, 0x3b3b3b);
86         outpdw(MDP_BASE + 0x4082c, 0x3e3e3e);
87         outpdw(MDP_BASE + 0x40830, 0x404040);
88         outpdw(MDP_BASE + 0x40834, 0x434343);
89         outpdw(MDP_BASE + 0x40838, 0x454545);
90         outpdw(MDP_BASE + 0x4083c, 0x474747);
91         outpdw(MDP_BASE + 0x40840, 0x494949);
92         outpdw(MDP_BASE + 0x40844, 0x4b4b4b);
93         outpdw(MDP_BASE + 0x40848, 0x4d4d4d);
94         outpdw(MDP_BASE + 0x4084c, 0x4f4f4f);
95         outpdw(MDP_BASE + 0x40850, 0x515151);
96         outpdw(MDP_BASE + 0x40854, 0x535353);
97         outpdw(MDP_BASE + 0x40858, 0x555555);
98         outpdw(MDP_BASE + 0x4085c, 0x565656);
99         outpdw(MDP_BASE + 0x40860, 0x585858);
100         outpdw(MDP_BASE + 0x40864, 0x5a5a5a);
101         outpdw(MDP_BASE + 0x40868, 0x5b5b5b);
102         outpdw(MDP_BASE + 0x4086c, 0x5d5d5d);
103         outpdw(MDP_BASE + 0x40870, 0x5e5e5e);
104         outpdw(MDP_BASE + 0x40874, 0x606060);
105         outpdw(MDP_BASE + 0x40878, 0x616161);
106         outpdw(MDP_BASE + 0x4087c, 0x636363);
107         outpdw(MDP_BASE + 0x40880, 0x646464);
108         outpdw(MDP_BASE + 0x40884, 0x666666);
109         outpdw(MDP_BASE + 0x40888, 0x676767);
110         outpdw(MDP_BASE + 0x4088c, 0x686868);
111         outpdw(MDP_BASE + 0x40890, 0x6a6a6a);
112         outpdw(MDP_BASE + 0x40894, 0x6b6b6b);
113         outpdw(MDP_BASE + 0x40898, 0x6c6c6c);
114         outpdw(MDP_BASE + 0x4089c, 0x6e6e6e);
115         outpdw(MDP_BASE + 0x408a0, 0x6f6f6f);
116         outpdw(MDP_BASE + 0x408a4, 0x707070);
117         outpdw(MDP_BASE + 0x408a8, 0x717171);
118         outpdw(MDP_BASE + 0x408ac, 0x727272);
119         outpdw(MDP_BASE + 0x408b0, 0x747474);
120         outpdw(MDP_BASE + 0x408b4, 0x757575);
121         outpdw(MDP_BASE + 0x408b8, 0x767676);
122         outpdw(MDP_BASE + 0x408bc, 0x777777);
123         outpdw(MDP_BASE + 0x408c0, 0x787878);
124         outpdw(MDP_BASE + 0x408c4, 0x797979);
125         outpdw(MDP_BASE + 0x408c8, 0x7a7a7a);
126         outpdw(MDP_BASE + 0x408cc, 0x7c7c7c);
127         outpdw(MDP_BASE + 0x408d0, 0x7d7d7d);
128         outpdw(MDP_BASE + 0x408d4, 0x7e7e7e);
129         outpdw(MDP_BASE + 0x408d8, 0x7f7f7f);
130         outpdw(MDP_BASE + 0x408dc, 0x808080);
131         outpdw(MDP_BASE + 0x408e0, 0x818181);
132         outpdw(MDP_BASE + 0x408e4, 0x828282);
133         outpdw(MDP_BASE + 0x408e8, 0x838383);
134         outpdw(MDP_BASE + 0x408ec, 0x848484);
135         outpdw(MDP_BASE + 0x408f0, 0x858585);
136         outpdw(MDP_BASE + 0x408f4, 0x868686);
137         outpdw(MDP_BASE + 0x408f8, 0x878787);
138         outpdw(MDP_BASE + 0x408fc, 0x888888);
139         outpdw(MDP_BASE + 0x40900, 0x898989);
140         outpdw(MDP_BASE + 0x40904, 0x8a8a8a);
141         outpdw(MDP_BASE + 0x40908, 0x8b8b8b);
142         outpdw(MDP_BASE + 0x4090c, 0x8c8c8c);
143         outpdw(MDP_BASE + 0x40910, 0x8d8d8d);
144         outpdw(MDP_BASE + 0x40914, 0x8e8e8e);
145         outpdw(MDP_BASE + 0x40918, 0x8f8f8f);
146         outpdw(MDP_BASE + 0x4091c, 0x8f8f8f);
147         outpdw(MDP_BASE + 0x40920, 0x909090);
148         outpdw(MDP_BASE + 0x40924, 0x919191);
149         outpdw(MDP_BASE + 0x40928, 0x929292);
150         outpdw(MDP_BASE + 0x4092c, 0x939393);
151         outpdw(MDP_BASE + 0x40930, 0x949494);
152         outpdw(MDP_BASE + 0x40934, 0x959595);
153         outpdw(MDP_BASE + 0x40938, 0x969696);
154         outpdw(MDP_BASE + 0x4093c, 0x969696);
155         outpdw(MDP_BASE + 0x40940, 0x979797);
156         outpdw(MDP_BASE + 0x40944, 0x989898);
157         outpdw(MDP_BASE + 0x40948, 0x999999);
158         outpdw(MDP_BASE + 0x4094c, 0x9a9a9a);
159         outpdw(MDP_BASE + 0x40950, 0x9b9b9b);
160         outpdw(MDP_BASE + 0x40954, 0x9c9c9c);
161         outpdw(MDP_BASE + 0x40958, 0x9c9c9c);
162         outpdw(MDP_BASE + 0x4095c, 0x9d9d9d);
163         outpdw(MDP_BASE + 0x40960, 0x9e9e9e);
164         outpdw(MDP_BASE + 0x40964, 0x9f9f9f);
165         outpdw(MDP_BASE + 0x40968, 0xa0a0a0);
166         outpdw(MDP_BASE + 0x4096c, 0xa0a0a0);
167         outpdw(MDP_BASE + 0x40970, 0xa1a1a1);
168         outpdw(MDP_BASE + 0x40974, 0xa2a2a2);
169         outpdw(MDP_BASE + 0x40978, 0xa3a3a3);
170         outpdw(MDP_BASE + 0x4097c, 0xa4a4a4);
171         outpdw(MDP_BASE + 0x40980, 0xa4a4a4);
172         outpdw(MDP_BASE + 0x40984, 0xa5a5a5);
173         outpdw(MDP_BASE + 0x40988, 0xa6a6a6);
174         outpdw(MDP_BASE + 0x4098c, 0xa7a7a7);
175         outpdw(MDP_BASE + 0x40990, 0xa7a7a7);
176         outpdw(MDP_BASE + 0x40994, 0xa8a8a8);
177         outpdw(MDP_BASE + 0x40998, 0xa9a9a9);
178         outpdw(MDP_BASE + 0x4099c, 0xaaaaaa);
179         outpdw(MDP_BASE + 0x409a0, 0xaaaaaa);
180         outpdw(MDP_BASE + 0x409a4, 0xababab);
181         outpdw(MDP_BASE + 0x409a8, 0xacacac);
182         outpdw(MDP_BASE + 0x409ac, 0xadadad);
183         outpdw(MDP_BASE + 0x409b0, 0xadadad);
184         outpdw(MDP_BASE + 0x409b4, 0xaeaeae);
185         outpdw(MDP_BASE + 0x409b8, 0xafafaf);
186         outpdw(MDP_BASE + 0x409bc, 0xafafaf);
187         outpdw(MDP_BASE + 0x409c0, 0xb0b0b0);
188         outpdw(MDP_BASE + 0x409c4, 0xb1b1b1);
189         outpdw(MDP_BASE + 0x409c8, 0xb2b2b2);
190         outpdw(MDP_BASE + 0x409cc, 0xb2b2b2);
191         outpdw(MDP_BASE + 0x409d0, 0xb3b3b3);
192         outpdw(MDP_BASE + 0x409d4, 0xb4b4b4);
193         outpdw(MDP_BASE + 0x409d8, 0xb4b4b4);
194         outpdw(MDP_BASE + 0x409dc, 0xb5b5b5);
195         outpdw(MDP_BASE + 0x409e0, 0xb6b6b6);
196         outpdw(MDP_BASE + 0x409e4, 0xb6b6b6);
197         outpdw(MDP_BASE + 0x409e8, 0xb7b7b7);
198         outpdw(MDP_BASE + 0x409ec, 0xb8b8b8);
199         outpdw(MDP_BASE + 0x409f0, 0xb8b8b8);
200         outpdw(MDP_BASE + 0x409f4, 0xb9b9b9);
201         outpdw(MDP_BASE + 0x409f8, 0xbababa);
202         outpdw(MDP_BASE + 0x409fc, 0xbababa);
203         outpdw(MDP_BASE + 0x40a00, 0xbbbbbb);
204         outpdw(MDP_BASE + 0x40a04, 0xbcbcbc);
205         outpdw(MDP_BASE + 0x40a08, 0xbcbcbc);
206         outpdw(MDP_BASE + 0x40a0c, 0xbdbdbd);
207         outpdw(MDP_BASE + 0x40a10, 0xbebebe);
208         outpdw(MDP_BASE + 0x40a14, 0xbebebe);
209         outpdw(MDP_BASE + 0x40a18, 0xbfbfbf);
210         outpdw(MDP_BASE + 0x40a1c, 0xc0c0c0);
211         outpdw(MDP_BASE + 0x40a20, 0xc0c0c0);
212         outpdw(MDP_BASE + 0x40a24, 0xc1c1c1);
213         outpdw(MDP_BASE + 0x40a28, 0xc1c1c1);
214         outpdw(MDP_BASE + 0x40a2c, 0xc2c2c2);
215         outpdw(MDP_BASE + 0x40a30, 0xc3c3c3);
216         outpdw(MDP_BASE + 0x40a34, 0xc3c3c3);
217         outpdw(MDP_BASE + 0x40a38, 0xc4c4c4);
218         outpdw(MDP_BASE + 0x40a3c, 0xc5c5c5);
219         outpdw(MDP_BASE + 0x40a40, 0xc5c5c5);
220         outpdw(MDP_BASE + 0x40a44, 0xc6c6c6);
221         outpdw(MDP_BASE + 0x40a48, 0xc6c6c6);
222         outpdw(MDP_BASE + 0x40a4c, 0xc7c7c7);
223         outpdw(MDP_BASE + 0x40a50, 0xc8c8c8);
224         outpdw(MDP_BASE + 0x40a54, 0xc8c8c8);
225         outpdw(MDP_BASE + 0x40a58, 0xc9c9c9);
226         outpdw(MDP_BASE + 0x40a5c, 0xc9c9c9);
227         outpdw(MDP_BASE + 0x40a60, 0xcacaca);
228         outpdw(MDP_BASE + 0x40a64, 0xcbcbcb);
229         outpdw(MDP_BASE + 0x40a68, 0xcbcbcb);
230         outpdw(MDP_BASE + 0x40a6c, 0xcccccc);
231         outpdw(MDP_BASE + 0x40a70, 0xcccccc);
232         outpdw(MDP_BASE + 0x40a74, 0xcdcdcd);
233         outpdw(MDP_BASE + 0x40a78, 0xcecece);
234         outpdw(MDP_BASE + 0x40a7c, 0xcecece);
235         outpdw(MDP_BASE + 0x40a80, 0xcfcfcf);
236         outpdw(MDP_BASE + 0x40a84, 0xcfcfcf);
237         outpdw(MDP_BASE + 0x40a88, 0xd0d0d0);
238         outpdw(MDP_BASE + 0x40a8c, 0xd0d0d0);
239         outpdw(MDP_BASE + 0x40a90, 0xd1d1d1);
240         outpdw(MDP_BASE + 0x40a94, 0xd2d2d2);
241         outpdw(MDP_BASE + 0x40a98, 0xd2d2d2);
242         outpdw(MDP_BASE + 0x40a9c, 0xd3d3d3);
243         outpdw(MDP_BASE + 0x40aa0, 0xd3d3d3);
244         outpdw(MDP_BASE + 0x40aa4, 0xd4d4d4);
245         outpdw(MDP_BASE + 0x40aa8, 0xd4d4d4);
246         outpdw(MDP_BASE + 0x40aac, 0xd5d5d5);
247         outpdw(MDP_BASE + 0x40ab0, 0xd6d6d6);
248         outpdw(MDP_BASE + 0x40ab4, 0xd6d6d6);
249         outpdw(MDP_BASE + 0x40ab8, 0xd7d7d7);
250         outpdw(MDP_BASE + 0x40abc, 0xd7d7d7);
251         outpdw(MDP_BASE + 0x40ac0, 0xd8d8d8);
252         outpdw(MDP_BASE + 0x40ac4, 0xd8d8d8);
253         outpdw(MDP_BASE + 0x40ac8, 0xd9d9d9);
254         outpdw(MDP_BASE + 0x40acc, 0xd9d9d9);
255         outpdw(MDP_BASE + 0x40ad0, 0xdadada);
256         outpdw(MDP_BASE + 0x40ad4, 0xdbdbdb);
257         outpdw(MDP_BASE + 0x40ad8, 0xdbdbdb);
258         outpdw(MDP_BASE + 0x40adc, 0xdcdcdc);
259         outpdw(MDP_BASE + 0x40ae0, 0xdcdcdc);
260         outpdw(MDP_BASE + 0x40ae4, 0xdddddd);
261         outpdw(MDP_BASE + 0x40ae8, 0xdddddd);
262         outpdw(MDP_BASE + 0x40aec, 0xdedede);
263         outpdw(MDP_BASE + 0x40af0, 0xdedede);
264         outpdw(MDP_BASE + 0x40af4, 0xdfdfdf);
265         outpdw(MDP_BASE + 0x40af8, 0xdfdfdf);
266         outpdw(MDP_BASE + 0x40afc, 0xe0e0e0);
267         outpdw(MDP_BASE + 0x40b00, 0xe0e0e0);
268         outpdw(MDP_BASE + 0x40b04, 0xe1e1e1);
269         outpdw(MDP_BASE + 0x40b08, 0xe1e1e1);
270         outpdw(MDP_BASE + 0x40b0c, 0xe2e2e2);
271         outpdw(MDP_BASE + 0x40b10, 0xe3e3e3);
272         outpdw(MDP_BASE + 0x40b14, 0xe3e3e3);
273         outpdw(MDP_BASE + 0x40b18, 0xe4e4e4);
274         outpdw(MDP_BASE + 0x40b1c, 0xe4e4e4);
275         outpdw(MDP_BASE + 0x40b20, 0xe5e5e5);
276         outpdw(MDP_BASE + 0x40b24, 0xe5e5e5);
277         outpdw(MDP_BASE + 0x40b28, 0xe6e6e6);
278         outpdw(MDP_BASE + 0x40b2c, 0xe6e6e6);
279         outpdw(MDP_BASE + 0x40b30, 0xe7e7e7);
280         outpdw(MDP_BASE + 0x40b34, 0xe7e7e7);
281         outpdw(MDP_BASE + 0x40b38, 0xe8e8e8);
282         outpdw(MDP_BASE + 0x40b3c, 0xe8e8e8);
283         outpdw(MDP_BASE + 0x40b40, 0xe9e9e9);
284         outpdw(MDP_BASE + 0x40b44, 0xe9e9e9);
285         outpdw(MDP_BASE + 0x40b48, 0xeaeaea);
286         outpdw(MDP_BASE + 0x40b4c, 0xeaeaea);
287         outpdw(MDP_BASE + 0x40b50, 0xebebeb);
288         outpdw(MDP_BASE + 0x40b54, 0xebebeb);
289         outpdw(MDP_BASE + 0x40b58, 0xececec);
290         outpdw(MDP_BASE + 0x40b5c, 0xececec);
291         outpdw(MDP_BASE + 0x40b60, 0xededed);
292         outpdw(MDP_BASE + 0x40b64, 0xededed);
293         outpdw(MDP_BASE + 0x40b68, 0xeeeeee);
294         outpdw(MDP_BASE + 0x40b6c, 0xeeeeee);
295         outpdw(MDP_BASE + 0x40b70, 0xefefef);
296         outpdw(MDP_BASE + 0x40b74, 0xefefef);
297         outpdw(MDP_BASE + 0x40b78, 0xf0f0f0);
298         outpdw(MDP_BASE + 0x40b7c, 0xf0f0f0);
299         outpdw(MDP_BASE + 0x40b80, 0xf1f1f1);
300         outpdw(MDP_BASE + 0x40b84, 0xf1f1f1);
301         outpdw(MDP_BASE + 0x40b88, 0xf2f2f2);
302         outpdw(MDP_BASE + 0x40b8c, 0xf2f2f2);
303         outpdw(MDP_BASE + 0x40b90, 0xf2f2f2);
304         outpdw(MDP_BASE + 0x40b94, 0xf3f3f3);
305         outpdw(MDP_BASE + 0x40b98, 0xf3f3f3);
306         outpdw(MDP_BASE + 0x40b9c, 0xf4f4f4);
307         outpdw(MDP_BASE + 0x40ba0, 0xf4f4f4);
308         outpdw(MDP_BASE + 0x40ba4, 0xf5f5f5);
309         outpdw(MDP_BASE + 0x40ba8, 0xf5f5f5);
310         outpdw(MDP_BASE + 0x40bac, 0xf6f6f6);
311         outpdw(MDP_BASE + 0x40bb0, 0xf6f6f6);
312         outpdw(MDP_BASE + 0x40bb4, 0xf7f7f7);
313         outpdw(MDP_BASE + 0x40bb8, 0xf7f7f7);
314         outpdw(MDP_BASE + 0x40bbc, 0xf8f8f8);
315         outpdw(MDP_BASE + 0x40bc0, 0xf8f8f8);
316         outpdw(MDP_BASE + 0x40bc4, 0xf9f9f9);
317         outpdw(MDP_BASE + 0x40bc8, 0xf9f9f9);
318         outpdw(MDP_BASE + 0x40bcc, 0xfafafa);
319         outpdw(MDP_BASE + 0x40bd0, 0xfafafa);
320         outpdw(MDP_BASE + 0x40bd4, 0xfafafa);
321         outpdw(MDP_BASE + 0x40bd8, 0xfbfbfb);
322         outpdw(MDP_BASE + 0x40bdc, 0xfbfbfb);
323         outpdw(MDP_BASE + 0x40be0, 0xfcfcfc);
324         outpdw(MDP_BASE + 0x40be4, 0xfcfcfc);
325         outpdw(MDP_BASE + 0x40be8, 0xfdfdfd);
326         outpdw(MDP_BASE + 0x40bec, 0xfdfdfd);
327         outpdw(MDP_BASE + 0x40bf0, 0xfefefe);
328         outpdw(MDP_BASE + 0x40bf4, 0xfefefe);
329         outpdw(MDP_BASE + 0x40bf8, 0xffffff);
330         outpdw(MDP_BASE + 0x40bfc, 0xffffff);
331         outpdw(MDP_BASE + 0x40c00, 0x0);
332         outpdw(MDP_BASE + 0x40c04, 0x0);
333         outpdw(MDP_BASE + 0x40c08, 0x0);
334         outpdw(MDP_BASE + 0x40c0c, 0x0);
335         outpdw(MDP_BASE + 0x40c10, 0x0);
336         outpdw(MDP_BASE + 0x40c14, 0x0);
337         outpdw(MDP_BASE + 0x40c18, 0x0);
338         outpdw(MDP_BASE + 0x40c1c, 0x0);
339         outpdw(MDP_BASE + 0x40c20, 0x0);
340         outpdw(MDP_BASE + 0x40c24, 0x0);
341         outpdw(MDP_BASE + 0x40c28, 0x0);
342         outpdw(MDP_BASE + 0x40c2c, 0x0);
343         outpdw(MDP_BASE + 0x40c30, 0x0);
344         outpdw(MDP_BASE + 0x40c34, 0x0);
345         outpdw(MDP_BASE + 0x40c38, 0x0);
346         outpdw(MDP_BASE + 0x40c3c, 0x0);
347         outpdw(MDP_BASE + 0x40c40, 0x10101);
348         outpdw(MDP_BASE + 0x40c44, 0x10101);
349         outpdw(MDP_BASE + 0x40c48, 0x10101);
350         outpdw(MDP_BASE + 0x40c4c, 0x10101);
351         outpdw(MDP_BASE + 0x40c50, 0x10101);
352         outpdw(MDP_BASE + 0x40c54, 0x10101);
353         outpdw(MDP_BASE + 0x40c58, 0x10101);
354         outpdw(MDP_BASE + 0x40c5c, 0x10101);
355         outpdw(MDP_BASE + 0x40c60, 0x10101);
356         outpdw(MDP_BASE + 0x40c64, 0x10101);
357         outpdw(MDP_BASE + 0x40c68, 0x20202);
358         outpdw(MDP_BASE + 0x40c6c, 0x20202);
359         outpdw(MDP_BASE + 0x40c70, 0x20202);
360         outpdw(MDP_BASE + 0x40c74, 0x20202);
361         outpdw(MDP_BASE + 0x40c78, 0x20202);
362         outpdw(MDP_BASE + 0x40c7c, 0x20202);
363         outpdw(MDP_BASE + 0x40c80, 0x30303);
364         outpdw(MDP_BASE + 0x40c84, 0x30303);
365         outpdw(MDP_BASE + 0x40c88, 0x30303);
366         outpdw(MDP_BASE + 0x40c8c, 0x30303);
367         outpdw(MDP_BASE + 0x40c90, 0x30303);
368         outpdw(MDP_BASE + 0x40c94, 0x40404);
369         outpdw(MDP_BASE + 0x40c98, 0x40404);
370         outpdw(MDP_BASE + 0x40c9c, 0x40404);
371         outpdw(MDP_BASE + 0x40ca0, 0x40404);
372         outpdw(MDP_BASE + 0x40ca4, 0x40404);
373         outpdw(MDP_BASE + 0x40ca8, 0x50505);
374         outpdw(MDP_BASE + 0x40cac, 0x50505);
375         outpdw(MDP_BASE + 0x40cb0, 0x50505);
376         outpdw(MDP_BASE + 0x40cb4, 0x50505);
377         outpdw(MDP_BASE + 0x40cb8, 0x60606);
378         outpdw(MDP_BASE + 0x40cbc, 0x60606);
379         outpdw(MDP_BASE + 0x40cc0, 0x60606);
380         outpdw(MDP_BASE + 0x40cc4, 0x70707);
381         outpdw(MDP_BASE + 0x40cc8, 0x70707);
382         outpdw(MDP_BASE + 0x40ccc, 0x70707);
383         outpdw(MDP_BASE + 0x40cd0, 0x70707);
384         outpdw(MDP_BASE + 0x40cd4, 0x80808);
385         outpdw(MDP_BASE + 0x40cd8, 0x80808);
386         outpdw(MDP_BASE + 0x40cdc, 0x80808);
387         outpdw(MDP_BASE + 0x40ce0, 0x90909);
388         outpdw(MDP_BASE + 0x40ce4, 0x90909);
389         outpdw(MDP_BASE + 0x40ce8, 0xa0a0a);
390         outpdw(MDP_BASE + 0x40cec, 0xa0a0a);
391         outpdw(MDP_BASE + 0x40cf0, 0xa0a0a);
392         outpdw(MDP_BASE + 0x40cf4, 0xb0b0b);
393         outpdw(MDP_BASE + 0x40cf8, 0xb0b0b);
394         outpdw(MDP_BASE + 0x40cfc, 0xb0b0b);
395         outpdw(MDP_BASE + 0x40d00, 0xc0c0c);
396         outpdw(MDP_BASE + 0x40d04, 0xc0c0c);
397         outpdw(MDP_BASE + 0x40d08, 0xd0d0d);
398         outpdw(MDP_BASE + 0x40d0c, 0xd0d0d);
399         outpdw(MDP_BASE + 0x40d10, 0xe0e0e);
400         outpdw(MDP_BASE + 0x40d14, 0xe0e0e);
401         outpdw(MDP_BASE + 0x40d18, 0xe0e0e);
402         outpdw(MDP_BASE + 0x40d1c, 0xf0f0f);
403         outpdw(MDP_BASE + 0x40d20, 0xf0f0f);
404         outpdw(MDP_BASE + 0x40d24, 0x101010);
405         outpdw(MDP_BASE + 0x40d28, 0x101010);
406         outpdw(MDP_BASE + 0x40d2c, 0x111111);
407         outpdw(MDP_BASE + 0x40d30, 0x111111);
408         outpdw(MDP_BASE + 0x40d34, 0x121212);
409         outpdw(MDP_BASE + 0x40d38, 0x121212);
410         outpdw(MDP_BASE + 0x40d3c, 0x131313);
411         outpdw(MDP_BASE + 0x40d40, 0x131313);
412         outpdw(MDP_BASE + 0x40d44, 0x141414);
413         outpdw(MDP_BASE + 0x40d48, 0x151515);
414         outpdw(MDP_BASE + 0x40d4c, 0x151515);
415         outpdw(MDP_BASE + 0x40d50, 0x161616);
416         outpdw(MDP_BASE + 0x40d54, 0x161616);
417         outpdw(MDP_BASE + 0x40d58, 0x171717);
418         outpdw(MDP_BASE + 0x40d5c, 0x171717);
419         outpdw(MDP_BASE + 0x40d60, 0x181818);
420         outpdw(MDP_BASE + 0x40d64, 0x191919);
421         outpdw(MDP_BASE + 0x40d68, 0x191919);
422         outpdw(MDP_BASE + 0x40d6c, 0x1a1a1a);
423         outpdw(MDP_BASE + 0x40d70, 0x1b1b1b);
424         outpdw(MDP_BASE + 0x40d74, 0x1b1b1b);
425         outpdw(MDP_BASE + 0x40d78, 0x1c1c1c);
426         outpdw(MDP_BASE + 0x40d7c, 0x1c1c1c);
427         outpdw(MDP_BASE + 0x40d80, 0x1d1d1d);
428         outpdw(MDP_BASE + 0x40d84, 0x1e1e1e);
429         outpdw(MDP_BASE + 0x40d88, 0x1f1f1f);
430         outpdw(MDP_BASE + 0x40d8c, 0x1f1f1f);
431         outpdw(MDP_BASE + 0x40d90, 0x202020);
432         outpdw(MDP_BASE + 0x40d94, 0x212121);
433         outpdw(MDP_BASE + 0x40d98, 0x212121);
434         outpdw(MDP_BASE + 0x40d9c, 0x222222);
435         outpdw(MDP_BASE + 0x40da0, 0x232323);
436         outpdw(MDP_BASE + 0x40da4, 0x242424);
437         outpdw(MDP_BASE + 0x40da8, 0x242424);
438         outpdw(MDP_BASE + 0x40dac, 0x252525);
439         outpdw(MDP_BASE + 0x40db0, 0x262626);
440         outpdw(MDP_BASE + 0x40db4, 0x272727);
441         outpdw(MDP_BASE + 0x40db8, 0x272727);
442         outpdw(MDP_BASE + 0x40dbc, 0x282828);
443         outpdw(MDP_BASE + 0x40dc0, 0x292929);
444         outpdw(MDP_BASE + 0x40dc4, 0x2a2a2a);
445         outpdw(MDP_BASE + 0x40dc8, 0x2b2b2b);
446         outpdw(MDP_BASE + 0x40dcc, 0x2c2c2c);
447         outpdw(MDP_BASE + 0x40dd0, 0x2c2c2c);
448         outpdw(MDP_BASE + 0x40dd4, 0x2d2d2d);
449         outpdw(MDP_BASE + 0x40dd8, 0x2e2e2e);
450         outpdw(MDP_BASE + 0x40ddc, 0x2f2f2f);
451         outpdw(MDP_BASE + 0x40de0, 0x303030);
452         outpdw(MDP_BASE + 0x40de4, 0x313131);
453         outpdw(MDP_BASE + 0x40de8, 0x323232);
454         outpdw(MDP_BASE + 0x40dec, 0x333333);
455         outpdw(MDP_BASE + 0x40df0, 0x333333);
456         outpdw(MDP_BASE + 0x40df4, 0x343434);
457         outpdw(MDP_BASE + 0x40df8, 0x353535);
458         outpdw(MDP_BASE + 0x40dfc, 0x363636);
459         outpdw(MDP_BASE + 0x40e00, 0x373737);
460         outpdw(MDP_BASE + 0x40e04, 0x383838);
461         outpdw(MDP_BASE + 0x40e08, 0x393939);
462         outpdw(MDP_BASE + 0x40e0c, 0x3a3a3a);
463         outpdw(MDP_BASE + 0x40e10, 0x3b3b3b);
464         outpdw(MDP_BASE + 0x40e14, 0x3c3c3c);
465         outpdw(MDP_BASE + 0x40e18, 0x3d3d3d);
466         outpdw(MDP_BASE + 0x40e1c, 0x3e3e3e);
467         outpdw(MDP_BASE + 0x40e20, 0x3f3f3f);
468         outpdw(MDP_BASE + 0x40e24, 0x404040);
469         outpdw(MDP_BASE + 0x40e28, 0x414141);
470         outpdw(MDP_BASE + 0x40e2c, 0x424242);
471         outpdw(MDP_BASE + 0x40e30, 0x434343);
472         outpdw(MDP_BASE + 0x40e34, 0x444444);
473         outpdw(MDP_BASE + 0x40e38, 0x464646);
474         outpdw(MDP_BASE + 0x40e3c, 0x474747);
475         outpdw(MDP_BASE + 0x40e40, 0x484848);
476         outpdw(MDP_BASE + 0x40e44, 0x494949);
477         outpdw(MDP_BASE + 0x40e48, 0x4a4a4a);
478         outpdw(MDP_BASE + 0x40e4c, 0x4b4b4b);
479         outpdw(MDP_BASE + 0x40e50, 0x4c4c4c);
480         outpdw(MDP_BASE + 0x40e54, 0x4d4d4d);
481         outpdw(MDP_BASE + 0x40e58, 0x4f4f4f);
482         outpdw(MDP_BASE + 0x40e5c, 0x505050);
483         outpdw(MDP_BASE + 0x40e60, 0x515151);
484         outpdw(MDP_BASE + 0x40e64, 0x525252);
485         outpdw(MDP_BASE + 0x40e68, 0x535353);
486         outpdw(MDP_BASE + 0x40e6c, 0x545454);
487         outpdw(MDP_BASE + 0x40e70, 0x565656);
488         outpdw(MDP_BASE + 0x40e74, 0x575757);
489         outpdw(MDP_BASE + 0x40e78, 0x585858);
490         outpdw(MDP_BASE + 0x40e7c, 0x595959);
491         outpdw(MDP_BASE + 0x40e80, 0x5b5b5b);
492         outpdw(MDP_BASE + 0x40e84, 0x5c5c5c);
493         outpdw(MDP_BASE + 0x40e88, 0x5d5d5d);
494         outpdw(MDP_BASE + 0x40e8c, 0x5e5e5e);
495         outpdw(MDP_BASE + 0x40e90, 0x606060);
496         outpdw(MDP_BASE + 0x40e94, 0x616161);
497         outpdw(MDP_BASE + 0x40e98, 0x626262);
498         outpdw(MDP_BASE + 0x40e9c, 0x646464);
499         outpdw(MDP_BASE + 0x40ea0, 0x656565);
500         outpdw(MDP_BASE + 0x40ea4, 0x666666);
501         outpdw(MDP_BASE + 0x40ea8, 0x686868);
502         outpdw(MDP_BASE + 0x40eac, 0x696969);
503         outpdw(MDP_BASE + 0x40eb0, 0x6a6a6a);
504         outpdw(MDP_BASE + 0x40eb4, 0x6c6c6c);
505         outpdw(MDP_BASE + 0x40eb8, 0x6d6d6d);
506         outpdw(MDP_BASE + 0x40ebc, 0x6f6f6f);
507         outpdw(MDP_BASE + 0x40ec0, 0x707070);
508         outpdw(MDP_BASE + 0x40ec4, 0x717171);
509         outpdw(MDP_BASE + 0x40ec8, 0x737373);
510         outpdw(MDP_BASE + 0x40ecc, 0x747474);
511         outpdw(MDP_BASE + 0x40ed0, 0x767676);
512         outpdw(MDP_BASE + 0x40ed4, 0x777777);
513         outpdw(MDP_BASE + 0x40ed8, 0x797979);
514         outpdw(MDP_BASE + 0x40edc, 0x7a7a7a);
515         outpdw(MDP_BASE + 0x40ee0, 0x7c7c7c);
516         outpdw(MDP_BASE + 0x40ee4, 0x7d7d7d);
517         outpdw(MDP_BASE + 0x40ee8, 0x7f7f7f);
518         outpdw(MDP_BASE + 0x40eec, 0x808080);
519         outpdw(MDP_BASE + 0x40ef0, 0x828282);
520         outpdw(MDP_BASE + 0x40ef4, 0x838383);
521         outpdw(MDP_BASE + 0x40ef8, 0x858585);
522         outpdw(MDP_BASE + 0x40efc, 0x868686);
523         outpdw(MDP_BASE + 0x40f00, 0x888888);
524         outpdw(MDP_BASE + 0x40f04, 0x898989);
525         outpdw(MDP_BASE + 0x40f08, 0x8b8b8b);
526         outpdw(MDP_BASE + 0x40f0c, 0x8d8d8d);
527         outpdw(MDP_BASE + 0x40f10, 0x8e8e8e);
528         outpdw(MDP_BASE + 0x40f14, 0x909090);
529         outpdw(MDP_BASE + 0x40f18, 0x919191);
530         outpdw(MDP_BASE + 0x40f1c, 0x939393);
531         outpdw(MDP_BASE + 0x40f20, 0x959595);
532         outpdw(MDP_BASE + 0x40f24, 0x969696);
533         outpdw(MDP_BASE + 0x40f28, 0x989898);
534         outpdw(MDP_BASE + 0x40f2c, 0x9a9a9a);
535         outpdw(MDP_BASE + 0x40f30, 0x9b9b9b);
536         outpdw(MDP_BASE + 0x40f34, 0x9d9d9d);
537         outpdw(MDP_BASE + 0x40f38, 0x9f9f9f);
538         outpdw(MDP_BASE + 0x40f3c, 0xa1a1a1);
539         outpdw(MDP_BASE + 0x40f40, 0xa2a2a2);
540         outpdw(MDP_BASE + 0x40f44, 0xa4a4a4);
541         outpdw(MDP_BASE + 0x40f48, 0xa6a6a6);
542         outpdw(MDP_BASE + 0x40f4c, 0xa7a7a7);
543         outpdw(MDP_BASE + 0x40f50, 0xa9a9a9);
544         outpdw(MDP_BASE + 0x40f54, 0xababab);
545         outpdw(MDP_BASE + 0x40f58, 0xadadad);
546         outpdw(MDP_BASE + 0x40f5c, 0xafafaf);
547         outpdw(MDP_BASE + 0x40f60, 0xb0b0b0);
548         outpdw(MDP_BASE + 0x40f64, 0xb2b2b2);
549         outpdw(MDP_BASE + 0x40f68, 0xb4b4b4);
550         outpdw(MDP_BASE + 0x40f6c, 0xb6b6b6);
551         outpdw(MDP_BASE + 0x40f70, 0xb8b8b8);
552         outpdw(MDP_BASE + 0x40f74, 0xbababa);
553         outpdw(MDP_BASE + 0x40f78, 0xbbbbbb);
554         outpdw(MDP_BASE + 0x40f7c, 0xbdbdbd);
555         outpdw(MDP_BASE + 0x40f80, 0xbfbfbf);
556         outpdw(MDP_BASE + 0x40f84, 0xc1c1c1);
557         outpdw(MDP_BASE + 0x40f88, 0xc3c3c3);
558         outpdw(MDP_BASE + 0x40f8c, 0xc5c5c5);
559         outpdw(MDP_BASE + 0x40f90, 0xc7c7c7);
560         outpdw(MDP_BASE + 0x40f94, 0xc9c9c9);
561         outpdw(MDP_BASE + 0x40f98, 0xcbcbcb);
562         outpdw(MDP_BASE + 0x40f9c, 0xcdcdcd);
563         outpdw(MDP_BASE + 0x40fa0, 0xcfcfcf);
564         outpdw(MDP_BASE + 0x40fa4, 0xd1d1d1);
565         outpdw(MDP_BASE + 0x40fa8, 0xd3d3d3);
566         outpdw(MDP_BASE + 0x40fac, 0xd5d5d5);
567         outpdw(MDP_BASE + 0x40fb0, 0xd7d7d7);
568         outpdw(MDP_BASE + 0x40fb4, 0xd9d9d9);
569         outpdw(MDP_BASE + 0x40fb8, 0xdbdbdb);
570         outpdw(MDP_BASE + 0x40fbc, 0xdddddd);
571         outpdw(MDP_BASE + 0x40fc0, 0xdfdfdf);
572         outpdw(MDP_BASE + 0x40fc4, 0xe1e1e1);
573         outpdw(MDP_BASE + 0x40fc8, 0xe3e3e3);
574         outpdw(MDP_BASE + 0x40fcc, 0xe5e5e5);
575         outpdw(MDP_BASE + 0x40fd0, 0xe7e7e7);
576         outpdw(MDP_BASE + 0x40fd4, 0xe9e9e9);
577         outpdw(MDP_BASE + 0x40fd8, 0xebebeb);
578         outpdw(MDP_BASE + 0x40fdc, 0xeeeeee);
579         outpdw(MDP_BASE + 0x40fe0, 0xf0f0f0);
580         outpdw(MDP_BASE + 0x40fe4, 0xf2f2f2);
581         outpdw(MDP_BASE + 0x40fe8, 0xf4f4f4);
582         outpdw(MDP_BASE + 0x40fec, 0xf6f6f6);
583         outpdw(MDP_BASE + 0x40ff0, 0xf8f8f8);
584         outpdw(MDP_BASE + 0x40ff4, 0xfbfbfb);
585         outpdw(MDP_BASE + 0x40ff8, 0xfdfdfd);
586         outpdw(MDP_BASE + 0x40ffc, 0xffffff);
587 }
588
589 #define   IRQ_EN_1__MDP_IRQ___M    0x00000800
590
591 void mdp_hw_init(void)
592 {
593         int i;
594
595         /* MDP cmd block enable */
596         mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);
597
598         /* debug interface write access */
599         outpdw(MDP_BASE + 0x60, 1);
600
601         outp32(MDP_INTR_ENABLE, MDP_ANY_INTR_MASK);
602         outp32(MDP_EBI2_PORTMAP_MODE, 0x3);
603         outpdw(MDP_CMD_DEBUG_ACCESS_BASE + 0x01f8, 0x0);
604         outpdw(MDP_CMD_DEBUG_ACCESS_BASE + 0x01fc, 0x0);
605         outpdw(MDP_BASE + 0x60, 0x1);
606         mdp_load_lut_param();
607
608         /*
609          * clear up unused fg/main registers
610          */
611         /* comp.plane 2&3 ystride */
612         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0120, 0x0);
613         /* unpacked pattern */
614         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x012c, 0x0);
615         /* unpacked pattern */
616         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0130, 0x0);
617         /* unpacked pattern */
618         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0134, 0x0);
619         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0158, 0x0);
620         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x15c, 0x0);
621         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0160, 0x0);
622         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0170, 0x0);
623         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0174, 0x0);
624         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x017c, 0x0);
625
626         /* comp.plane 2 */
627         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0114, 0x0);
628         /* comp.plane 3 */
629         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0118, 0x0);
630
631         /* clear up unused bg registers */
632         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01c8, 0);
633         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01d0, 0);
634         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01dc, 0);
635         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01e0, 0);
636         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x01e4, 0);
637
638 #ifndef CONFIG_FB_MSM_MDP22
639         MDP_OUTP(MDP_BASE + 0xE0000, 0);
640         MDP_OUTP(MDP_BASE + 0x100, 0xffffffff);
641         MDP_OUTP(MDP_BASE + 0x90070, 0);
642         MDP_OUTP(MDP_BASE + 0x94010, 1);
643         MDP_OUTP(MDP_BASE + 0x9401c, 2);
644 #endif
645
646         /*
647          * limit vector
648          * pre gets applied before color matrix conversion
649          * post is after ccs
650          */
651         writel(mdp_plv[0], MDP_CSC_PRE_LV1n(0));
652         writel(mdp_plv[1], MDP_CSC_PRE_LV1n(1));
653         writel(mdp_plv[2], MDP_CSC_PRE_LV1n(2));
654         writel(mdp_plv[3], MDP_CSC_PRE_LV1n(3));
655
656 #ifdef CONFIG_FB_MSM_MDP31
657         writel(mdp_plv[2], MDP_CSC_PRE_LV1n(4));
658         writel(mdp_plv[3], MDP_CSC_PRE_LV1n(5));
659
660         writel(0, MDP_CSC_POST_LV1n(0));
661         writel(0xff, MDP_CSC_POST_LV1n(1));
662         writel(0, MDP_CSC_POST_LV1n(2));
663         writel(0xff, MDP_CSC_POST_LV1n(3));
664         writel(0, MDP_CSC_POST_LV1n(4));
665         writel(0xff, MDP_CSC_POST_LV1n(5));
666
667         writel(0, MDP_CSC_PRE_LV2n(0));
668         writel(0xff, MDP_CSC_PRE_LV2n(1));
669         writel(0, MDP_CSC_PRE_LV2n(2));
670         writel(0xff, MDP_CSC_PRE_LV2n(3));
671         writel(0, MDP_CSC_PRE_LV2n(4));
672         writel(0xff, MDP_CSC_PRE_LV2n(5));
673
674         writel(mdp_plv[0], MDP_CSC_POST_LV2n(0));
675         writel(mdp_plv[1], MDP_CSC_POST_LV2n(1));
676         writel(mdp_plv[2], MDP_CSC_POST_LV2n(2));
677         writel(mdp_plv[3], MDP_CSC_POST_LV2n(3));
678         writel(mdp_plv[2], MDP_CSC_POST_LV2n(4));
679         writel(mdp_plv[3], MDP_CSC_POST_LV2n(5));
680 #endif
681
682         /* primary forward matrix */
683         for (i = 0; i < MDP_CCS_SIZE; i++)
684                 writel(mdp_ccs_rgb2yuv.ccs[i], MDP_CSC_PFMVn(i));
685
686 #ifdef CONFIG_FB_MSM_MDP31
687         for (i = 0; i < MDP_BV_SIZE; i++)
688                 writel(mdp_ccs_rgb2yuv.bv[i], MDP_CSC_POST_BV2n(i));
689
690         writel(0, MDP_CSC_PRE_BV2n(0));
691         writel(0, MDP_CSC_PRE_BV2n(1));
692         writel(0, MDP_CSC_PRE_BV2n(2));
693 #endif
694         /* primary reverse matrix */
695         for (i = 0; i < MDP_CCS_SIZE; i++)
696                 writel(mdp_ccs_yuv2rgb.ccs[i], MDP_CSC_PRMVn(i));
697
698         for (i = 0; i < MDP_BV_SIZE; i++)
699                 writel(mdp_ccs_yuv2rgb.bv[i], MDP_CSC_PRE_BV1n(i));
700
701 #ifdef CONFIG_FB_MSM_MDP31
702         writel(0, MDP_CSC_POST_BV1n(0));
703         writel(0, MDP_CSC_POST_BV1n(1));
704         writel(0, MDP_CSC_POST_BV1n(2));
705
706         outpdw(MDP_BASE + 0x30010, 0x03e0);
707         outpdw(MDP_BASE + 0x30014, 0x0360);
708         outpdw(MDP_BASE + 0x30018, 0x0120);
709         outpdw(MDP_BASE + 0x3001c, 0x0140);
710 #endif
711         mdp_init_scale_table();
712
713 #ifndef CONFIG_FB_MSM_MDP31
714         MDP_OUTP(MDP_CMD_DEBUG_ACCESS_BASE + 0x0104,
715                  ((16 << 6) << 16) | (16) << 6);
716 #endif
717
718         /* MDP cmd block disable */
719         mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);
720 }