1 /* drivers/video/sc8825/lcd_nt35516_mipi.c
\r
3 * Support for nt35516 mipi LCD device
\r
5 * Copyright (C) 2010 Spreadtrum
\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
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
17 #include <asm/arch/sprd_lcd.h>
\r
18 #include "../sprdfb.h"
\r
20 #define printk printf
\r
24 #define LCD_PRINT printk
\r
26 #define LCD_PRINT(...)
\r
31 typedef struct LCM_Init_Code_tag {
\r
33 unsigned char data[MAX_DATA];
\r
36 #define LCM_TAG_SHIFT 24
\r
37 #define LCM_TAG_MASK ((1 << 24) -1)
\r
38 #define LCM_SEND(len) ((1 << LCM_TAG_SHIFT)| len)
\r
39 #define LCM_SLEEP(ms) ((2 << LCM_TAG_SHIFT)| ms)
\r
40 //#define ARRAY_SIZE(array) ( sizeof(array) / sizeof(array[0]))
\r
42 #define LCM_TAG_SEND (1<< 0)
\r
43 #define LCM_TAG_SLEEP (1 << 1)
\r
45 static LCM_Init_Code init_data[] = {
\r
47 {LCM_SEND(8), {6, 0, 0xF0,0x55,0xAA,0x52,0x08,0x01}},
\r
49 {LCM_SEND(6), {4, 0, 0xB0,0x09,0x09,0x09}},
\r
50 {LCM_SEND(6), {4, 0, 0xB6,0x34,0x34,0x34}},
\r
51 {LCM_SEND(6), {4, 0, 0xB1,0x09,0x09,0x09}},
\r
52 {LCM_SEND(6), {4, 0, 0xB7,0x24,0x24,0x24}},
\r
53 {LCM_SEND(6), {4, 0, 0xB3,0x05,0x05,0x05}},
\r
54 {LCM_SEND(6), {4, 0, 0xB9,0x24,0x24,0x24}},
\r
56 {LCM_SEND(2), {0xBF,0x01}},
\r
58 {LCM_SEND(6), {4, 0, 0xB5,0x03,0x03,0x03}},
\r
59 {LCM_SEND(6), {4, 0, 0xBA,0x24,0x24,0x24}},
\r
60 {LCM_SEND(2), {0xC2,0x01}},
\r
61 {LCM_SEND(6), {4, 0, 0xBC,0x00,0x90,0x00}},
\r
62 {LCM_SEND(6), {4, 0, 0xBD,0x00,0x90,0x00}},
\r
64 {LCM_SEND(5), {3, 0, 0xBE,0x00,0x57}},
\r
66 {LCM_SEND(55), {53, 0, 0xD1,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
67 {LCM_SEND(55), {53, 0, 0xD2,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
68 {LCM_SEND(55), {53, 0, 0xD3,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
69 {LCM_SEND(55), {53, 0, 0xD4,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
70 {LCM_SEND(55), {53, 0, 0xD5,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
71 {LCM_SEND(55), {53, 0, 0xD6,0x00,0x01,0x00,0x1D,0x00,0x48,0x00,0x64,0x00,0x7E,0x00,0xB1,0x00,0xD3,0x01,0x07,0x01,0x35,0x01,0x7B,0x01,0xB3,0x02,0x03,0x02,0x48,0x02,0x49,0x02,0x88,0x02,0xC7,0x02,0xF3,0x03,0x21,0x03,0x46,0x03,0x74,0x03,0x8F,0x03,0xA3,0x03,0xAC,0x03,0xB7,0x03,0xBF,0x03,0xFE}},
\r
73 {LCM_SEND(8), {6, 0, 0xF0,0x55,0xAA,0x52,0x08,0x00}},
\r
75 {LCM_SEND(2), {0xB6,0x0A}},
\r
76 {LCM_SEND(5), {3, 0, 0xB7,0x00,0x00}},
\r
77 {LCM_SEND(7), {5, 0, 0xB8,0x01,0x05,0x05,0x05}},
\r
78 {LCM_SEND(2), {0xBA,0x01}},
\r
79 {LCM_SEND(6), {4, 0, 0xBC,0x00,0x00,0x00}},
\r
80 //{LCM_SEND(8), {6, 0, 0xBD,0x01,0x4D,0x07,0x31,0x00}},
\r
81 //{LCM_SEND(8), {6, 0, 0xBE,0x01,0x84,0x07,0x31,0x00}},
\r
82 //{LCM_SEND(8), {6, 0, 0xBF,0x01,0x84,0x07,0x31,0x00}},
\r
83 {LCM_SEND(6), {4, 0, 0xCC,0x03,0x00,0x00}},
\r
84 {LCM_SEND(5), {3, 0, 0xB1,0xFC,0x00}},
\r
85 {LCM_SEND(2), {0x35,0x00}}, // Tearing Effect On
\r
86 {LCM_SEND(2), {0x36,0xC2}},
\r
87 {LCM_SEND(2), {0x3A, 0x77}},
\r
91 {LCM_SEND(1), {0x11}}, // sleep out
\r
93 {LCM_SEND(1), {0x29}}, // display on
\r
95 {LCM_SEND(1), {0x2c}}, // normal on
\r
100 static LCM_Init_Code disp_on = {LCM_SEND(1), {0x29}};
\r
102 static LCM_Init_Code sleep_in = {LCM_SEND(1), {0x10}};
\r
104 static LCM_Init_Code sleep_out = {LCM_SEND(1), {0x11}};
\r
106 static int32_t nt35512_mipi_init(struct panel_spec *self)
\r
109 LCM_Init_Code *init = init_data;
\r
112 mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode;
\r
113 mipi_gen_write_t mipi_gen_write = self->info.mipi->ops->mipi_gen_write;
\r
115 LCD_PRINT("nt35512_init\n");
\r
117 mipi_set_cmd_mode();
\r
119 for(i = 0; i < ARRAY_SIZE(init_data); i++){
\r
120 tag = (init->tag >>24);
\r
121 if(tag & LCM_TAG_SEND){
\r
122 mipi_gen_write(init->data, (init->tag & LCM_TAG_MASK));
\r
124 }else if(tag & LCM_TAG_SLEEP){
\r
125 mdelay((init->tag & LCM_TAG_MASK));
\r
132 static uint32_t nt35512_readid(struct panel_spec *self)
\r
134 /*Jessica TODO: need read id*/
\r
138 static struct panel_operations lcd_nt35512_mipi_operations = {
\r
139 .panel_init = nt35512_mipi_init,
\r
140 .panel_readid = nt35512_readid,
\r
143 static struct timing_rgb lcd_nt35512_mipi_timing = {
\r
144 .hfp = 200, /* unit: pixel */
\r
147 .vfp = 10, /*unit: line*/
\r
152 static struct info_mipi lcd_nt35512_mipi_info = {
\r
153 .work_mode = SPRDFB_MIPI_MODE_VIDEO,
\r
154 .video_bus_width = 24, /*18,16*/
\r
156 .phy_feq = 500*1000,
\r
157 .h_sync_pol = SPRDFB_POLARITY_POS,
\r
158 .v_sync_pol = SPRDFB_POLARITY_POS,
\r
159 .de_pol = SPRDFB_POLARITY_POS,
\r
160 .te_pol = SPRDFB_POLARITY_POS,
\r
161 .color_mode_pol = SPRDFB_POLARITY_NEG,
\r
162 .shut_down_pol = SPRDFB_POLARITY_NEG,
\r
163 .timing = &lcd_nt35512_mipi_timing,
\r
167 struct panel_spec lcd_nt35512_mipi_spec = {
\r
170 .type = LCD_MODE_DSI,
\r
171 .direction = LCD_DIRECT_NORMAL,
\r
173 .mipi = &lcd_nt35512_mipi_info
\r
175 .ops = &lcd_nt35512_mipi_operations,
\r