tizen 2.4 release
[kernel/u-boot-tm1.git] / drivers / video / sprdfb / lcd / lcd_ili9806e_mipi.c
1 /* drivers/video/sc8825/lcd_ili9806e_mipi.c\r
2  *\r
3  * Support for ili9806e mipi LCD device\r
4  *\r
5  * Copyright (C) 2010 Spreadtrum\r
6  *\r
7  * This software is licensed under the terms of the GNU General Public\r
8  * License version 2, as published by the Free Software Foundation, and\r
9  * may be copied, distributed, and modified under those terms.\r
10  *\r
11  * This program is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  */\r
16 \r
17 #include <asm/arch/sprd_lcd.h>\r
18 #include "../sprdfb.h"\r
19 \r
20 #define printk printf\r
21 \r
22 //#define  LCD_DEBUG\r
23 #ifdef LCD_DEBUG\r
24 #define LCD_PRINT printk\r
25 #else\r
26 #define LCD_PRINT(...)\r
27 #endif\r
28 \r
29 #define MAX_DATA   48\r
30 \r
31 typedef struct LCM_Init_Code_tag {\r
32         unsigned int tag;\r
33         unsigned char data[MAX_DATA];\r
34 }LCM_Init_Code;\r
35 \r
36 typedef struct LCM_force_cmd_code_tag{\r
37         unsigned int datatype;\r
38         LCM_Init_Code real_cmd_code;\r
39 }LCM_Force_Cmd_Code;\r
40 \r
41 #define LCM_TAG_SHIFT 24\r
42 #define LCM_TAG_MASK  ((1 << 24) -1)\r
43 #define LCM_SEND(len) ((1 << LCM_TAG_SHIFT)| len)\r
44 #define LCM_SLEEP(ms) ((2 << LCM_TAG_SHIFT)| ms)\r
45 //#define ARRAY_SIZE(array) ( sizeof(array) / sizeof(array[0]))\r
46 \r
47 #define LCM_TAG_SEND  (1<< 0)\r
48 #define LCM_TAG_SLEEP (1 << 1)\r
49 \r
50 #if 0 /*For SS */\r
51 static LCM_Init_Code init_data[] = {\r
52         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x01}},\r
53         {LCM_SLEEP(5)},\r
54 \r
55         {LCM_SEND(2), {0x08,0x10}},\r
56 \r
57         {LCM_SEND(2), {0x21,0x01}},\r
58 \r
59         {LCM_SEND(2), {0x30,0x02}},\r
60         {LCM_SEND(2), {0x31,0x00}}, //0x02\r
61 \r
62         {LCM_SEND(2), {0x60,0x07}},\r
63         {LCM_SEND(2), {0x61,0x06}},\r
64         {LCM_SEND(2), {0x62,0x06}},\r
65         {LCM_SEND(2), {0x63,0x04}},\r
66 \r
67         {LCM_SEND(2), {0x40,0x14}},\r
68         {LCM_SEND(2), {0x41,0x44}},//22\r
69         {LCM_SEND(2), {0x42,0x01}},\r
70         {LCM_SEND(2), {0x43,0x89}},\r
71         {LCM_SEND(2), {0x44,0x89}},\r
72         {LCM_SEND(2), {0x45,0x1b}},\r
73         {LCM_SEND(2), {0x46,0x44}},\r
74         {LCM_SEND(2), {0x47,0x44}},\r
75 \r
76         {LCM_SEND(2), {0x50,0x85}},\r
77         {LCM_SEND(2), {0x51,0x85}},\r
78         {LCM_SEND(2), {0x52,0x00}},\r
79         {LCM_SEND(2), {0x53,0x64}},//90\r
80 \r
81         //{LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x01}},\r
82 \r
83         {LCM_SEND(2), {0xA0,0x00}},\r
84         {LCM_SEND(2), {0xA1,0x00}},//01\r
85         {LCM_SEND(2), {0xA2,0x03}},//08\r
86         {LCM_SEND(2), {0xA3,0x0e}},//0e\r
87         {LCM_SEND(2), {0xA4,0x08}},//08\r
88         {LCM_SEND(2), {0xA5,0x1f}},//19\r
89         {LCM_SEND(2), {0xA6,0x0f}},//0b\r
90         {LCM_SEND(2), {0xA7,0x0b}},//0a\r
91         {LCM_SEND(2), {0xA8,0x03}},//02\r
92         {LCM_SEND(2), {0xA9,0x06}},//08\r
93         {LCM_SEND(2), {0xAA,0x05}},//04\r
94         {LCM_SEND(2), {0xAB,0x02}},//03\r
95         {LCM_SEND(2), {0xAC,0x0e}},//0a\r
96         {LCM_SEND(2), {0xAD,0x25}},//2c\r
97         {LCM_SEND(2), {0xAE,0x1d}},//28\r
98         {LCM_SEND(2), {0xAF,0x00}},\r
99 \r
100         {LCM_SEND(2), {0xC0,0x00}},//00\r
101         {LCM_SEND(2), {0xC1,0x04}},//02\r
102         {LCM_SEND(2), {0xC2,0x0f}},//09\r
103         {LCM_SEND(2), {0xC3,0x10}},//0e\r
104         {LCM_SEND(2), {0xC4,0x0b}},//09\r
105         {LCM_SEND(2), {0xC5,0x1e}},//19\r
106         {LCM_SEND(2), {0xC6,0x09}},//0a\r
107         {LCM_SEND(2), {0xC7,0x0a}},//0a\r
108         {LCM_SEND(2), {0xC8,0x00}},//02\r
109         {LCM_SEND(2), {0xC9,0x0a}},//07\r
110         {LCM_SEND(2), {0xCA,0x01}},//05\r
111         {LCM_SEND(2), {0xCB,0x06}},//04\r
112         {LCM_SEND(2), {0xCC,0x09}},//0a\r
113         {LCM_SEND(2), {0xCD,0x2a}},//2d\r
114         {LCM_SEND(2), {0xCE,0x28}},//28\r
115         {LCM_SEND(2), {0xCF,0x00}},//00\r
116 \r
117         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x06}},\r
118         {LCM_SEND(2), {0x00,0xa0}},\r
119         {LCM_SEND(2), {0x01,0x05}},\r
120         {LCM_SEND(2), {0x02,0x00}},\r
121         {LCM_SEND(2), {0x03,0x00}},\r
122         {LCM_SEND(2), {0x04,0x01}},\r
123         {LCM_SEND(2), {0x05,0x01}},\r
124         {LCM_SEND(2), {0x06,0x88}},\r
125         {LCM_SEND(2), {0x07,0x04}},\r
126         {LCM_SEND(2), {0x08,0x01}},\r
127         {LCM_SEND(2), {0x09,0x90}},\r
128         {LCM_SEND(2), {0x0A,0x04}},\r
129         {LCM_SEND(2), {0x0B,0x01}},\r
130         {LCM_SEND(2), {0x0C,0x01}},\r
131         {LCM_SEND(2), {0x0D,0x01}},\r
132         {LCM_SEND(2), {0x0E,0x00}},\r
133         {LCM_SEND(2), {0x0F,0x00}},\r
134 \r
135         {LCM_SEND(2), {0x10,0x55}},\r
136         {LCM_SEND(2), {0x11,0x50}},\r
137         {LCM_SEND(2), {0x12,0x01}},\r
138         {LCM_SEND(2), {0x13,0x85}},\r
139         {LCM_SEND(2), {0x14,0x85}},\r
140         {LCM_SEND(2), {0x15,0xc0}},\r
141         {LCM_SEND(2), {0x16,0x0B}},\r
142         {LCM_SEND(2), {0x17,0x00}},\r
143         {LCM_SEND(2), {0x18,0x00}},\r
144         {LCM_SEND(2), {0x19,0x00}},\r
145         {LCM_SEND(2), {0x1A,0x00}},\r
146         {LCM_SEND(2), {0x1B,0x00}},\r
147         {LCM_SEND(2), {0x1C,0x00}},\r
148         {LCM_SEND(2), {0x1D,0x00}},\r
149 \r
150         {LCM_SEND(2), {0x20,0x01}},\r
151         {LCM_SEND(2), {0x21,0x23}},\r
152         {LCM_SEND(2), {0x22,0x45}},\r
153         {LCM_SEND(2), {0x23,0x67}},\r
154         {LCM_SEND(2), {0x24,0x01}},\r
155         {LCM_SEND(2), {0x25,0x23}},\r
156         {LCM_SEND(2), {0x26,0x45}},\r
157         {LCM_SEND(2), {0x27,0x67}},\r
158 \r
159         {LCM_SEND(2), {0x30,0x02}},\r
160         {LCM_SEND(2), {0x31,0x22}},\r
161         {LCM_SEND(2), {0x32,0x11}},\r
162         {LCM_SEND(2), {0x33,0xaa}},\r
163         {LCM_SEND(2), {0x34,0xbb}},\r
164         {LCM_SEND(2), {0x35,0x66}},\r
165         {LCM_SEND(2), {0x36,0x00}},\r
166         {LCM_SEND(2), {0x37,0x22}},\r
167         {LCM_SEND(2), {0x38,0x22}},\r
168         {LCM_SEND(2), {0x39,0x22}},\r
169         {LCM_SEND(2), {0x3A,0x22}},\r
170         {LCM_SEND(2), {0x3B,0x22}},\r
171         {LCM_SEND(2), {0x3C,0x22}},\r
172         {LCM_SEND(2), {0x3D,0x22}},\r
173         {LCM_SEND(2), {0x3E,0x22}},\r
174         {LCM_SEND(2), {0x3F,0x22}},\r
175 \r
176         {LCM_SEND(2), {0x40,0x22}},\r
177         {LCM_SEND(2), {0x53,0x1a}},\r
178 \r
179         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x07}},\r
180         {LCM_SEND(2), {0x18,0x1d}},\r
181         {LCM_SEND(2), {0x17,0x12}},\r
182 \r
183         {LCM_SEND(2), {0x02,0x77}},\r
184 \r
185         {LCM_SEND(2), {0xe1,0x79}},\r
186 \r
187         {LCM_SEND(2), {0x06,0x13}},\r
188 \r
189         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x00}},\r
190 \r
191 //      {LCM_SEND(2), {0x35,0x00}},\r
192 \r
193         {LCM_SEND(1), {0x11}},\r
194         {LCM_SLEEP(120)},\r
195 \r
196         {LCM_SEND(1), {0x29}},\r
197         {LCM_SLEEP(1)},\r
198 \r
199 //      {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x08}},\r
200 };\r
201 \r
202 #else /*For SPRD*/\r
203 static LCM_Init_Code init_data[] = {\r
204         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x01}},// Change to Page 1\r
205         {LCM_SLEEP(5)},\r
206 \r
207         {LCM_SEND(2), {0x08,0x10}},// output SDA\r
208 \r
209         {LCM_SEND(2), {0x21,0x01}},// DE = 1 Active\r
210 \r
211         {LCM_SEND(2), {0x30,0x02}},// 480 X 800\r
212         {LCM_SEND(2), {0x31,0x02}}, // 2-dot Inversion\r
213 \r
214         {LCM_SEND(2), {0x50,0x78}},// VGMP\r
215         {LCM_SEND(2), {0x51,0x78}},// VGMN\r
216         {LCM_SEND(2), {0x52,0x00}}, //Flicker\r
217         {LCM_SEND(2), {0x53,0x61}},//Flicker\r
218 \r
219         {LCM_SEND(2), {0x60,0x07}},// SDTI\r
220         {LCM_SEND(2), {0x61,0x00}},// CRTI\r
221         {LCM_SEND(2), {0x62,0x08}},// EQTI\r
222         {LCM_SEND(2), {0x63,0x00}}, // PCTI\r
223 \r
224         {LCM_SEND(2), {0x40,0x15}},// VGH/VGL\r
225         {LCM_SEND(2), {0x41,0x44}}, // VGH/VGL\r
226         {LCM_SEND(2), {0x42,0x03}},// VGH/VGL\r
227         {LCM_SEND(2), {0x43,0x89}},// VGH/VGL\r
228         {LCM_SEND(2), {0x44,0x82}},// VGH/VGL\r
229 \r
230 //++++++++++++++++++ Gamma Setting ++++++++++++++++++//\r
231 \r
232         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x01}},// Change to Page 1\r
233 \r
234         {LCM_SEND(2), {0xA0,0x00}},// Gamma 0\r
235         {LCM_SEND(2), {0xA1,0x06}},// Gamma 4\r
236         {LCM_SEND(2), {0xA2,0x0c}},// Gamma 8\r
237         {LCM_SEND(2), {0xA3,0x12}},// Gamma 16\r
238         {LCM_SEND(2), {0xA4,0x0d}},// Gamma 24\r
239         {LCM_SEND(2), {0xA5,0x1f}},// Gamma 52\r
240         {LCM_SEND(2), {0xA6,0x0b}},// Gamma 80\r
241         {LCM_SEND(2), {0xA7,0x08}},// Gamma 108\r
242         {LCM_SEND(2), {0xA8,0x04}},// Gamma 147\r
243         {LCM_SEND(2), {0xA9,0x0a}},// Gamma 175\r
244         {LCM_SEND(2), {0xAA,0x06}},// Gamma 203\r
245         {LCM_SEND(2), {0xAB,0x04}},// Gamma 231\r
246         {LCM_SEND(2), {0xAC,0x10}},// Gamma 239\r
247         {LCM_SEND(2), {0xAD,0x37}},// Gamma 247\r
248         {LCM_SEND(2), {0xAE,0x30}},// Gamma 251\r
249         {LCM_SEND(2), {0xAF,0x07}},// Gamma 255\r
250 \r
251 ///==============Nagitive\r
252         {LCM_SEND(2), {0xC0,0x00}}, // Gamma 0\r
253         {LCM_SEND(2), {0xC1,0x06}}, // Gamma 4\r
254         {LCM_SEND(2), {0xC2,0x1f}}, // Gamma 8\r
255         {LCM_SEND(2), {0xC3,0x06}}, // Gamma 16\r
256         {LCM_SEND(2), {0xC4,0x04}}, // Gamma 24\r
257         {LCM_SEND(2), {0xC5,0x13}}, // Gamma 52\r
258         {LCM_SEND(2), {0xC6,0x05}}, // Gamma 80\r
259         {LCM_SEND(2), {0xC7,0x05}}, // Gamma 108\r
260         {LCM_SEND(2), {0xC8,0x03}}, // Gamma 147\r
261         {LCM_SEND(2), {0xC9,0x06}}, // Gamma 175\r
262         {LCM_SEND(2), {0xCA,0x06}}, // Gamma 203\r
263         {LCM_SEND(2), {0xCB,0x03}}, // Gamma 231\r
264         {LCM_SEND(2), {0xCC,0x01}}, // Gamma 239\r
265         {LCM_SEND(2), {0xCD,0x27}}, // Gamma 247\r
266         {LCM_SEND(2), {0xCE,0x24}}, // Gamma 251\r
267         {LCM_SEND(2), {0xCF,0x07}}, // Gamma 255\r
268 \r
269         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x06}}, // Change to Page 6\r
270 \r
271         {LCM_SEND(2), {0x00,0x3c}},\r
272         {LCM_SEND(2), {0x01,0x06}},\r
273         {LCM_SEND(2), {0x02,0x00}},\r
274         {LCM_SEND(2), {0x03,0x00}},\r
275         {LCM_SEND(2), {0x04,0x0d}},\r
276         {LCM_SEND(2), {0x05,0x0d}},\r
277         {LCM_SEND(2), {0x06,0x80}},\r
278         {LCM_SEND(2), {0x07,0x04}},\r
279         {LCM_SEND(2), {0x08,0x03}},\r
280         {LCM_SEND(2), {0x09,0x00}},\r
281         {LCM_SEND(2), {0x0A,0x00}},\r
282         {LCM_SEND(2), {0x0B,0x00}},\r
283         {LCM_SEND(2), {0x0C,0x0d}},\r
284         {LCM_SEND(2), {0x0D,0x0d}},\r
285         {LCM_SEND(2), {0x0E,0x00}},\r
286         {LCM_SEND(2), {0x0F,0x00}},\r
287 \r
288         {LCM_SEND(2), {0x10,0x50}},\r
289         {LCM_SEND(2), {0x11,0xd0}},\r
290         {LCM_SEND(2), {0x12,0x00}},\r
291         {LCM_SEND(2), {0x13,0x00}},\r
292         {LCM_SEND(2), {0x14,0x00}},\r
293         {LCM_SEND(2), {0x15,0xc0}},\r
294         {LCM_SEND(2), {0x16,0x08}},\r
295         {LCM_SEND(2), {0x17,0x00}},\r
296         {LCM_SEND(2), {0x18,0x00}},\r
297         {LCM_SEND(2), {0x19,0x00}},\r
298         {LCM_SEND(2), {0x1A,0x00}},\r
299         {LCM_SEND(2), {0x1B,0x00}},\r
300         {LCM_SEND(2), {0x1C,0x48}},\r
301         {LCM_SEND(2), {0x1D,0x00}},\r
302 \r
303         {LCM_SEND(2), {0x20,0x01}},\r
304         {LCM_SEND(2), {0x21,0x23}},\r
305         {LCM_SEND(2), {0x22,0x45}},\r
306         {LCM_SEND(2), {0x23,0x67}},\r
307         {LCM_SEND(2), {0x24,0x01}},\r
308         {LCM_SEND(2), {0x25,0x23}},\r
309         {LCM_SEND(2), {0x26,0x45}},\r
310         {LCM_SEND(2), {0x27,0x67}},\r
311 \r
312         {LCM_SEND(2), {0x30,0x13}},\r
313         {LCM_SEND(2), {0x31,0x22}},\r
314         {LCM_SEND(2), {0x32,0xdd}},\r
315         {LCM_SEND(2), {0x33,0xcc}},\r
316         {LCM_SEND(2), {0x34,0xbb}},\r
317         {LCM_SEND(2), {0x35,0xaa}},\r
318         {LCM_SEND(2), {0x36,0x22}},\r
319         {LCM_SEND(2), {0x37,0x26}},\r
320         {LCM_SEND(2), {0x38,0x72}},\r
321         {LCM_SEND(2), {0x39,0xff}},\r
322         {LCM_SEND(2), {0x3A,0x22}},\r
323         {LCM_SEND(2), {0x3B,0xee}},\r
324         {LCM_SEND(2), {0x3C,0x22}},\r
325         {LCM_SEND(2), {0x3D,0x22}},\r
326         {LCM_SEND(2), {0x3E,0x22}},\r
327         {LCM_SEND(2), {0x3F,0x22}},\r
328         {LCM_SEND(2), {0x52,0x10}}, /*reduce current when battery charging*/\r
329 \r
330         {LCM_SEND(2), {0x40,0x22}},\r
331 \r
332         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x07}}, // Change to Page 7\r
333         {LCM_SEND(2), {0x17,0x22}},\r
334 \r
335         {LCM_SEND(2), {0x02,0x77}},\r
336 \r
337 //****************************************************************************//\r
338         {LCM_SEND(8), {6, 0,0xFF,0xFF,0x98,0x06,0x04,0x00}}, // Change to Page 0\r
339 \r
340         {LCM_SEND(1), {0x11}},\r
341         {LCM_SLEEP(120)},\r
342 \r
343         {LCM_SEND(1), {0x29}},\r
344         {LCM_SLEEP(10)},\r
345  };\r
346 \r
347 #endif\r
348 \r
349 static LCM_Force_Cmd_Code rd_prep_code[]={\r
350         {0x39, {LCM_SEND(8), {0x6, 0, 0xFF, 0xFF, 0x98, 0x06,0x04,0x01}}},\r
351         {0x37, {LCM_SEND(2), {0x3, 0}}},\r
352 };\r
353 \r
354 static LCM_Init_Code disp_on =  {LCM_SEND(1), {0x29}};\r
355 \r
356 static LCM_Init_Code sleep_in =  {LCM_SEND(1), {0x10}};\r
357 \r
358 static LCM_Init_Code sleep_out =  {LCM_SEND(1), {0x11}};\r
359 \r
360 static int32_t ili9806e_mipi_init(struct panel_spec *self)\r
361 {\r
362         int32_t i;\r
363         LCM_Init_Code *init = init_data;\r
364         unsigned int tag;\r
365 \r
366         mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode;\r
367         mipi_gen_write_t mipi_gen_write = self->info.mipi->ops->mipi_gen_write;\r
368 \r
369          mipi_set_lp_mode_t mipi_set_lp_mode = self->info.mipi->ops->mipi_set_lp_mode;\r
370          mipi_set_hs_mode_t mipi_set_hs_mode = self->info.mipi->ops->mipi_set_hs_mode;\r
371         mipi_eotp_set_t mipi_eotp_set = self->info.mipi->ops->mipi_eotp_set;\r
372         LCD_PRINT("lcd_ili9806e_init\n");\r
373 \r
374         //mipi_set_cmd_mode();\r
375 \r
376         mdelay(5);\r
377         mipi_set_lp_mode();\r
378         //mipi_eotp_set(1,0);\r
379         for(i = 0; i < ARRAY_SIZE(init_data); i++){\r
380                 tag = (init->tag >>24);\r
381                 if(tag & LCM_TAG_SEND){\r
382                         mipi_gen_write(init->data, (init->tag & LCM_TAG_MASK));\r
383                         udelay(20);\r
384                 }else if(tag & LCM_TAG_SLEEP){\r
385                         mdelay((init->tag & LCM_TAG_MASK));\r
386                 }\r
387                 init++;\r
388         }\r
389 \r
390         mdelay(5);\r
391         mipi_set_hs_mode();\r
392         return 0;\r
393 }\r
394 \r
395 static uint32_t ili9806e_readid(struct panel_spec *self)\r
396 {\r
397         /*Jessica TODO: need read id*/\r
398         int32_t i = 0;\r
399         uint32 j =0;\r
400         LCM_Force_Cmd_Code * rd_prepare = rd_prep_code;\r
401         uint8_t read_data[3] = {0};\r
402         int32_t read_rtn = 0;\r
403         unsigned int tag = 0;\r
404         mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode;\r
405         mipi_force_write_t mipi_force_write = self->info.mipi->ops->mipi_force_write;\r
406         mipi_force_read_t mipi_force_read = self->info.mipi->ops->mipi_force_read;\r
407         mipi_set_lp_mode_t mipi_set_lp_mode = self->info.mipi->ops->mipi_set_lp_mode;\r
408         mipi_set_hs_mode_t mipi_set_hs_mode = self->info.mipi->ops->mipi_set_hs_mode;\r
409         mipi_eotp_set_t mipi_eotp_set = self->info.mipi->ops->mipi_eotp_set;\r
410 \r
411         //return 0x6; //cg liyun 20130329\r
412 \r
413         printk("lcd_ili9806e_mipi read id!\n");\r
414         mipi_set_lp_mode();\r
415 \r
416         //mipi_set_cmd_mode();\r
417         for(j = 0; j < 4; j++){\r
418                 rd_prepare = rd_prep_code;\r
419                 for(i = 0; i < ARRAY_SIZE(rd_prep_code); i++){\r
420                         tag = (rd_prepare->real_cmd_code.tag >> 24);\r
421                         if(tag & LCM_TAG_SEND){\r
422                                 mipi_force_write(rd_prepare->datatype, rd_prepare->real_cmd_code.data, (rd_prepare->real_cmd_code.tag & LCM_TAG_MASK));\r
423                         }else if(tag & LCM_TAG_SLEEP){\r
424                                 mdelay((rd_prepare->real_cmd_code.tag & LCM_TAG_MASK));\r
425                         }\r
426                         rd_prepare++;\r
427                 }\r
428                 mdelay(50);\r
429                 read_rtn = mipi_force_read(0x02, 1,(uint8_t *)read_data);\r
430                 printk("lcd_ili9806e_mipi read id 0x02 value is 0x%x!\n", read_data[0]);\r
431 \r
432                 if((0x04 == read_data[0])){\r
433                         printk("lcd_ili9806e_mipi read id success!\n");\r
434                         return 0x04;\r
435                 }\r
436         }\r
437 \r
438         mdelay(5);\r
439         mipi_set_hs_mode();\r
440         return 0;\r
441 }\r
442 \r
443 static struct panel_operations lcd_ili9806e_mipi_operations = {\r
444         .panel_init = ili9806e_mipi_init,\r
445         .panel_readid = ili9806e_readid,\r
446 };\r
447 \r
448 static struct timing_rgb lcd_ili9806e_mipi_timing = {\r
449         .hfp = 60,  /* unit: pixel */// 100\r
450         .hbp = 80,//80\r
451         .hsync = 60,//6\r
452         .vfp = 20, /*unit: line*/\r
453         .vbp = 14,\r
454         .vsync =6, //6,\r
455 };\r
456 \r
457 static struct info_mipi lcd_ili9806e_mipi_info = {\r
458         .work_mode  = SPRDFB_MIPI_MODE_VIDEO,\r
459         .video_bus_width = 24, /*18,16*/\r
460         .lan_number = 2,\r
461         .phy_feq = 400*1000,\r
462         .h_sync_pol = SPRDFB_POLARITY_POS,\r
463         .v_sync_pol = SPRDFB_POLARITY_POS,\r
464         .de_pol = SPRDFB_POLARITY_POS,\r
465         .te_pol = SPRDFB_POLARITY_POS,\r
466         .color_mode_pol = SPRDFB_POLARITY_NEG,\r
467         .shut_down_pol = SPRDFB_POLARITY_NEG,\r
468         .timing = &lcd_ili9806e_mipi_timing,\r
469         .ops = NULL,\r
470 };\r
471 \r
472 struct panel_spec lcd_ili9806e_mipi_spec = {\r
473         //.cap = PANEL_CAP_NOT_TEAR_SYNC,\r
474         .width = 480,\r
475         .height = 800,\r
476         .fps = 60,\r
477         .type = LCD_MODE_DSI,\r
478         .direction = LCD_DIRECT_NORMAL,\r
479         .info = {\r
480                 .mipi = &lcd_ili9806e_mipi_info\r
481         },\r
482         .ops = &lcd_ili9806e_mipi_operations,\r
483 };\r
484 \r
485 \r