ARM: cpu topology: Add debugfs interface for cpu_power
[cmplus.git] / arch / arm / mach-omap2 / board-tuna-display.c
blobd593a537a9eb885bff517d90ca35d5aa7eecd24f
1 /* Display panel support for Samsung Tuna Board.
3 * Copyright (C) 2011 Google, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <linux/err.h>
16 #include <linux/gpio.h>
17 #include <linux/kernel.h>
18 #include <linux/omapfb.h>
19 #include <linux/regulator/consumer.h>
21 #include <linux/platform_data/panel-s6e8aa0.h>
23 #include <plat/vram.h>
25 #include <video/omapdss.h>
26 #include <video/omap-panel-generic-dpi.h>
28 #include "board-tuna.h"
29 #include "control.h"
30 #include "mux.h"
32 #define TUNA_FB_RAM_SIZE SZ_16M /* ~1280*720*4 * 2 */
34 #define TUNA_GPIO_MLCD_RST 23
36 /* 4.65" Panel ID Info (D1h 1st Para) */
37 #define M3 0xA1
38 #define SM2 0x12
39 #define SM2A2 0xA2
41 static unsigned int panel_id;
42 struct regulator *tuna_oled_reg;
43 struct regulator *tuna_oled_reg_iovcc;
46 static void tuna_oled_set_power(bool enable)
48 if (IS_ERR_OR_NULL(tuna_oled_reg)) {
49 tuna_oled_reg = regulator_get(NULL, "vlcd");
50 if (IS_ERR_OR_NULL(tuna_oled_reg)) {
51 pr_err("Can't get vlcd for display!\n");
52 return;
56 if (omap4_tuna_get_revision() >= 5) {
57 if (IS_ERR_OR_NULL(tuna_oled_reg_iovcc)) {
58 tuna_oled_reg_iovcc = regulator_get(NULL, "vlcd-iovcc");
59 if (IS_ERR_OR_NULL(tuna_oled_reg_iovcc)) {
60 pr_err("Can't get vlcd for display!\n");
61 return;
65 if (enable) {
66 regulator_enable(tuna_oled_reg_iovcc);
67 regulator_enable(tuna_oled_reg);
68 } else {
69 regulator_disable(tuna_oled_reg);
70 regulator_disable(tuna_oled_reg_iovcc);
72 } else {
73 if (enable)
74 regulator_enable(tuna_oled_reg);
75 else
76 regulator_disable(tuna_oled_reg);
80 static const struct s6e8aa0_acl_parameters tuna_oled_acl[] = {
82 .cd = 40,
83 .acl_val = 43,
84 .regs = {
85 0xC1, /* ACL Control2 Register */
86 0x47,
87 0x53,
88 0x13,
89 0x53,
90 0x00,
91 0x00,
92 0x02,
93 0xCF,
94 0x00,
95 0x00,
96 0x04,
97 0xFF,
98 0x00,
99 0x00,
100 0x00,
101 0x00,
102 0x00,
103 0x01,
104 0x07,
105 0x0D,
106 0x14,
107 0x1A,
108 0x20,
109 0x26,
110 0x2C,
111 0x33,
112 0x39,
113 0x3F,
117 .cd = 300,
118 .acl_val = 45,
119 .regs = {
120 0xC1, /* ACL Control2 Register */
121 0x47,
122 0x53,
123 0x13,
124 0x53,
125 0x00,
126 0x00,
127 0x02,
128 0xCF,
129 0x00,
130 0x00,
131 0x04,
132 0xFF,
133 0x00,
134 0x00,
135 0x00,
136 0x00,
137 0x00,
138 0x01,
139 0x07,
140 0x0E,
141 0x14,
142 0x1B,
143 0x21,
144 0x27,
145 0x2E,
146 0x34,
147 0x3B,
148 0x41,
153 static const struct s6e8aa0_elvss_parameters tuna_oled_elvss[] = {
155 .cd = 100,
156 .elvss_val = 0x11,
159 .cd = 160,
160 .elvss_val = 0x0D,
163 .cd = 200,
164 .elvss_val = 0x08,
167 .cd = 300,
168 .elvss_val = 0x00,
172 static const u8 tuna_oled_cmd_init_pre0[] = {
173 0xF0,
174 0x5A,
175 0x5A,
178 static const u8 tuna_oled_cmd_init_pre1[] = {
179 0xF1,
180 0x5A,
181 0x5A,
184 static const u8 tuna_oled_cmd_sleep_out[] = {
185 0x11,
188 static const u8 tuna_oled_cmd_init_panel_m3[] = {
189 0xF8, /* Panel Condition Set */
190 0x3D, /* DOTC[0:1], GTCON[2:4], SS, DOTC_H[6:7] */
191 0x35, /* FLTE[0:7] */
192 0x00,
193 0x00,
194 0x00,
195 0x8D,
196 0x00,
197 0x4C, /* SCTE[0:7] */
198 0x6E,
199 0x10,
200 0x27,
201 0x7D, /* INTE[0:7] */
202 0x3F, /* INWE[0:7] */
203 0x10,
204 0x00,
205 0x00,
206 0x20,
207 0x04, /* E_FLWE_H[0:7] */
208 0x08, /* E_SCTE[0:7] */
209 0x6E, /* E_SCWE[0:7] */
210 0x00,
211 0x00,
212 0x00,
213 0x02,
214 0x08,
215 0x08,
216 0x23,
217 0x23,
218 0xC0,
219 0xC8, /* CLK2_CON[0:2], CLK1_CON[3:5], CLK2_DC, CLK1_DC */
220 0x08, /* INT2_CON[0:2], INT1_CON[3:5], INT2_DC, INT1_DC */
221 0x48, /* BICTLB_CON[0:2], BICTL_CON[3:5], BICTLB_DC, BICTL_DC */
222 0xC1,
223 0x00,
224 0xC3, /* EM_FLM_CON[0:2], ACL_FLM_CON[3:5], EM_FLM_DC, ACL_FLM_DC */
225 0xFF, /* EM_CLK1B_CON[0:2], EM_CLK1_CON[3:5], EM_CLK1B_DC, EM_CLK1_DC */
226 0xFF, /* EM_CLK2B_CON[0:2], EM_CLK2_CON[3:5], EM_CLK2B_DC, EM_CLK2_DC */
227 0xC8, /* EM_INT2_CON[0:2], EM_INT1_CON[3:5], EM_INT2_DC, EM_INT1_DC */
230 static const u8 tuna_oled_cmd_init_panel_sm2[] = {
231 0xF8, /* Panel Condition Set */
232 0x3D, /* DOTC[0:1], GTCON[2:4], SS, DOTC_H[6:7] */
233 0x31, /* FLTE[0:7] */
234 0x00,
235 0x00,
236 0x00,
237 0x8C, /* FLWE */
238 0x00,
239 0x39, /* SCTE[0:7] */
240 0x77, /* SCWE */
241 0x08, /* INTE */
242 0x25,
243 0x77, /* INTE[0:7] */
244 0x3C, /* INWE[0:7] */
245 0x00, /* EMPS */
246 0x00,
247 0x00,
248 0x20,
249 0x04, /* E_FLWE_H[0:7] */
250 0x08, /* E_SCTE[0:7] */
251 0x68, /* E_SCWE[0:7] */
252 0x00,
253 0x00,
254 0x00,
255 0x02,
256 0x07,
257 0x07,
258 0x21,
259 0x21,
260 0xC0,
261 0xC8, /* CLK2_CON[0:2], CLK1_CON[3:5], CLK2_DC, CLK1_DC */
262 0x08, /* INT2_CON[0:2], INT1_CON[3:5], INT2_DC, INT1_DC */
263 0x48, /* BICTLB_CON[0:2], BICTL_CON[3:5], BICTLB_DC, BICTL_DC */
264 0xC1,
265 0x00,
266 0xC1, /* EM_FLM_CON[0:2], ACL_FLM_CON[3:5], EM_FLM_DC, ACL_FLM_DC */
267 0xFF, /* EM_CLK1B_CON[0:2], EM_CLK1_CON[3:5], EM_CLK1B_DC, EM_CLK1_DC */
268 0xFF, /* EM_CLK2B_CON[0:2], EM_CLK2_CON[3:5], EM_CLK2B_DC, EM_CLK2_DC */
269 0xC8, /* EM_INT2_CON[0:2], EM_INT1_CON[3:5], EM_INT2_DC, EM_INT1_DC */
272 static const u8 tuna_oled_cmd_init_display[] = {
273 0xF2, /* Display Condition set */
274 0x80, /* Display area */
275 0x03, /* VBP : 3 HsYNC */
276 0x0D, /* VFP : 13HSYNC */
279 static const struct s6e8aa0_sequence_entry tuna_oled_seq_display_set_m3[] = {
281 .cmd = tuna_oled_cmd_init_pre0,
282 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_pre0),
285 .cmd = tuna_oled_cmd_sleep_out,
286 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_sleep_out),
287 .msleep = 5,
290 .cmd = tuna_oled_cmd_init_panel_m3,
291 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_panel_m3),
294 .cmd = tuna_oled_cmd_init_display,
295 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_display),
299 static const struct s6e8aa0_sequence_entry tuna_oled_seq_display_set_sm2[] = {
301 .cmd = tuna_oled_cmd_init_pre0,
302 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_pre0),
305 .cmd = tuna_oled_cmd_init_pre1,
306 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_pre1),
309 .cmd = tuna_oled_cmd_sleep_out,
310 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_sleep_out),
311 .msleep = 5,
314 .cmd = tuna_oled_cmd_init_panel_sm2,
315 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_panel_sm2),
318 .cmd = tuna_oled_cmd_init_display,
319 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_display),
323 static const u8 tuna_oled_cmd_gamma_ltps_update[] = {
324 0xF7,
325 0x03, /* Gamma/LTPS update */
328 static const u8 tuna_oled_cmd_init_post0[] = {
329 0xF6,
330 0x00,
331 0x02,
332 0x00,
335 static const u8 tuna_oled_cmd_init_post1[] = {
336 0xB6,
337 0x0C,
338 0x02,
339 0x03,
340 0x32,
341 0xFF,
342 0x44,
343 0x44,
344 0xC0,
345 0x00,
348 static const u8 tuna_oled_cmd_init_post2_m3[] = {
349 0xD9,
350 0x14,
351 0x40,
352 0x0C,
353 0xCB,
354 0xCE,
355 0x6E,
356 0xC4,
357 0x07, /* COLUMN_CHOP, FRAME_CHOP, LINE_CHOP, CHOP_EN */
358 0x40,
359 0x40, /* ELVSS_CON : 0 */
360 0xD0, /* ELVSS -4.9V */
361 0x00,
362 0x60,
363 0x19,
366 static const u8 tuna_oled_cmd_power_ctrl_m3[] = {
367 0xF4, /* Power Control */
368 0xCF,
369 0x0A,
370 0x0F, /* Vreg1 : 4.5V(default) */
371 0x10, /* VGH : 5.2v(default) */
372 0x19, /* VGL : -7.0v(default) */
373 0x33,
374 0x02,
377 static const u8 tuna_oled_cmd_init_post2_sm2[] = {
378 0xD9,
379 0x14,
380 0x40,
381 0x0C,
382 0xCB,
383 0xCE,
384 0x6E,
385 0xC4,
386 0x07, /* COLUMN_CHOP, FRAME_CHOP, LINE_CHOP, CHOP_EN */
387 0x40,
388 0x41, /* ELVSS_CON : 1 */
389 0xD0, /* ELVSS -4.9V */
390 0x00,
391 0x60,
392 0x19,
395 static const u8 tuna_oled_cmd_power_ctrl_sm2[] = {
396 0xF4, /* Power Control */
397 0xCF,
398 0x0A,
399 0x12, /* Vreg1 : 4.6V */
400 0x10, /* VGH : 5.2v(default) */
401 0x1E, /* VGL : -8.0v */
402 0x33,
403 0x02,
406 static const u8 tuna_oled_cmd_display_on[] = {
407 0x29,
410 static const struct s6e8aa0_sequence_entry tuna_oled_seq_etc_set_m3[] = {
412 .cmd = tuna_oled_cmd_gamma_ltps_update,
413 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_gamma_ltps_update),
416 .cmd = tuna_oled_cmd_init_post0,
417 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post0),
420 .cmd = tuna_oled_cmd_init_post1,
421 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post1),
424 .cmd = tuna_oled_cmd_init_post2_m3,
425 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post2_m3),
428 .cmd = tuna_oled_cmd_power_ctrl_m3,
429 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_power_ctrl_m3),
430 .msleep = 120,
433 .cmd = tuna_oled_cmd_display_on,
434 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_display_on),
438 static const struct s6e8aa0_sequence_entry tuna_oled_seq_etc_set_sm2[] = {
440 .cmd = tuna_oled_cmd_gamma_ltps_update,
441 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_gamma_ltps_update),
444 .cmd = tuna_oled_cmd_init_post0,
445 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post0),
448 .cmd = tuna_oled_cmd_init_post1,
449 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post1),
452 .cmd = tuna_oled_cmd_init_post2_sm2,
453 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_init_post2_sm2),
456 .cmd = tuna_oled_cmd_power_ctrl_sm2,
457 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_power_ctrl_sm2),
458 .msleep = 120,
461 .cmd = tuna_oled_cmd_display_on,
462 .cmd_len = ARRAY_SIZE(tuna_oled_cmd_display_on),
466 static const struct s6e8aa0_gamma_entry tuna_oled_gamma_table_m3[] = {
467 { BV_0, { 4500000, 4500000, 4500000, }, },
468 { 0x00000001, { 4350000, 4350000, 4350000, }, },
469 { 0x0001F8F0, { 4320166, 4338185, 4200000, }, },
470 { 0x0002F71F, { 4305148, 4332238, 4102500, }, },
471 { 0x00038485, { 4296793, 4328930, 4065000, }, },
472 { 0x00053C55, { 4270807, 4318639, 3982500, }, },
473 { 0x00060EEF, { 4258364, 4313711, 3960000, }, },
474 { 0x00075444, { 4239141, 4306099, 3930000, }, },
475 { 0x00095733, { 4208717, 4294050, 3892500, }, },
476 { 0x000EC060, { 4126874, 4261640, 3810000, }, },
477 { 0x00129EAB, { 4068363, 4238469, 3757500, }, },
478 { 0x00179214, { 3993478, 4208813, 3720000, }, },
479 { 0x001A47A0, { 3952500, 4192586, 3712500, }, },
480 { 0x0025E12C, { 3802500, 4123103, 3682500, }, },
481 { 0x002D413D, { 3756465, 4078926, 3673450, }, },
482 { 0x0035D13F, { 3741586, 4027637, 3659844, }, },
483 { 0x00400000, { 3726401, 3966643, 3645758, }, },
484 { 0x004C1BF8, { 3710894, 3894110, 3631166, }, },
485 { 0x005A827A, { 3695052, 3855649, 3616042, }, },
486 { 0x006BA27E, { 3678859, 3823316, 3600360, }, },
487 { 0x00800000, { 3662298, 3794488, 3584091, }, },
488 { 0x009837F0, { 3645351, 3767841, 3567202, }, },
489 { 0x00B504F3, { 3627999, 3742607, 3549662, }, },
490 { 0x00D744FD, { 3610220, 3718295, 3531434, }, },
491 { 0x01000000, { 3591992, 3694568, 3512481, }, },
492 { 0x01306FE1, { 3573291, 3671183, 3492761, }, },
493 { 0x016A09E6, { 3554089, 3647957, 3472232, }, },
494 { 0x01AE89FA, { 3534358, 3624743, 3450847, }, },
495 { 0x02000000, { 3514065, 3601422, 3428554, }, },
496 { 0x0260DFC1, { 3493177, 3577893, 3405301, }, },
497 { 0x02D413CD, { 3471654, 3554067, 3381029, }, },
498 { 0x035D13F3, { 3449455, 3529864, 3355676, }, },
499 { 0x04000000, { 3426534, 3505211, 3329174, }, },
500 { 0x04C1BF83, { 3402839, 3480034, 3301451, }, },
501 { 0x05A8279A, { 3378312, 3454264, 3272429, }, },
502 { 0x06BA27E6, { 3352890, 3427831, 3242021, }, },
503 { 0x08000000, { 3326501, 3400661, 3210138, }, },
504 { 0x09837F05, { 3299062, 3372679, 3176678, }, },
505 { 0x0B504F33, { 3270483, 3343804, 3141535, }, },
506 { 0x0D744FCD, { 3240658, 3313948, 3104592, }, },
507 { 0x10000000, { 3209466, 3283015, 3065722, }, },
508 { 0x1306FE0A, { 3176767, 3250899, 3024787, }, },
509 { 0x16A09E66, { 3142400, 3217481, 2981638, }, },
510 { 0x1AE89F99, { 3106171, 3182624, 2936111, }, },
511 { 0x20000000, { 3067855, 3146174, 2888031, }, },
512 { 0x260DFC14, { 3027178, 3107951, 2837203, }, },
513 { 0x2D413CCD, { 2983809, 3067744, 2783420, }, },
514 { 0x35D13F32, { 2937340, 3025303, 2726454, }, },
515 { 0x40000000, { 2887259, 2980328, 2666057, }, },
516 { 0x4C1BF828, { 2832912, 2932454, 2601961, }, },
517 { 0x5A82799A, { 2773444, 2881230, 2533878, }, },
518 { 0x6BA27E65, { 2707706, 2826086, 2461495, }, },
519 { 0x80000000, { 2639098, 2766291, 2384478, }, },
520 { 0x9837F051, { 2560291, 2700878, 2302469, }, },
521 { 0xB504F333, { 2472698, 2628531, 2215093, }, },
522 { 0xD744FCCA, { 2375331, 2547389, 2121959, }, },
523 { 0xFFFFFFFF, { 2266945, 2454682, 2022667, }, },
526 static const struct s6e8aa0_gamma_entry tuna_oled_gamma_table_sm2[] = {
527 { BV_0, { 4600000, 4600000, 4600000, }, },
528 { 0x00000001, { 4561667, 4561667, 4561667, }, },
529 { 0x000004C2, { 4102930, 4561654, 4561115, }, },
530 { 0x000005A8, { 4093308, 4561651, 3799195, }, },
531 { 0x000006BA, { 4083466, 4561645, 3793888, }, },
532 { 0x00000800, { 4073413, 4561639, 3788484, }, },
533 { 0x00000983, { 4063166, 4561630, 3782992, }, },
534 { 0x00000B50, { 4052685, 4561618, 3777391, }, },
535 { 0x00000D74, { 4041989, 4561602, 3771689, }, },
536 { 0x00001000, { 4031064, 4561582, 3765880, }, },
537 { 0x00001307, { 4019915, 4561555, 3759964, }, },
538 { 0x000016A1, { 4008527, 4561519, 3753935, }, },
539 { 0x00001AE9, { 3996905, 4561472, 3747792, }, },
540 { 0x00002000, { 3985042, 4561410, 3741533, }, },
541 { 0x0000260E, { 3972926, 4561328, 3735148, }, },
542 { 0x00002D41, { 3960557, 4561219, 3728639, }, },
543 { 0x000035D1, { 3947926, 4561076, 3721998, }, },
544 { 0x00004000, { 3935029, 4560888, 3715222, }, },
545 { 0x00004C1C, { 3921862, 4560639, 3708307, }, },
546 { 0x00005A82, { 3908420, 4560310, 3701250, }, },
547 { 0x00006BA2, { 3894694, 4559877, 3694045, }, },
548 { 0x00008000, { 3880678, 4559305, 3686685, }, },
549 { 0x00009838, { 3866369, 4558550, 3679168, }, },
550 { 0x0000B505, { 3851759, 4557554, 3671487, }, },
551 { 0x0000D745, { 3836842, 4556240, 3663637, }, },
552 { 0x00010000, { 3821612, 4554507, 3655612, }, },
553 { 0x00013070, { 3806062, 4552219, 3647405, }, },
554 { 0x00016A0A, { 3790185, 4549200, 3639010, }, },
555 { 0x0001AE8A, { 3773975, 4545217, 3630420, }, },
556 { 0x00020000, { 3757424, 4539961, 3621628, }, },
557 { 0x000260E0, { 3740525, 4533026, 3612625, }, },
558 { 0x0002D414, { 3723271, 4523876, 3603405, }, },
559 { 0x00035D14, { 3705654, 4511801, 3593959, }, },
560 { 0x00040000, { 3687668, 4495869, 3584277, }, },
561 { 0x0004C1C0, { 3669303, 4474845, 3574351, }, },
562 { 0x0005A828, { 3650553, 4447106, 3564170, }, },
563 { 0x0006BA28, { 3631408, 4410503, 3553725, }, },
564 { 0x00080000, { 3611862, 4362204, 3543003, }, },
565 { 0x0009837F, { 3591904, 4298475, 3531993, }, },
566 { 0x000B504F, { 3571527, 4214383, 3520683, }, },
567 { 0x000D7450, { 3557593, 4103423, 3509060, }, },
568 { 0x00100000, { 3544015, 4010592, 3497110, }, },
569 { 0x001306FE, { 3530633, 3962306, 3484817, }, },
570 { 0x0016A09E, { 3517328, 3926468, 3472166, }, },
571 { 0x001AE8A0, { 3504007, 3896492, 3459141, }, },
572 { 0x00200000, { 3490597, 3869832, 3445722, }, },
573 { 0x00260DFC, { 3477036, 3845220, 3431893, }, },
574 { 0x002D413D, { 3463269, 3821929, 3417630, }, },
575 { 0x0035D13F, { 3449251, 3799494, 3402914, }, },
576 { 0x00400000, { 3434937, 3777603, 3387721, }, },
577 { 0x004C1BF8, { 3420287, 3756027, 3372025, }, },
578 { 0x005A827A, { 3405262, 3734596, 3355799, }, },
579 { 0x006BA27E, { 3389824, 3713176, 3339016, }, },
580 { 0x00800000, { 3373936, 3691658, 3321643, }, },
581 { 0x009837F0, { 3357560, 3669948, 3303646, }, },
582 { 0x00B504F3, { 3340656, 3647968, 3284991, }, },
583 { 0x00D744FD, { 3323186, 3625646, 3265636, }, },
584 { 0x01000000, { 3305106, 3602915, 3245540, }, },
585 { 0x01306FE1, { 3286372, 3579714, 3224657, }, },
586 { 0x016A09E6, { 3266937, 3555983, 3202935, }, },
587 { 0x01AE89FA, { 3246751, 3531662, 3180321, }, },
588 { 0x02000000, { 3225759, 3506692, 3156754, }, },
589 { 0x0260DFC1, { 3203902, 3481011, 3132167, }, },
590 { 0x02D413CD, { 3181115, 3454554, 3106490, }, },
591 { 0x035D13F3, { 3157329, 3427255, 3079643, }, },
592 { 0x04000000, { 3132467, 3399041, 3051538, }, },
593 { 0x04C1BF83, { 3106444, 3369833, 3022078, }, },
594 { 0x05A8279A, { 3079166, 3339546, 2991155, }, },
595 { 0x06BA27E6, { 3050528, 3308086, 2958650, }, },
596 { 0x08000000, { 3020414, 3275348, 2924429, }, },
597 { 0x09837F05, { 2988694, 3241215, 2888342, }, },
598 { 0x0B504F33, { 2955220, 3205555, 2850219, }, },
599 { 0x0D744FCD, { 2919827, 3168219, 2809871, }, },
600 { 0x10000000, { 2882325, 3129034, 2767081, }, },
601 { 0x1306FE0A, { 2842499, 3087803, 2721603, }, },
602 { 0x16A09E66, { 2800102, 3044294, 2673154, }, },
603 { 0x1AE89F99, { 2754846, 2998238, 2621408, }, },
604 { 0x20000000, { 2706399, 2949314, 2565989, }, },
605 { 0x260DFC14, { 2654372, 2897137, 2506458, }, },
606 { 0x2D413CCD, { 2598304, 2841239, 2442298, }, },
607 { 0x35D13F32, { 2537647, 2781048, 2372900, }, },
608 { 0x40000000, { 2471743, 2715846, 2297536, }, },
609 { 0x4C1BF828, { 2399793, 2644720, 2215328, }, },
610 { 0x5A82799A, { 2320814, 2566484, 2125212, }, },
611 { 0x6BA27E65, { 2233581, 2479554, 2025874, }, },
612 { 0x80000000, { 2136547, 2381755, 1915679, }, },
613 { 0x9837F051, { 2027719, 2269975, 1792556, }, },
614 { 0xB504F333, { 1904479, 2139541, 1653843, }, },
615 { 0xD744FCCA, { 1763299, 1982960, 1496041, }, },
616 { 0xFFFFFFFF, { 1599291, 1787064, 1314455, }, },
619 static const struct s6e8aa0_gamma_entry tuna_oled_gamma_table_sm2a2[] = {
620 { BV_0, { 4600000, 4600000, 4600000, }, },
621 { 0x00000001, { 4561667, 4561667, 4561667, }, },
622 { 0x000004C2, { 4320569, 4507119, 4172023, }, },
623 { 0x000005A8, { 4313803, 4504412, 4164881, }, },
624 { 0x000006BA, { 4306834, 4501566, 4157595, }, },
625 { 0x00000800, { 4299666, 4498576, 4150172, }, },
626 { 0x00000983, { 4292309, 4495443, 4142625, }, },
627 { 0x00000B50, { 4284732, 4492149, 4134926, }, },
628 { 0x00000D74, { 4276946, 4488692, 4127090, }, },
629 { 0x00001000, { 4268937, 4485062, 4119106, }, },
630 { 0x00001307, { 4260707, 4481254, 4110980, }, },
631 { 0x000016A1, { 4252243, 4477254, 4102702, }, },
632 { 0x00001AE9, { 4243544, 4473058, 4094275, }, },
633 { 0x00002000, { 4234603, 4468654, 4085695, }, },
634 { 0x0000260E, { 4225408, 4464030, 4076956, }, },
635 { 0x00002D41, { 4215956, 4459176, 4068057, }, },
636 { 0x000035D1, { 4206236, 4454081, 4058993, }, },
637 { 0x00004000, { 4196243, 4448731, 4049762, }, },
638 { 0x00004C1C, { 4185969, 4443116, 4040363, }, },
639 { 0x00005A82, { 4175408, 4437223, 4030792, }, },
640 { 0x00006BA2, { 4164549, 4431036, 4021044, }, },
641 { 0x00008000, { 4153383, 4424541, 4011116, }, },
642 { 0x00009838, { 4141905, 4417724, 4001007, }, },
643 { 0x0000B505, { 4130104, 4410567, 3990713, }, },
644 { 0x0000D745, { 4117971, 4403055, 3980229, }, },
645 { 0x00010000, { 4105497, 4395170, 3969553, }, },
646 { 0x00013070, { 4092672, 4386892, 3958681, }, },
647 { 0x00016A0A, { 4079487, 4378203, 3947609, }, },
648 { 0x0001AE8A, { 4065931, 4369081, 3936334, }, },
649 { 0x00020000, { 4051994, 4359507, 3924852, }, },
650 { 0x000260E0, { 4037665, 4349456, 3913159, }, },
651 { 0x0002D414, { 4022934, 4338906, 3901251, }, },
652 { 0x00035D14, { 4007788, 4327831, 3889125, }, },
653 { 0x00040000, { 3992216, 4316205, 3876776, }, },
654 { 0x0004C1C0, { 3976207, 4304001, 3864200, }, },
655 { 0x0005A828, { 3959747, 4291191, 3851393, }, },
656 { 0x0006BA28, { 3942825, 4277744, 3838351, }, },
657 { 0x00080000, { 3925427, 4263628, 3825070, }, },
658 { 0x0009837F, { 3907540, 4248811, 3811545, }, },
659 { 0x000B504F, { 3889150, 4233257, 3797772, }, },
660 { 0x000D7450, { 3873393, 4216929, 3783745, }, },
661 { 0x00100000, { 3857665, 4199790, 3769461, }, },
662 { 0x001306FE, { 3841894, 4181799, 3754915, }, },
663 { 0x0016A09E, { 3826021, 4162913, 3740102, }, },
664 { 0x001AE8A0, { 3809994, 4143088, 3725017, }, },
665 { 0x00200000, { 3793770, 4122278, 3709654, }, },
666 { 0x00260DFC, { 3777308, 4100433, 3694010, }, },
667 { 0x002D413D, { 3760573, 4077502, 3677663, }, },
668 { 0x0035D13F, { 3743530, 4053431, 3660904, }, },
669 { 0x00400000, { 3726147, 4028163, 3643715, }, },
670 { 0x004C1BF8, { 3708392, 4001639, 3626075, }, },
671 { 0x005A827A, { 3690235, 3973797, 3607960, }, },
672 { 0x006BA27E, { 3671644, 3953685, 3589346, }, },
673 { 0x00800000, { 3652589, 3933053, 3570207, }, },
674 { 0x009837F0, { 3633036, 3911876, 3550514, }, },
675 { 0x00B504F3, { 3612951, 3890122, 3530237, }, },
676 { 0x00D744FD, { 3592301, 3867762, 3509342, }, },
677 { 0x01000000, { 3571046, 3844761, 3487793, }, },
678 { 0x01306FE1, { 3549148, 3821082, 3465552, }, },
679 { 0x016A09E6, { 3526565, 3796686, 3442574, }, },
680 { 0x01AE89FA, { 3503250, 3771528, 3418813, }, },
681 { 0x02000000, { 3479155, 3745560, 3394218, }, },
682 { 0x0260DFC1, { 3454224, 3718731, 3368732, }, },
683 { 0x02D413CD, { 3428401, 3690982, 3342292, }, },
684 { 0x035D13F3, { 3401619, 3662250, 3314830, }, },
685 { 0x04000000, { 3373808, 3632465, 3286268, }, },
686 { 0x04C1BF83, { 3344890, 3601547, 3256522, }, },
687 { 0x05A8279A, { 3314777, 3569411, 3225495, }, },
688 { 0x06BA27E6, { 3283370, 3535958, 3193081, }, },
689 { 0x08000000, { 3250562, 3501080, 3159159, }, },
690 { 0x09837F05, { 3216227, 3464651, 3123590, }, },
691 { 0x0B504F33, { 3180227, 3426533, 3086220, }, },
692 { 0x0D744FCD, { 3142401, 3386564, 3046868, }, },
693 { 0x10000000, { 3102567, 3344561, 3005329, }, },
694 { 0x1306FE0A, { 3060513, 3300311, 2961362, }, },
695 { 0x16A09E66, { 3015995, 3253568, 2914685, }, },
696 { 0x1AE89F99, { 2968726, 3204040, 2864970, }, },
697 { 0x20000000, { 2918367, 3151384, 2811819, }, },
698 { 0x260DFC14, { 2864513, 3095191, 2754761, }, },
699 { 0x2D413CCD, { 2806678, 3034964, 2693215, }, },
700 { 0x35D13F32, { 2744269, 2970096, 2626472, }, },
701 { 0x40000000, { 2676551, 2899833, 2553637, }, },
702 { 0x4C1BF828, { 2602603, 2823224, 2473575, }, },
703 { 0x5A82799A, { 2521246, 2739043, 2384804, }, },
704 { 0x6BA27E65, { 2430943, 2645676, 2285353, }, },
705 { 0x80000000, { 2329631, 2540937, 2172509, }, },
706 { 0x9837F051, { 2214459, 2421765, 2042412, }, },
707 { 0xB504F333, { 2081337, 2283682, 1889300, }, },
708 { 0xD744FCCA, { 1924091, 2119771, 1704041, }, },
709 { 0xFFFFFFFF, { 1732795, 1918520, 1470915, }, },
712 static struct s6e8aa0_factory_calibration_info tuna_oled_factory_info_old = {
713 .regs = {
714 [1][0][6] = 0x090,
715 [1][1][6] = 0x081,
716 [1][2][6] = 0x0c5,
718 .brightness = {
719 [1][6] = BV_255, /* 300 cd/m2 */
721 .color_adj = {
722 /* Convert from 8500K to D65, assuming:
723 * Rx 0.66950, Ry 0.33100
724 * Gx 0.18800, Gy 0.74350
725 * Bx 0.14142, By 0.04258
727 .mult = {
728 2318372099U,
729 2117262806U,
730 1729744557U,
732 .rshift = 31,
736 static struct s6e8aa0_factory_calibration_info tuna_oled_factory_info_m2t1 = {
737 .regs = {
738 [1][0][6] = 0x090,
739 [1][1][6] = 0x081,
740 [1][2][6] = 0x0c5,
742 .brightness = {
743 [1][6] = BV_255, /* 300 cd/m2 */
747 static struct s6e8aa0_factory_calibration_info tuna_oled_factory_info_8500k = {
748 .regs = {
749 [1][0][0] = 0x0f,
750 [1][1][0] = 0x0f,
751 [1][2][0] = 0x0f,
753 [1][0][1] = 0xcc,
754 [1][1][1] = 0x9c,
755 [1][2][1] = 0xd7,
757 [1][0][2] = 0xc1,
758 [1][1][2] = 0xba,
759 [1][2][2] = 0xc1,
761 [1][0][3] = 0xcf,
762 [1][1][3] = 0xcd,
763 [1][2][3] = 0xcf,
765 [1][0][4] = 0xaa,
766 [1][1][4] = 0xaa,
767 [1][2][4] = 0xa7,
769 [1][0][5] = 0xbe,
770 [1][1][5] = 0xbe,
771 [1][2][5] = 0xba,
773 [1][0][6] = 0x090,
774 [1][1][6] = 0x081,
775 [1][2][6] = 0x0c5,
777 .brightness = {
778 [1][4] = 403193777, /* 28.16275996 cd/m2 */
779 [1][6] = BV_255, /* 300 cd/m2 */
781 .color_adj = {
782 /* Convert from 8500K to D65, assuming:
783 * Rx 0.66950, Ry 0.33100
784 * Gx 0.18800, Gy 0.74350
785 * Bx 0.14142, By 0.04258
787 * These values are adjusted down by x 0.9333 to bring
788 * maximum brightness down from 300 cd/m2 to 280.
790 .mult = {
791 2163736680U,
792 1976041377U,
793 1614370595U,
795 .rshift = 31,
799 static struct s6e8aa0_factory_calibration_info tuna_oled_factory_info_6500k = {
800 .regs = {
801 [1][0][0] = 0x7c, /* sRGB Gamma 300cd, 6500K */
802 [1][1][0] = 0x3c,
803 [1][2][0] = 0x87,
805 [1][0][1] = 0xbb,
806 [1][1][1] = 0xd4,
807 [1][2][1] = 0xa8,
809 [1][0][2] = 0xac,
810 [1][1][2] = 0xc0,
811 [1][2][2] = 0xa1,
813 [1][0][3] = 0xb8,
814 [1][1][3] = 0xc8,
815 [1][2][3] = 0xb2,
817 [1][0][4] = 0x8c,
818 [1][1][4] = 0x9f,
819 [1][2][4] = 0x84,
821 [1][0][5] = 0xa7,
822 [1][1][5] = 0xb2,
823 [1][2][5] = 0xa3,
825 [1][0][6] = 0x0d8,
826 [1][1][6] = 0x0bd,
827 [1][2][6] = 0x0f7,
829 .brightness = {
830 [1][1] = BV_15, /* 1.43 cd/m2 */
831 [1][2] = BV_35, /* 5.04 cd/m2 */
832 [1][3] = BV_59, /* 13.12 cd/m2 */
833 [1][4] = BV_87, /* 28.59 cd/m2 */
834 [1][5] = BV_171, /* 122.17 cd/m2 */
835 [1][6] = BV_255, /* 300 cd/m2 */
837 .color_adj = {
839 * These values are adjusted down by x 0.9333 to bring
840 * maximum brightness down from 300 cd/m2 to 280.
842 .mult = {
843 2004318071U,
844 2004318071U,
845 2004318071U,
847 .rshift = 31,
851 static struct s6e8aa0_factory_calibration_info tuna_oled_factory_info_sm2a2 = {
852 .regs = {
853 [1][0][0] = 0x52, /* sRGB Gamma 300cd, 6500K, A2 Line */
854 [1][1][0] = 0x24,
855 [1][2][0] = 0x5d,
857 [1][0][1] = 0xba,
858 [1][1][1] = 0xcd,
859 [1][2][1] = 0xb3,
861 [1][0][2] = 0xad,
862 [1][1][2] = 0xc0,
863 [1][2][2] = 0xb1,
865 [1][0][3] = 0xbf,
866 [1][1][3] = 0xc7,
867 [1][2][3] = 0xbc,
869 [1][0][4] = 0x90,
870 [1][1][4] = 0x97,
871 [1][2][4] = 0x8a,
873 [1][0][5] = 0xaa,
874 [1][1][5] = 0xae,
875 [1][2][5] = 0xa5,
877 [1][0][6] = 0x0c2,
878 [1][1][6] = 0x0a8,
879 [1][2][6] = 0x0d7,
881 .brightness = {
882 [1][1] = BV_15, /* 1.43 cd/m2 */
883 [1][2] = BV_35, /* 5.04 cd/m2 */
884 [1][3] = BV_59, /* 13.12 cd/m2 */
885 [1][4] = BV_87, /* 28.59 cd/m2 */
886 [1][5] = BV_171, /* 122.17 cd/m2 */
887 [1][6] = BV_255, /* 300 cd/m2 */
889 .color_adj = {
891 * These values are adjusted down by x 0.9333 to bring
892 * maximum brightness down from 300 cd/m2 to 280.
894 .mult = {
895 2004318071U,
896 2004318071U,
897 2004318071U,
899 .rshift = 31,
903 static struct panel_s6e8aa0_data tuna_oled_data_m3 = {
904 .reset_gpio = TUNA_GPIO_MLCD_RST,
905 .set_power = tuna_oled_set_power,
906 .seq_display_set = tuna_oled_seq_display_set_m3,
907 .seq_display_set_size = ARRAY_SIZE(tuna_oled_seq_display_set_m3),
908 .seq_etc_set = tuna_oled_seq_etc_set_m3,
909 .seq_etc_set_size = ARRAY_SIZE(tuna_oled_seq_etc_set_m3),
910 .gamma_table = tuna_oled_gamma_table_m3,
911 .gamma_table_size = ARRAY_SIZE(tuna_oled_gamma_table_m3),
912 .factory_info = &tuna_oled_factory_info_8500k,
913 .acl_table = tuna_oled_acl,
914 .acl_table_size = ARRAY_SIZE(tuna_oled_acl),
915 .acl_average = 6, /* use 20 frame Y average accumulation count */
918 static struct panel_s6e8aa0_data tuna_oled_data_sm2 = {
919 .reset_gpio = TUNA_GPIO_MLCD_RST,
920 .set_power = tuna_oled_set_power,
921 .seq_display_set = tuna_oled_seq_display_set_sm2,
922 .seq_display_set_size = ARRAY_SIZE(tuna_oled_seq_display_set_sm2),
923 .seq_etc_set = tuna_oled_seq_etc_set_sm2,
924 .seq_etc_set_size = ARRAY_SIZE(tuna_oled_seq_etc_set_sm2),
925 .gamma_table = tuna_oled_gamma_table_sm2,
926 .gamma_table_size = ARRAY_SIZE(tuna_oled_gamma_table_sm2),
927 .factory_info = &tuna_oled_factory_info_6500k,
928 .acl_table = tuna_oled_acl,
929 .acl_table_size = ARRAY_SIZE(tuna_oled_acl),
930 .acl_average = 6, /* use 20 frame Y average accumulation count */
931 .elvss_table = tuna_oled_elvss,
932 .elvss_table_size = ARRAY_SIZE(tuna_oled_elvss),
935 static struct panel_s6e8aa0_data tuna_oled_data_sm2a2 = {
936 .reset_gpio = TUNA_GPIO_MLCD_RST,
937 .set_power = tuna_oled_set_power,
938 .seq_display_set = tuna_oled_seq_display_set_sm2,
939 .seq_display_set_size = ARRAY_SIZE(tuna_oled_seq_display_set_sm2),
940 .seq_etc_set = tuna_oled_seq_etc_set_sm2,
941 .seq_etc_set_size = ARRAY_SIZE(tuna_oled_seq_etc_set_sm2),
942 .gamma_table = tuna_oled_gamma_table_sm2a2,
943 .gamma_table_size = ARRAY_SIZE(tuna_oled_gamma_table_sm2a2),
944 .factory_info = &tuna_oled_factory_info_sm2a2,
945 .acl_table = tuna_oled_acl,
946 .acl_table_size = ARRAY_SIZE(tuna_oled_acl),
947 .acl_average = 6, /* use 20 frame Y average accumulation count */
948 .elvss_table = tuna_oled_elvss,
949 .elvss_table_size = ARRAY_SIZE(tuna_oled_elvss),
952 static struct omap_dss_device tuna_oled_device = {
953 .name = "lcd",
954 .driver_name = "s6e8aa0",
955 .type = OMAP_DISPLAY_TYPE_DSI,
956 .phy.dsi = {
957 .type = OMAP_DSS_DSI_TYPE_VIDEO_MODE,
958 .clk_lane = 1,
959 .clk_pol = 0,
960 .data1_lane = 2,
961 .data1_pol = 0,
962 .data2_lane = 3,
963 .data2_pol = 0,
964 .data3_lane = 4,
965 .data3_pol = 0,
966 .data4_lane = 5,
967 .data4_pol = 0,
969 .panel = {
970 .width_in_um = 58000,
971 .height_in_um = 102000,
973 .clocks = {
974 .dispc = {
975 .channel = {
976 .lck_div = 1, /* LCD */
977 .pck_div = 2, /* PCD */
978 .lcd_clk_src
979 = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,
981 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
983 .dsi = {
984 .regn = 19, /* DSI_PLL_REGN */
985 .regm = 236, /* DSI_PLL_REGM */
987 .regm_dispc = 6, /* PLL_CLK1 (M4) */
988 .regm_dsi = 6, /* PLL_CLK2 (M5) */
989 .lp_clk_div = 8, /* LPDIV */
990 .offset_ddr_clk = 122, /* DDR PRE & DDR POST
991 * offset increase
994 .dsi_fclk_src = OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI,
998 .channel = OMAP_DSS_CHANNEL_LCD,
999 #ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT
1000 .skip_init = true,
1001 #else
1002 .skip_init = false,
1003 #endif
1006 static void tuna_hdmi_mux_init(void)
1008 u32 r;
1010 /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
1011 omap_mux_init_signal("hdmi_hpd.hdmi_hpd",
1012 OMAP_PIN_INPUT_PULLDOWN);
1013 omap_mux_init_signal("gpmc_wait2.gpio_100",
1014 OMAP_PIN_INPUT_PULLDOWN);
1015 omap_mux_init_signal("hdmi_cec.hdmi_cec",
1016 OMAP_PIN_INPUT_PULLUP);
1017 /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */
1018 omap_mux_init_signal("hdmi_ddc_scl.hdmi_ddc_scl",
1019 OMAP_PIN_INPUT_PULLUP);
1020 omap_mux_init_signal("hdmi_ddc_sda.hdmi_ddc_sda",
1021 OMAP_PIN_INPUT_PULLUP);
1023 /* strong pullup on DDC lines using unpublished register */
1024 r = ((1 << 24) | (1 << 28)) ;
1025 omap4_ctrl_pad_writel(r, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1);
1029 static struct omap_dss_device tuna_hdmi_device = {
1030 .name = "hdmi",
1031 .driver_name = "hdmi_panel",
1032 .type = OMAP_DISPLAY_TYPE_HDMI,
1033 .clocks = {
1034 .dispc = {
1035 .dispc_fclk_src = OMAP_DSS_CLK_SRC_FCK,
1037 .hdmi = {
1038 .regn = 15,
1039 .regm2 = 1,
1040 .max_pixclk_khz = 75000,
1043 .hpd_gpio = TUNA_GPIO_HDMI_HPD,
1044 .channel = OMAP_DSS_CHANNEL_DIGIT,
1047 static struct omap_dss_device *tuna_dss_devices[] = {
1048 &tuna_oled_device,
1049 &tuna_hdmi_device,
1052 static struct omap_dss_board_info tuna_dss_data = {
1053 .num_devices = ARRAY_SIZE(tuna_dss_devices),
1054 .devices = tuna_dss_devices,
1055 .default_device = &tuna_oled_device,
1058 static struct omapfb_platform_data tuna_fb_pdata = {
1059 .mem_desc = {
1060 .region_cnt = 1,
1061 .region = {
1062 [0] = {
1063 .size = TUNA_FB_RAM_SIZE,
1069 void __init omap4_tuna_display_init(void)
1071 struct panel_s6e8aa0_data *panel;
1073 if (omap4_tuna_get_revision() ==
1074 (omap4_tuna_get_type() == TUNA_TYPE_MAGURO ? 2 : 1)) {
1076 * Older devices were not calibrated the same way as newer
1077 * devices. These values are probably not correct, but the older
1078 * devices tested look closer to the newer devices with these
1079 * values than they do using the same register values as the
1080 * newer devices.
1082 tuna_oled_data_m3.factory_info = &tuna_oled_factory_info_m2t1;
1083 } else if (omap4_tuna_get_revision() <= 1) {
1084 tuna_oled_data_m3.factory_info = &tuna_oled_factory_info_old;
1087 switch (panel_id) {
1088 case SM2:
1089 panel = &tuna_oled_data_sm2;
1090 break;
1091 case SM2A2:
1092 panel = &tuna_oled_data_sm2a2;
1093 break;
1094 default:
1095 panel = &tuna_oled_data_m3;
1096 break;
1099 tuna_oled_device.data = panel;
1101 omap4_ctrl_pad_writel(0x1FF80000,
1102 OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
1103 omap_mux_init_gpio(panel->reset_gpio, OMAP_PIN_OUTPUT);
1105 pr_info("Using %ps\n", panel->factory_info);
1107 omap_vram_set_sdram_vram(TUNA_FB_RAM_SIZE, 0);
1108 omapfb_set_platform_data(&tuna_fb_pdata);
1109 tuna_hdmi_mux_init();
1110 omap_display_init(&tuna_dss_data);
1113 static int __init get_panel_id(char *str)
1115 long value;
1116 int ret;
1118 ret = strict_strtol(str, 0, &value);
1119 if (ret < 0)
1120 return ret;
1122 panel_id = (unsigned int)value;
1123 return 0;
1125 __setup("mms_ts.panel_id=", get_panel_id);