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/sprd_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
273 static int32_t hx8363_enter_sleep(struct panel_spec *self, uint8_t is_sleep)
275 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
276 send_data_t send_data = self->info.mcu->ops->send_data;
298 static int32_t hx8363_set_window(struct panel_spec *self,
299 uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
301 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
302 send_data_t send_data = self->info.mcu->ops->send_data;
304 LCD_PRINT("hx8363_set_window\n");
306 send_cmd(0x2A); // col
307 send_data((left >> 8));
308 send_data((left & 0xFF));
309 send_data((right >> 8));
310 send_data((right & 0xFF));
312 send_cmd(0x2B); // row
313 send_data((top >> 8));
314 send_data((top & 0xFF));
315 send_data((bottom >> 8));
316 send_data((bottom & 0xFF));
318 send_cmd(0x2C); //Write data
322 static int32_t hx8363_invalidate(struct panel_spec *self)
324 LCD_PRINT("hx8363_invalidate\n");
326 return self->ops->panel_set_window(self, 0, 0,
327 self->width - 1, self->height - 1);
332 static int32_t hx8363_invalidate_rect(struct panel_spec *self,
333 uint16_t left, uint16_t top,
334 uint16_t right, uint16_t bottom)
336 LCD_PRINT("hx8363_invalidate_rect \n");
338 return self->ops->panel_set_window(self, left, top,
342 static int32_t hx8363_read_id(struct panel_spec *self)
345 send_data_t send_cmd = self->info.mcu->ops->send_cmd;
346 read_data_t read_data = self->info.mcu->ops->read_data;
347 send_data_t send_data = self->info.mcu->ops->send_data;
354 chip_id = read_data();
355 LCD_PRINT("hx8363_read_id1 0XDA = 0x%x!\n", chip_id);
356 chip_id = read_data();
357 LCD_PRINT("hx8363_read_id2 0XDA = 0x%x!\n", chip_id);
359 chip_id = read_data();
360 LCD_PRINT("hx8363_read_id1 0XDB = 0x%x!\n", chip_id);
361 chip_id = read_data();
362 LCD_PRINT("hx8363_read_id2 0XDB = 0x%x!\n", chip_id);
364 chip_id = read_data();
365 LCD_PRINT("hx8363_read_id1 0XDB = 0x%x!\n", chip_id);
366 chip_id = read_data();
367 LCD_PRINT("hx8363_read_id2 0XDC = 0x%x!\n", chip_id);
372 static struct panel_operations lcd_hx8363_mcu_operations = {
373 .panel_init = hx8363_init,
374 .panel_set_window = hx8363_set_window,
375 .panel_invalidate_rect= hx8363_invalidate_rect,
376 .panel_invalidate = hx8363_invalidate,
377 .panel_enter_sleep = hx8363_enter_sleep,
378 .panel_readid = hx8363_read_id
381 static struct timing_mcu lcd_hx8363_mcu_timing[] = {
382 [0] = { // read/write register timing
390 [1] = { // read/write gram timing
400 static struct info_mcu lcd_hx8363_mcu_info = {
401 .bus_mode = LCD_BUS_8080,
404 .timing =lcd_hx8363_mcu_timing,
408 struct panel_spec lcd_hx8363_mcu_spec = {
411 .type = LCD_MODE_MCU,
412 .direction = LCD_DIRECT_NORMAL,
413 .info = {.mcu = &lcd_hx8363_mcu_info},
414 .ops = &lcd_hx8363_mcu_operations,