1 /* drivers/video/sc8825/lcd_hx8363_mcu.c
3 * Support for nt35516 mipi LCD device
5 * Copyright (C) 2010 Spreadtrum
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #include <asm/arch/tiger_lcd.h>
23 #define LCD_PRINT printk
25 #define LCD_PRINT(...)
28 static int32_t hx8363_init(struct panel_spec *self)
30 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
31 send_data_t send_data = self->info.mcu->ops->send_data;
33 LCD_PRINT("hx8363_init\n");
35 send_cmd(0xB9); // SET password
40 send_cmd(0xB0);//Enable internal oscillator
65 send_cmd(0xB2); // SET DISP
70 send_data(0x00);//Column inversion
78 send_cmd(0xB6);//Set_VCOM
81 send_cmd(0xCC);// SET Panel
86 send_cmd(0xE0); // SET Gamma
122 send_cmd(0xC1); //COLMOD
254 send_cmd(0x3A); //COLMOD
257 send_cmd(0x11);//Sleep Out
260 send_cmd(0xC2);// SET DISPIF
261 send_data(0x04); //24bit
262 send_cmd(0x35); //Tearing Effect
271 static int32_t hx8363_enter_sleep(struct panel_spec *self, uint8_t is_sleep)
273 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
274 send_data_t send_data = self->info.mcu->ops->send_data;
296 static int32_t hx8363_set_window(struct panel_spec *self,
297 uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
299 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
300 send_data_t send_data = self->info.mcu->ops->send_data;
302 LCD_PRINT("hx8363_set_window\n");
304 send_cmd(0x2A); // col
305 send_data((left >> 8));
306 send_data((left & 0xFF));
307 send_data((right >> 8));
308 send_data((right & 0xFF));
310 send_cmd(0x2B); // row
311 send_data((top >> 8));
312 send_data((top & 0xFF));
313 send_data((bottom >> 8));
314 send_data((bottom & 0xFF));
316 send_cmd(0x2C); //Write data
320 static int32_t hx8363_invalidate(struct panel_spec *self)
322 LCD_PRINT("hx8363_invalidate\n");
324 return self->ops->panel_set_window(self, 0, 0,
325 self->width - 1, self->height - 1);
330 static int32_t hx8363_invalidate_rect(struct panel_spec *self,
331 uint16_t left, uint16_t top,
332 uint16_t right, uint16_t bottom)
334 LCD_PRINT("hx8363_invalidate_rect \n");
336 return self->ops->panel_set_window(self, left, top,
340 static int32_t hx8363_read_id(struct panel_spec *self)
343 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
344 read_data_t read_data = self->info.mcu->ops->read_data;
345 send_data_t send_data = self->info.mcu->ops->send_data;
355 static struct panel_operations lcd_hx8363_mcu_operations = {
356 .panel_init = hx8363_init,
357 .panel_set_window = hx8363_set_window,
358 .panel_invalidate_rect= hx8363_invalidate_rect,
359 .panel_invalidate = hx8363_invalidate,
360 .panel_enter_sleep = hx8363_enter_sleep,
361 .panel_readid = hx8363_read_id
364 static struct timing_mcu lcd_hx8363_mcu_timing[] = {
365 [0] = { // read/write register timing
373 [1] = { // read/write gram timing
383 static struct info_mcu lcd_hx8363_mcu_info = {
384 .bus_mode = LCD_BUS_8080,
387 .timing =lcd_hx8363_mcu_timing,
391 struct panel_spec lcd_hx8363_mcu_spec = {
394 .type = LCD_MODE_MCU,
395 .direction = LCD_DIRECT_NORMAL,
396 .info = {.mcu = &lcd_hx8363_mcu_info},
397 .ops = &lcd_hx8363_mcu_operations,