+/*\r
+ * Copyright (C) 2011 ROCKCHIP, Inc.\r
+ *\r
+ * author: hhb@rock-chips.com\r
+ * creat date: 2011-05-14\r
+ * route:drivers/video/display/screen/lcd_ili9803_cpt4_3.c - driver for rk29 phone sdk or rk29 a22\r
+ * station:haven been tested in a22 hardware platform\r
+ * This software is licensed under the terms of the GNU General Public\r
+ * License version 2, as published by the Free Software Foundation, and\r
+ * may be copied, distributed, and modified under those terms.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ */\r
+\r
+\r
+\r
+\r
#include <linux/fb.h>\r
#include <linux/delay.h>\r
#include "../../rk29_fb.h"\r
#include <mach/board.h>\r
#include "screen.h"\r
\r
+\r
/* Base */\r
#define OUT_TYPE SCREEN_RGB\r
-#define OUT_FACE OUT_P888\r
-#define OUT_CLK 26 //***27\r
+#define OUT_FACE OUT_P666\r
+#define OUT_CLK 26000000\r
+#define LCDC_ACLK 150000000 //29 lcdc axi DMA\r
\r
/* Timing */\r
-#define H_PW 16 //8Ç°ÏûÓ°\r
-#define H_BP 24//6\r
-#define H_VD 480//320 //***800 \r
-#define H_FP 16//60\r
+#define H_PW 8\r
+#define H_BP 6\r
+#define H_VD 480\r
+#define H_FP 60\r
\r
-#define V_PW 2//12\r
-#define V_BP 2// 4\r
-#define V_VD 800//480 //***480\r
-#define V_FP 4//40\r
+#define V_PW 2\r
+#define V_BP 12\r
+#define V_VD 800\r
+#define V_FP 4\r
+\r
+\r
+#define LCD_WIDTH 480 //need modify\r
+#define LCD_HEIGHT 800\r
\r
/* Other */\r
-#define DCLK_POL 1//0 \r
+#define DCLK_POL 1\r
#define SWAP_RB 0\r
\r
+\r
+/* define spi write command and data interface function */\r
+\r
+#define SIMULATION_SPI 1\r
+#ifdef SIMULATION_SPI\r
+\r
+ #define TXD_PORT gLcd_info->txd_pin\r
+ #define CLK_PORT gLcd_info->clk_pin\r
+ #define CS_PORT gLcd_info->cs_pin\r
+ #define LCD_RST_PORT RK29_PIN6_PC6\r
+\r
+ #define CS_OUT() gpio_direction_output(CS_PORT, 0)\r
+ #define CS_SET() gpio_set_value(CS_PORT, GPIO_HIGH)\r
+ #define CS_CLR() gpio_set_value(CS_PORT, GPIO_LOW)\r
+ #define CLK_OUT() gpio_direction_output(CLK_PORT, 0)\r
+ #define CLK_SET() gpio_set_value(CLK_PORT, GPIO_HIGH)\r
+ #define CLK_CLR() gpio_set_value(CLK_PORT, GPIO_LOW)\r
+ #define TXD_OUT() gpio_direction_output(TXD_PORT, 0)\r
+ #define TXD_SET() gpio_set_value(TXD_PORT, GPIO_HIGH)\r
+ #define TXD_CLR() gpio_set_value(TXD_PORT, GPIO_LOW)\r
+ #define LCD_RST_OUT() gpio_direction_output(LCD_RST_PORT, 0)\r
+ #define LCD_RST(i) gpio_set_value(LCD_RST_PORT, i)\r
+\r
+ #define bits_9\r
+ #ifdef bits_9 //9bits\r
+\r
+ #define LCD_ILI9803_CMD(cmd) spi_write_9bit(0, cmd)\r
+ #define LCD_ILI9803_Parameter(dat) spi_write_9bit(1, dat)\r
+ #else //16bits\r
+ #define LCD_ILI9803_CMD(cmd) spi_write_16bit(0, cmd)\r
+ #define LCD_ILI9803_Parameter(dat) spi_write_16bit(1, dat)\r
+ #endif\r
+ #define Lcd_EnvidOnOff(i)\r
+\r
+#else\r
+\r
+ #define bits_9 1\r
+ #ifdef bits_9 //9bits\r
+ #define LCD_ILI9803_CMD(cmd)\r
+ #define LCD_ILI9803_Parameter(dat)\r
+ #else //16bits\r
+ #define LCD_ILI9803_CMD(cmd)\r
+ #define LCD_ILI9803_Parameter(dat)\r
+ #endif\r
+\r
+#endif\r
+\r
+\r
+/* define lcd command */\r
+#define ENTER_SLEEP_MODE 0x10\r
+#define EXIT_SLEEP_MODE 0x11\r
+#define SET_COLUMN_ADDRESS 0x2a\r
+#define SET_PAGE_ADDRESS 0x2b\r
+#define WRITE_MEMORY_START 0x2c\r
+#define SET_DISPLAY_ON 0x29\r
+#define SET_DISPLAY_OFF 0x28\r
+#define SET_ADDRESS_MODE 0x36\r
+#define SET_PIXEL_FORMAT 0x3a\r
+\r
+\r
+#define DRVDelayUs(i) udelay(i*2)\r
+\r
static struct rk29lcd_info *gLcd_info = NULL;\r
-int init(void);\r
-int standby(u8 enable);\r
+int lcd_init(void);\r
+int lcd_standby(u8 enable);\r
\r
-#define TXD_PORT gLcd_info->txd_pin\r
-#define CLK_PORT gLcd_info->clk_pin\r
-#define CS_PORT gLcd_info->cs_pin\r
\r
-#define CS_OUT() gpio_direction_output(CS_PORT, 1)\r
-#define CS_SET() gpio_set_value(CS_PORT, GPIO_HIGH)\r
-#define CS_CLR() gpio_set_value(CS_PORT, GPIO_LOW)\r
-#define CLK_OUT() gpio_direction_output(CLK_PORT, 0) \r
-#define CLK_SET() gpio_set_value(CLK_PORT, GPIO_HIGH)\r
-#define CLK_CLR() gpio_set_value(CLK_PORT, GPIO_LOW)\r
-#define TXD_OUT() gpio_direction_output(TXD_PORT, 1) \r
-#define TXD_SET() gpio_set_value(TXD_PORT, GPIO_HIGH)\r
-#define TXD_CLR() gpio_set_value(TXD_PORT, GPIO_LOW)\r
+/* spi write a data frame,type mean command or data */\r
+int spi_write_9bit(u32 type, u32 value)\r
+{\r
+ u32 i = 0;\r
+\r
+ if(type != 0 && type != 1)\r
+ {\r
+ return -1;\r
+ }\r
+ /*make a data frame of 9 bits,the 8th bit 0:mean command,1:mean data*/\r
+ value &= 0xff;\r
+ value |= (type << 8);\r
+// if(0 == type){\r
+ TXD_OUT();\r
+ CLK_OUT();\r
+ CS_OUT();\r
+ DRVDelayUs(2);\r
+ DRVDelayUs(2);\r
+ CS_SET();\r
+ TXD_SET();\r
+ CLK_SET();\r
+ DRVDelayUs(2);\r
+ CS_CLR();\r
+// }\r
+\r
+ for(i = 0; i < 9; i++) //reg\r
+ {\r
+\r
+ CLK_CLR();\r
+ DRVDelayUs(2);\r
+ if(value & (1 << (8-i)))\r
+ {\r
+ TXD_SET();\r
+ }\r
+ else\r
+ {\r
+ TXD_CLR();\r
+ }\r
+ CLK_SET();\r
+ DRVDelayUs(2);\r
+ }\r
+\r
+// if(0 == type){\r
+ CS_SET();\r
+ CLK_CLR();\r
+ TXD_CLR();\r
+// }\r
\r
+ DRVDelayUs(2);\r
+ return 0;\r
+}\r
\r
-#define DRVDelayUs(i) udelay(i*4)\r
\r
-void spi_screenreg_cmd(u8 Addr)\r
+int lcd_init(void)\r
{\r
- u32 i;\r
- u32 control_bit;\r
+ if(gLcd_info)\r
+ gLcd_info->io_init();\r
+ printk("*****lcd_init...*****\n");\r
+/* reset lcd to start init lcd by software if there is no hardware reset circuit for the lcd */\r
+#ifdef LCD_RST_PORT\r
+ gpio_request(LCD_RST_PORT, NULL);\r
+ LCD_RST_OUT();\r
+ LCD_RST(1);\r
+ msleep(1);\r
+ LCD_RST(0);\r
+ msleep(10);\r
+ LCD_RST(1);\r
+ msleep(120);\r
+\r
+#endif\r
\r
TXD_OUT();\r
CLK_OUT();\r
CS_OUT();\r
- DRVDelayUs(2);\r
- DRVDelayUs(2);\r
-\r
CS_SET();\r
TXD_SET();\r
- CLK_CLR();\r
- DRVDelayUs(30);\r
-\r
- CS_CLR();\r
- control_bit = 0x0000;\r
- Addr = (control_bit | Addr);//spi_screenreg_set(0x36, 0x0000, 0xffff); \r
- //printk("addr is 0x%x \n", Addr); \r
- for(i = 0; i < 9; i++) //reg\r
- {\r
- if(Addr &(1<<(8-i)))\r
- TXD_SET();\r
- else\r
- TXD_CLR();\r
-\r
- // \u6a21\u62dfCLK\r
- CLK_SET();\r
- DRVDelayUs(2);\r
- CLK_CLR();\r
- DRVDelayUs(2);\r
- }\r
+ CLK_SET();\r
+\r
+ LCD_ILI9803_CMD(0xB1);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_CMD(0xB2);\r
+ LCD_ILI9803_Parameter(0x10);\r
+ LCD_ILI9803_Parameter(0xC7);\r
+ LCD_ILI9803_CMD(0xB3);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_CMD(0xB4);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_CMD(0xB9);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_CMD(0xC3);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_CMD(0xB2);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_CMD(0xC5);\r
+ LCD_ILI9803_Parameter(0x6E);\r
+ LCD_ILI9803_CMD(0xC2);\r
+ LCD_ILI9803_Parameter(0x20);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x10);\r
+ msleep(20);\r
+ LCD_ILI9803_CMD(0xC8);\r
+ LCD_ILI9803_Parameter(0xA3);\r
+ LCD_ILI9803_CMD(0xC9);\r
+ LCD_ILI9803_Parameter(0x32);\r
+ LCD_ILI9803_Parameter(0x06);\r
+ LCD_ILI9803_CMD(0xD7);\r
+ LCD_ILI9803_Parameter(0x03);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x0F);\r
+ LCD_ILI9803_Parameter(0x0F);\r
+ LCD_ILI9803_CMD(0xCF);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x08);\r
+ LCD_ILI9803_CMD(0xB6);\r
+ LCD_ILI9803_Parameter(0x20);\r
+ LCD_ILI9803_Parameter(0xC2);\r
+ LCD_ILI9803_Parameter(0xFF);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_CMD(0xEA);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_CMD(0x2A);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x01);\r
+ LCD_ILI9803_Parameter(0xDF);\r
+ LCD_ILI9803_CMD(0x2B);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x03);\r
+ LCD_ILI9803_Parameter(0xEF);\r
+ LCD_ILI9803_CMD(0xB0);\r
+ LCD_ILI9803_Parameter(0x01);\r
+ LCD_ILI9803_CMD(0x0C);\r
+ LCD_ILI9803_Parameter(0x50);\r
+ LCD_ILI9803_CMD(0x36);\r
+ LCD_ILI9803_Parameter(0x48);\r
+ LCD_ILI9803_CMD(0x3A);\r
+ LCD_ILI9803_Parameter(0x66);\r
+ LCD_ILI9803_CMD(0xE0);\r
+ LCD_ILI9803_Parameter(0x05);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x14);\r
+ LCD_ILI9803_Parameter(0x11);\r
+ LCD_ILI9803_Parameter(0x14);\r
+ LCD_ILI9803_Parameter(0x0A);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x02);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_Parameter(0x33);\r
+ LCD_ILI9803_Parameter(0x36);\r
+ LCD_ILI9803_Parameter(0x1F);\r
+ LCD_ILI9803_CMD(0xE1);\r
+ LCD_ILI9803_Parameter(0x1F);\r
+ LCD_ILI9803_Parameter(0x36);\r
+ LCD_ILI9803_Parameter(0x33);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_Parameter(0x00);\r
+ LCD_ILI9803_Parameter(0x02);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x04);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_Parameter(0x0A);\r
+ LCD_ILI9803_Parameter(0x14);\r
+ LCD_ILI9803_Parameter(0x11);\r
+ LCD_ILI9803_Parameter(0x14);\r
+ LCD_ILI9803_Parameter(0x0B);\r
+ LCD_ILI9803_Parameter(0x07);\r
+ LCD_ILI9803_Parameter(0x05);\r
+ LCD_ILI9803_CMD(EXIT_SLEEP_MODE);\r
+ msleep(70);\r
+ LCD_ILI9803_CMD(SET_DISPLAY_ON);\r
+ msleep(10);\r
+ LCD_ILI9803_CMD(WRITE_MEMORY_START);\r
\r
- CS_SET();\r
- TXD_SET();\r
- CLK_CLR(); \r
- DRVDelayUs(10);\r
-}\r
+ if(gLcd_info)\r
+ gLcd_info->io_deinit();\r
\r
+ return 0;\r
+}\r
\r
-void spi_screenreg_param(u8 Param)\r
+extern void rk29_lcd_spim_spin_lock(void);\r
+extern void rk29_lcd_spim_spin_unlock(void);\r
+int lcd_standby(u8 enable)\r
{\r
+ rk29_lcd_spim_spin_lock();\r
+ if(gLcd_info)\r
+ gLcd_info->io_init();\r
\r
- u32 i;\r
- u32 control_bit;\r
+ if(enable) {\r
+ LCD_ILI9803_CMD(ENTER_SLEEP_MODE);\r
+ msleep(150);\r
+ printk("lcd enter sleep mode\n");\r
+ } else {\r
+ LCD_ILI9803_CMD(EXIT_SLEEP_MODE);\r
+ msleep(150);\r
+ printk("lcd exit sleep mode\n");\r
+ }\r
\r
- CS_CLR();\r
- \r
- control_bit = 0x0100;\r
- Param = (control_bit | Param);\r
- //printk("data0 is 0x%x \n", Data); \r
- for(i = 0; i < 9; i++) //data\r
- {\r
- if(Param &(1<<(8-i)))\r
- TXD_SET();\r
- else\r
- TXD_CLR();\r
-\r
- // \u6a21\u62dfCLK\r
- CLK_SET();\r
- DRVDelayUs(2);\r
- CLK_CLR();\r
- DRVDelayUs(2);\r
- }\r
+ if(gLcd_info)\r
+ gLcd_info->io_deinit();\r
+ rk29_lcd_spim_spin_unlock();\r
\r
- CS_SET();\r
- CLK_CLR();\r
- TXD_CLR();\r
- DRVDelayUs(10);\r
+ return 0;\r
}\r
\r
void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info )\r
{\r
- //printk("lcd_hx8357 set_lcd_info \n"); \r
/* screen type & face */\r
screen->type = OUT_TYPE;\r
screen->face = OUT_FACE;\r
- \r
+\r
/* Screen size */\r
screen->x_res = H_VD;\r
screen->y_res = V_VD;\r
\r
+ screen->width = LCD_WIDTH;\r
+ screen->height = LCD_HEIGHT;\r
+\r
/* Timing */\r
+ screen->lcdc_aclk = LCDC_ACLK;\r
screen->pixclock = OUT_CLK;\r
- screen->left_margin = H_BP; /*>2*/ \r
- screen->right_margin = H_FP; /*>2*/ \r
- screen->hsync_len = H_PW; /*>2*/ //***all > 326, 4<PW+BP<15, \r
- screen->upper_margin = V_BP; /*>2*/ \r
- screen->lower_margin = V_FP; /*>2*/ \r
- screen->vsync_len = V_PW; /*>6*/ \r
+ screen->left_margin = H_BP;\r
+ screen->right_margin = H_FP;\r
+ screen->hsync_len = H_PW;\r
+ screen->upper_margin = V_BP;\r
+ screen->lower_margin = V_FP;\r
+ screen->vsync_len = V_PW;\r
\r
/* Pin polarity */\r
- screen->pin_hsync = 0; \r
- screen->pin_vsync = 0; \r
+ screen->pin_hsync = 0;\r
+ screen->pin_vsync = 0;\r
screen->pin_den = 0;\r
screen->pin_dclk = DCLK_POL;\r
\r
screen->swap_dumy = 0;\r
\r
/* Operation function*/\r
- screen->init = init;\r
- screen->standby = standby;\r
+ screen->init = lcd_init;\r
+ screen->standby = lcd_standby;\r
if(lcd_info)\r
gLcd_info = lcd_info;\r
}\r
\r
-int init(void)\r
-{ \r
- volatile u32 data;\r
-\r
- if(gLcd_info)\r
- gLcd_info->io_init();\r
-\r
- printk("lcd init...\n");\r
- spi_screenreg_cmd(0xB1);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB2);\r
- spi_screenreg_param(0x10);\r
- spi_screenreg_param(0xC7);\r
- spi_screenreg_cmd(0xB3);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB4);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB9);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xC3);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_cmd(0xB2);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_cmd(0xC5);\r
- spi_screenreg_param(0x6E);\r
- spi_screenreg_cmd(0xC2);\r
- spi_screenreg_param(0x20);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x10);\r
- mdelay(20);//20ms\r
- \r
- spi_screenreg_cmd(0xC8);\r
- spi_screenreg_param(0xA3);\r
- spi_screenreg_cmd(0xC9);\r
- spi_screenreg_param(0x32);\r
- spi_screenreg_param(0x06);\r
- spi_screenreg_cmd(0xD7);\r
- spi_screenreg_param(0x03);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x0F);\r
- spi_screenreg_param(0x0F);\r
- spi_screenreg_cmd(0xCF);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x08);\r
- spi_screenreg_cmd(0xB6);\r
- spi_screenreg_param(0x20);\r
- spi_screenreg_param(0xC2);\r
- spi_screenreg_param(0xFF);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_cmd(0xEA);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0x2A);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x01);\r
- spi_screenreg_param(0xDF);\r
- spi_screenreg_cmd(0x2B);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x03);\r
- spi_screenreg_param(0xEF);\r
- spi_screenreg_cmd(0xB0);\r
- spi_screenreg_param(0x01);\r
- spi_screenreg_cmd(0x0C);\r
- spi_screenreg_param(0x50);\r
- spi_screenreg_cmd(0x36);\r
- spi_screenreg_param(0x48);\r
- spi_screenreg_cmd(0x3A);\r
- spi_screenreg_param(0x66);\r
- spi_screenreg_cmd(0xE0);\r
- spi_screenreg_param(0x05);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x11);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x0A);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x02);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x33);\r
- spi_screenreg_param(0x36);\r
- spi_screenreg_param(0x1F);\r
- spi_screenreg_cmd(0xE1);\r
- spi_screenreg_param(0x1F);\r
- spi_screenreg_param(0x36);\r
- spi_screenreg_param(0x33);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x02);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x0A);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x11);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x05);\r
- spi_screenreg_cmd(0x11);\r
- mdelay(70);\r
- spi_screenreg_cmd(0x29);\r
- mdelay(10);\r
- spi_screenreg_cmd(0x2C);\r
- if(gLcd_info)\r
- gLcd_info->io_deinit();\r
-\r
- return 0;\r
-}\r
\r
-int standby(u8 enable) //***enable =1 means suspend, 0 means resume \r
-{\r
- int i;\r
-#if 1 \r
- if(gLcd_info)\r
- gLcd_info->io_init();\r
\r
- if(enable) {\r
- spi_screenreg_cmd(0xB7);\r
- spi_screenreg_param(0x0f);\r
- } else { \r
- CS_OUT() ;\r
- for(i=0; i<6; i++)\r
- {\r
- CS_SET();\r
- DRVDelayUs(1);\r
- CS_CLR();\r
- DRVDelayUs(1);\r
- CS_SET();\r
- mdelay(2); \r
- }\r
- }\r
-\r
- if(gLcd_info)\r
- gLcd_info->io_deinit();\r
-#endif\r
- return 0;\r
-}\r
-\r
-void set_backlight(int brightness)\r
-{\r
-#if 1\r
- if(gLcd_info)\r
- gLcd_info->io_init();\r
-\r
- printk("lcd_ili9803:set_backlight = %d\r\n", brightness);\r
- if (brightness < 0)\r
- {\r
- brightness = 0;\r
- }\r
- if (brightness > 4)\r
- {\r
- brightness = 4;\r
- }\r
- spi_screenreg_cmd(0x51);\r
- spi_screenreg_param(brightness<<5);\r
- \r
- if(gLcd_info)\r
- gLcd_info->io_deinit();\r
-\r
-#endif\r
-}\r