2 * Copyright (C) 2012 Spreadtrum Communications Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
16 #include <asm/arch/sc8810_lcd.h>
17 #define mdelay(a) udelay(a * 1000)
21 #define LCD_PRINT printf
23 #define LCD_PRINT(...)
26 static int32_t nt35510_init(struct lcd_spec *self)
28 Send_data send_cmd = self->info.mcu->ops->send_cmd;
29 Send_data send_data = self->info.mcu->ops->send_data;
31 LCD_PRINT("nt35510_init===\n");
35 //Power setting sequence
122 //Display parameter setting
211 send_data(0xD6);//(0x00);->0x01->0x11
871 send_cmd(0x1100); // (DISPON)
872 mdelay(100); // 100ms
874 send_cmd(0x2900); // (DISPON)
881 static int32_t nt35510_set_window(struct lcd_spec *self,
882 uint16_t left, uint16_t top, uint16_t right, uint16_t bottom)
884 Send_data send_cmd = self->info.mcu->ops->send_cmd;
885 Send_data send_data = self->info.mcu->ops->send_data;
887 LCD_PRINT("nt35510_set_window:%d, %d, %d, %d\n", left, top, right, bottom);
890 send_data((left >> 8));
892 send_data((left & 0xFF));
894 send_data((right >> 8));
896 send_data((right & 0xFF));
899 send_data((top >> 8));
901 send_data((top & 0xFF));
903 send_data((bottom >> 8));
905 send_data((bottom & 0xFF));
912 static int32_t nt35510_invalidate(struct lcd_spec *self)
915 return self->ops->lcd_set_window(self, 0, 0,
916 self->width-1, self->height-1);
920 static int32_t nt35510_invalidate_rect(struct lcd_spec *self,
921 uint16_t left, uint16_t top,
922 uint16_t right, uint16_t bottom)
925 LCD_PRINT("nt35510_invalidate_rect\n");
927 return self->ops->lcd_set_window(self, left, top,
931 static int32_t nt35510_set_direction(struct lcd_spec *self, uint16_t direction)
934 LCD_PRINT("nt35510_set_direction\n");
938 static int32_t nt35510_enter_sleep(struct lcd_spec *self, uint8_t is_sleep)
940 Send_data send_cmd = self->info.mcu->ops->send_cmd;
941 Send_data send_data = self->info.mcu->ops->send_data;
944 LCD_PRINT("[LCD] nt35510_enter_sleep\n");
952 LCD_PRINT("[LCD] nt35510_enter_wakeup\n");
953 self->ops->lcd_init(self);
958 static uint32_t nt35510_read_id(struct lcd_spec *self)
960 uint32_t read_value = 0;
961 Send_data send_cmd = self->info.mcu->ops->send_cmd;
962 Read_data read_data = self->info.mcu->ops->read_data;
965 read_value = read_data();
966 LCD_PRINT("nt35510_read_id=%x=====\n",read_value);
971 read_value += read_data()<< 16;
972 LCD_PRINT("ili9486_read_id=%x+++\n",read_value);
973 read_value += read_data()<< 8;
974 LCD_PRINT("ili9486_read_id=%x++++\n",read_value);
975 read_value += read_data();
976 LCD_PRINT("ili9486_read_id=%x+++++\n",read_value);
978 return 0x5bbc; /* !!! WORK AROUND !!! */
982 static struct lcd_operations lcd_nt35510_operations = {
983 .lcd_init = nt35510_init,
984 .lcd_set_window = nt35510_set_window,
985 .lcd_invalidate = nt35510_invalidate,
986 .lcd_invalidate_rect = nt35510_invalidate_rect,
987 .lcd_set_direction = nt35510_set_direction,
988 .lcd_enter_sleep = nt35510_enter_sleep,
989 .lcd_readid = nt35510_read_id,
992 static struct timing_mcu lcd_nt35510_timing[] = {
993 [LCD_REGISTER_TIMING] = {
1001 [LCD_GRAM_TIMING] = {
1011 static struct info_mcu lcd_nt35510_info = {
1012 .bus_mode = LCD_BUS_8080,
1014 .timing = lcd_nt35510_timing,
1018 struct lcd_spec lcd_nt35510_spec = {
1021 .mode = LCD_MODE_MCU,
1022 .direction = LCD_DIRECT_NORMAL,
1024 .mcu = &lcd_nt35510_info
1026 .ops = &lcd_nt35510_operations,