From c70c13a65176f6a2850a683818f0175dc40189d7 Mon Sep 17 00:00:00 2001 From: daeinki Date: Thu, 17 Dec 2009 16:45:23 +0900 Subject: [PATCH] s5pc110: fb: updated framebuffer driver. 1. changed framebuffer driver framework. 2. set default layer to 3. 3. added Geminus lcd panel support. Signed-off-by: daeinki --- board/samsung/universal/universal.c | 229 +++++++++++++++++++++++++++++++++++- drivers/video/s5p-fb.c | 160 ++++++------------------- drivers/video/s5p-fimd.c | 65 +--------- drivers/video/s6e63m0.c | 62 ++++------ include/lcd.h | 11 ++ 5 files changed, 301 insertions(+), 226 deletions(-) diff --git a/board/samsung/universal/universal.c b/board/samsung/universal/universal.c index f1e191b..09d39f9 100644 --- a/board/samsung/universal/universal.c +++ b/board/samsung/universal/universal.c @@ -34,6 +34,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -1324,6 +1325,229 @@ static void setup_power_down_mode_registers(void) } } +void lcd_cfg_gpio(void) +{ + unsigned int i; + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + + for (i = 0; i < 8; i++) { + /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */ + gpio_cfg_pin(&gpio->gpio_f0, i, GPIO_FUNC(2)); + gpio_cfg_pin(&gpio->gpio_f1, i, GPIO_FUNC(2)); + gpio_cfg_pin(&gpio->gpio_f2, i, GPIO_FUNC(2)); + /* pull-up/down disable */ + gpio_set_pull(&gpio->gpio_f0, i, GPIO_PULL_NONE); + gpio_set_pull(&gpio->gpio_f1, i, GPIO_PULL_NONE); + gpio_set_pull(&gpio->gpio_f2, i, GPIO_PULL_NONE); + + /* drive strength to max (24bit) */ + gpio_set_drv(&gpio->gpio_f0, i, GPIO_DRV_4x); + gpio_set_rate(&gpio->gpio_f0, i, GPIO_DRV_SLOW); + gpio_set_drv(&gpio->gpio_f1, i, GPIO_DRV_4x); + gpio_set_rate(&gpio->gpio_f1, i, GPIO_DRV_SLOW); + gpio_set_drv(&gpio->gpio_f2, i, GPIO_DRV_4x); + gpio_set_rate(&gpio->gpio_f2, i, GPIO_DRV_SLOW); + } + + for (i =0; i < 4; i++) { + /* set GPF3[0:3] for RGB Interface and Data lines (32bit) */ + gpio_cfg_pin(&gpio->gpio_f3, i, GPIO_PULL_UP); + /* pull-up/down disable */ + gpio_set_pull(&gpio->gpio_f3, i, GPIO_PULL_NONE); + /* drive strength to max (24bit) */ + gpio_set_drv(&gpio->gpio_f3, i, GPIO_DRV_4x); + gpio_set_rate(&gpio->gpio_f3, i, GPIO_DRV_SLOW); + } + /* display output path selection (only [1:0] valid) */ + writel(0x2, 0xE0107008); + + /* gpio pad configuration for LCD reset. */ + gpio_cfg_pin(&gpio->gpio_mp0_5, 5, GPIO_OUTPUT); + + /* gpio pad configuration for LCD ON. */ + gpio_cfg_pin(&gpio->gpio_j1, 3, GPIO_OUTPUT); + + /* MLCD_ON2 */ + /* + if (board_is_p2_real()) + gpio_cfg_pin(&gpio->gpio_j1, 4, GPIO_OUTPUT); + */ + + /* LCD_BACKLIGHT_EN */ + if (machine_is_geminus()) + gpio_cfg_pin(&gpio->gpio_mp0_5, 0, GPIO_OUTPUT); + + /* gpio pad configuration for DISPLAY_CS, DISPLAY_CLK, DISPLAY_SO, DISPLAY_SI. */ + gpio_cfg_pin(&gpio->gpio_mp0_1, 1, GPIO_OUTPUT); + gpio_cfg_pin(&gpio->gpio_mp0_4, 1, GPIO_OUTPUT); + gpio_cfg_pin(&gpio->gpio_mp0_4, 2, GPIO_INPUT); + gpio_cfg_pin(&gpio->gpio_mp0_4, 3, GPIO_OUTPUT); + + return; +} + +void backlight_on(unsigned int onoff) +{ + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + + if (onoff) { + if (machine_is_geminus()) + gpio_set_value(&gpio->gpio_mp0_5, 0, 1); + } else { + if (machine_is_geminus()) + gpio_set_value(&gpio->gpio_mp0_5, 0, 0); + } +} + +void reset_lcd(void) +{ + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + + if (machine_is_aquila() || machine_is_geminus()/* || board_is_p2_real() */) + gpio_set_value(&gpio->gpio_mp0_5, 5, 1); +} + +void lcd_power_on(unsigned int onoff) +{ + struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; + + if (machine_is_aquila() || machine_is_geminus()) { + if (onoff) { + gpio_set_value(&gpio->gpio_j1, 3, 1); + + /* + if (board_is_p2_real()) + gpio_direction_output(&gpio->gpio_j1, 4, 1); + */ + } else { + gpio_set_value(&gpio->gpio_j1, 3, 0); + + /* + if (board_is_p2_real()) + gpio_direction_output(&gpio->gpio_j1, 4, 0); + */ + } + } +} + +extern void s6e63m0_cfg_ldo(void); +extern void s6e63m0_enable_ldo(unsigned int onoff); + +void init_panel_info(vidinfo_t *vid) +{ + vid->cfg_gpio = NULL; + vid->reset_lcd = NULL; + vid->backlight_on = NULL; + vid->lcd_power_on = NULL; + + vid->cfg_ldo = NULL; + vid->enable_ldo = NULL; + + vid->init_delay = 0; + vid->reset_delay = 0; + vid->power_on_delay = 0; + + if (machine_is_aquila()) { + vid->vl_freq = 60; + vid->vl_col = 480, + vid->vl_row = 800, + vid->vl_width = 480, + vid->vl_height = 800, + vid->vl_clkp = CONFIG_SYS_HIGH, + vid->vl_hsp = CONFIG_SYS_LOW, + vid->vl_vsp = CONFIG_SYS_LOW, + vid->vl_dp = CONFIG_SYS_HIGH, + vid->vl_bpix = 32, + + /* S6E63M0 LCD Panel */ + vid->vl_hpw = 2, /* HLW */ + vid->vl_blw = 16, /* HBP */ + vid->vl_elw = 16, /* HFP */ + + vid->vl_vpw = 2, /* VLW */ + vid->vl_bfw = 3, /* VBP */ + vid->vl_efw = 28, /* VFP */ + + vid->cfg_gpio = lcd_cfg_gpio; + vid->reset_lcd = reset_lcd; + vid->backlight_on = backlight_on; + vid->lcd_power_on = lcd_power_on; + + vid->cfg_ldo = s6e63m0_cfg_ldo; + vid->enable_ldo = s6e63m0_enable_ldo; + + vid->init_delay = 25000; + vid->reset_delay = 120000; + + } else if (machine_is_geminus()) { + vid->vl_freq = 60; + vid->vl_col = 1024, + vid->vl_row = 600, + vid->vl_width = 1024, + vid->vl_height = 600, + vid->vl_clkp = CONFIG_SYS_LOW, + vid->vl_hsp = CONFIG_SYS_HIGH, + vid->vl_vsp = CONFIG_SYS_HIGH, + vid->vl_dp = CONFIG_SYS_LOW, + vid->vl_bpix = 32, + + vid->vl_hpw = 32, + vid->vl_blw = 80, + vid->vl_elw = 48, + + vid->vl_vpw = 1, + vid->vl_bfw = 4, + vid->vl_efw = 3, + + vid->cfg_gpio = lcd_cfg_gpio; + vid->reset_lcd = reset_lcd; + vid->backlight_on = backlight_on; + vid->lcd_power_on = lcd_power_on; + } +#if 0 + vid->vl_freq = 60; + vid->vl_col = 480, + vid->vl_row = 800, + vid->vl_width = 480, + vid->vl_height = 800, + vid->vl_clkp = CONFIG_SYS_HIGH, + vid->vl_hsp = CONFIG_SYS_LOW, + vid->vl_vsp = CONFIG_SYS_LOW, + vid->vl_dp = CONFIG_SYS_HIGH, + vid->vl_bpix = 32, + + /* tl2796 panel. */ + vid->vl_hpw = 4, + vid->vl_blw = 8, + vid->vl_elw = 8, + + vid->vl_vpw = 4, + vid->vl_bfw = 8, + vid->vl_efw = 8, +#endif +#if 0 + vid->vl_freq = 60; + vid->vl_col = 1024, + vid->vl_row = 600, + vid->vl_width = 1024, + vid->vl_height = 600, + vid->vl_clkp = CONFIG_SYS_HIGH, + vid->vl_hsp = CONFIG_SYS_HIGH, + vid->vl_vsp = CONFIG_SYS_HIGH, + vid->vl_dp = CONFIG_SYS_LOW, + vid->vl_bpix = 32, + + /* AMS701KA AMOLED Panel. */ + vid->vl_hpw = 30, + vid->vl_blw = 114, + vid->vl_elw = 48, + + vid->vl_vpw = 2, + vid->vl_bfw = 6, + vid->vl_efw = 8, +#endif +} + int misc_init_r(void) { #ifdef CONFIG_LCD @@ -1338,20 +1562,19 @@ int misc_init_r(void) else setenv("lcd", "lcd=tl2796-dual"); */ -#endif /* * env values below should be added in case that lcd panel of geminus, * p1 and p2 are enabled at u-boot. * setenv means that lcd panel has been turned on at u-boot. */ -#if 0 if (machine_is_geminus()) setenv("lcd", "lcd=lms480jc01"); + /* if (board_is_p2_real()) setenv("lcd", "lcd=ams701"); + */ #endif - show_hw_revision(); /* Set proper PMIC pins */ diff --git a/drivers/video/s5p-fb.c b/drivers/video/s5p-fb.c index 3e220e9..49ae1ca 100644 --- a/drivers/video/s5p-fb.c +++ b/drivers/video/s5p-fb.c @@ -94,14 +94,6 @@ static void read_image32(char* pImg, int x1pos, int y1pos, int x2pos, /* LCD Panel data */ vidinfo_t panel_info; -struct lcd_panel_operation { - void (*lcd_panel_init)(void); - void (*lcd_panel_power_on)(void); - void (*lcd_panel_enable)(void); -}; - -static struct lcd_panel_operation lcd_calls; - static void s5pc_lcd_init_mem(void *lcdbase, vidinfo_t *vid) { unsigned long palette_size, palette_mem_size; @@ -120,14 +112,6 @@ static void s5pc_lcd_init_mem(void *lcdbase, vidinfo_t *vid) fb_size, (unsigned int)lcd_base, (int)palette_size, (int)palette_mem_size); } -static void s5pc_gpio_setup(void) -{ - if (cpu_is_s5pc100()) - s5pc_c100_gpio_setup(); - else - s5pc_c110_gpio_setup(); -} - static void s5pc_lcd_init(vidinfo_t *vid) { s5pc_fimd_lcd_init(vid); @@ -136,17 +120,17 @@ static void s5pc_lcd_init(vidinfo_t *vid) static void lcd_test(void) { /* red */ - read_image32((char *)lcd_base, 0, 0, 480, 200, + read_image32((char *)lcd_base, 0, 0, 1024, 200, makepixel8888(0, 255, 0, 0)); /* green */ - read_image32((char *)lcd_base, 0, 200, 480, 400, + read_image32((char *)lcd_base, 0, 200, 1024, 400, makepixel8888(0, 0, 255, 0)); /* blue */ - read_image32((char *)lcd_base, 0, 400, 480, 600, + read_image32((char *)lcd_base, 0, 400, 1024, 600, makepixel8888(0, 0, 0, 255)); /* write */ - read_image32((char *)lcd_base, 0, 600, 480, 800, - makepixel8888(0, 255, 255, 255)); + //read_image32((char *)lcd_base, 0, 600, 1024, 800, + // makepixel8888(0, 255, 255, 255)); } int conv_rgb565_to_rgb888(unsigned short rgb565, unsigned int sw) @@ -219,112 +203,41 @@ static void draw_samsung_logo(void* lcdbase) _draw_samsung_logo(lcdbase, x, y, 298, 78, (unsigned short *) logo); } -static void s5pc_init_panel_info(vidinfo_t *vid, struct lcd_panel_operation *calls) +static void lcd_panel_on(vidinfo_t *vid) { - if (vid == NULL) { - printf("lcd info is NULL.\n"); - return; + udelay(vid->init_delay); + + if (vid->cfg_gpio) + vid->cfg_gpio(); + + if (vid->lcd_power_on) { + vid->lcd_power_on(1); } - if (calls == NULL) { - printf("lcd calls is NULL.\n"); - return; + udelay(vid->power_on_delay); + + if (vid->reset_lcd) { + vid->reset_lcd(); } -#if 1 - vid->vl_freq = 60; - vid->vl_col = 480, - vid->vl_row = 800, - vid->vl_width = 480, - vid->vl_height = 800, - vid->vl_clkp = CONFIG_SYS_HIGH, - vid->vl_hsp = CONFIG_SYS_LOW, - vid->vl_vsp = CONFIG_SYS_LOW, - vid->vl_dp = CONFIG_SYS_HIGH, - vid->vl_bpix = 32, - - /* S6E63M0 LCD Panel */ - vid->vl_hpw = 2, /* HLW */ - vid->vl_blw = 16, /* HBP */ - vid->vl_elw = 16, /* HFP */ - - vid->vl_vpw = 2, /* VLW */ - vid->vl_bfw = 3, /* VBP */ - vid->vl_efw = 28, /* VFP */ - - calls->lcd_panel_init = s6e63m0_lcd_panel_init; - calls->lcd_panel_power_on = s6e63m0_lcd_panel_power_on; - calls->lcd_panel_enable = s6e63m0_lcd_panel_enable; -#endif -#if 0 - vid->vl_freq = 60; - vid->vl_col = 480, - vid->vl_row = 800, - vid->vl_width = 480, - vid->vl_height = 800, - vid->vl_clkp = CONFIG_SYS_HIGH, - vid->vl_hsp = CONFIG_SYS_LOW, - vid->vl_vsp = CONFIG_SYS_LOW, - vid->vl_dp = CONFIG_SYS_HIGH, - vid->vl_bpix = 32, - - /* tl2796 panel. */ - vid->vl_hpw = 4, - vid->vl_blw = 8, - vid->vl_elw = 8, - - vid->vl_vpw = 4, - vid->vl_bfw = 8, - vid->vl_efw = 8, - - calls->lcd_panel_init = /* */; - calls->lcd_panel_power_on = /* */; - calls->lcd_panel_enable = /* */; -#endif -#if 0 - vid->vl_freq = 60; - vid->vl_col = 1024, - vid->vl_row = 600, - vid->vl_width = 1024, - vid->vl_height = 600, - vid->vl_clkp = CONFIG_SYS_HIGH, - vid->vl_hsp = CONFIG_SYS_HIGH, - vid->vl_vsp = CONFIG_SYS_HIGH, - vid->vl_dp = CONFIG_SYS_LOW, - vid->vl_bpix = 32, - - /* AMS701KA AMOLED Panel. */ - vid->vl_hpw = 30, - vid->vl_blw = 114, - vid->vl_elw = 48, - - vid->vl_vpw = 2, - vid->vl_bfw = 6, - vid->vl_efw = 8, - - calls->lcd_panel_init = ams701ka_lcd_panel_init; - calls->lcd_panel_power_on = ams701ka_lcd_panel_power_on; - calls->lcd_panel_enable = ams701ka_lcd_panel_enable; -#endif - - panel_width = vid->vl_col; - panel_height = vid->vl_row; -} -static void lcd_panel_on(struct lcd_panel_operation *calls) -{ - if (calls == NULL) { - printf("lcd calls is NULL.\n"); - return ; + udelay(vid->reset_delay); + + if (vid->backlight_on) { + vid->backlight_on(1); } - if (calls->lcd_panel_init) - calls->lcd_panel_init(); - if (calls->lcd_panel_power_on) - calls->lcd_panel_power_on(); - if (calls->lcd_panel_enable) - calls->lcd_panel_enable(); + if (vid->cfg_ldo) { + vid->cfg_ldo(); + } + + if (vid->enable_ldo) { + vid->enable_ldo(1); + } } +/* extern void init_onenand_ext2(void); */ +extern void init_panel_info(vidinfo_t *vid); + void lcd_ctrl_init(void *lcdbase) { char *option; @@ -332,7 +245,10 @@ void lcd_ctrl_init(void *lcdbase) s5pc_lcd_init_mem(lcdbase, &panel_info); /* initialize parameters which is specific to panel. */ - s5pc_init_panel_info(&panel_info, &lcd_calls); + init_panel_info(&panel_info); + + panel_width = panel_info.vl_width; + panel_height = panel_info.vl_height; option = getenv("lcd"); @@ -351,8 +267,6 @@ void lcd_ctrl_init(void *lcdbase) memset(lcdbase, 0, panel_width * panel_height * (32 >> 3)); draw_samsung_logo(lcdbase); - s5pc_gpio_setup(); - s5pc_lcd_init(&panel_info); /* font test */ @@ -362,6 +276,8 @@ void lcd_ctrl_init(void *lcdbase) fb_printf("Test\n"); exit_font(); */ + + /* init_onenand_ext2(); */ } @@ -372,7 +288,7 @@ void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blud) void lcd_enable(void) { - lcd_panel_on((struct lcd_panel_operation *) &lcd_calls); + lcd_panel_on(&panel_info); } ulong calc_fbsize(void) diff --git a/drivers/video/s5p-fimd.c b/drivers/video/s5p-fimd.c index c87e335..4fe1ff8 100644 --- a/drivers/video/s5p-fimd.c +++ b/drivers/video/s5p-fimd.c @@ -32,9 +32,6 @@ #include #include "s5p-fb.h" -/* DISPLAY CONTROL REGISTER */ -#define DCR 0xE0107008 - /* CLOCK DIVIDER 0 */ #define CLK_DIV0 0xE0100300 #define CLK_DIV1 0xE0100304 @@ -58,64 +55,6 @@ void s5pc_fimd_lcd_init_mem(u_long screen_base, u_long fb_size, u_long palette_s return; } -void s5pc_c100_gpio_setup(void) -{ -} - -void s5pc_c110_gpio_setup(void) -{ - unsigned int i; - struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; - - for (i = 0; i < 8; i++) { - /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */ - gpio_cfg_pin(&gpio->gpio_f0, i, GPIO_FUNC(2)); - gpio_cfg_pin(&gpio->gpio_f1, i, GPIO_FUNC(2)); - gpio_cfg_pin(&gpio->gpio_f2, i, GPIO_FUNC(2)); - /* pull-up/down disable */ - gpio_set_pull(&gpio->gpio_f0, i, GPIO_PULL_NONE); - gpio_set_pull(&gpio->gpio_f1, i, GPIO_PULL_NONE); - gpio_set_pull(&gpio->gpio_f2, i, GPIO_PULL_NONE); - - /* drive strength to max (24bit) */ - gpio_set_drv(&gpio->gpio_f0, i, GPIO_DRV_4x); - gpio_set_rate(&gpio->gpio_f0, i, GPIO_DRV_SLOW); - gpio_set_drv(&gpio->gpio_f1, i, GPIO_DRV_4x); - gpio_set_rate(&gpio->gpio_f1, i, GPIO_DRV_SLOW); - gpio_set_drv(&gpio->gpio_f2, i, GPIO_DRV_4x); - gpio_set_rate(&gpio->gpio_f2, i, GPIO_DRV_SLOW); - } - - for (i =0; i < 4; i++) { - /* set GPF3[0:3] for RGB Interface and Data lines (32bit) */ - gpio_cfg_pin(&gpio->gpio_f3, i, GPIO_PULL_UP); - /* pull-up/down disable */ - gpio_set_pull(&gpio->gpio_f3, i, GPIO_PULL_NONE); - /* drive strength to max (24bit) */ - gpio_set_drv(&gpio->gpio_f3, i, GPIO_DRV_4x); - gpio_set_rate(&gpio->gpio_f3, i, GPIO_DRV_SLOW); - } - /* display output path selection (only [1:0] valid) */ - writel(0x2, DCR); - - /* gpio pad configuration for LCD reset. */ - gpio_cfg_pin(&gpio->gpio_mp0_5, 5, GPIO_OUTPUT); - - /* gpio pad configuration for LCD ON. */ - gpio_cfg_pin(&gpio->gpio_j1, 3, GPIO_OUTPUT); - /* gpio_cfg_pin(&gpio->gpio_j1, 4, GPIO_OUTPUT); P1P2: Real: MLCD_ON2 */ - - /* gpio pad configuration for DISPLAY_CS, DISPLAY_CLK, DISPLAY_SO, DISPLAY_SI. */ - gpio_cfg_pin(&gpio->gpio_mp0_1, 1, GPIO_OUTPUT); - gpio_cfg_pin(&gpio->gpio_mp0_4, 1, GPIO_OUTPUT); - gpio_cfg_pin(&gpio->gpio_mp0_4, 2, GPIO_INPUT); - gpio_cfg_pin(&gpio->gpio_mp0_4, 3, GPIO_OUTPUT); - - s5pc1xx_clock_init(); - - return; -} - static void s5pc_fimd_set_par(unsigned int win_id) { unsigned int cfg = 0; @@ -182,6 +121,8 @@ static void s5pc_fimd_set_clock(void) unsigned int cfg = 0, div = 0, mpll_ratio = 0; unsigned long pixel_clock, src_clock, max_clock; + s5pc1xx_clock_init(); + max_clock = 66 * 1000000; pixel_clock = pvid->vl_freq * (pvid->vl_hpw + pvid->vl_blw + @@ -257,7 +198,7 @@ void s5pc_fimc_lcd_off(unsigned int win_id) void s5pc_fimd_lcd_init(vidinfo_t *vid) { - unsigned int cfg = 0, rgb_mode, win_id = 1; + unsigned int cfg = 0, rgb_mode, win_id = 3; /* store panel info to global variable */ pvid = vid; diff --git a/drivers/video/s6e63m0.c b/drivers/video/s6e63m0.c index 2bd23fb..ebe8774 100644 --- a/drivers/video/s6e63m0.c +++ b/drivers/video/s6e63m0.c @@ -44,7 +44,7 @@ struct s5pc110_gpio *gpio = (struct s5pc110_gpio *) S5PC110_GPIO_BASE; #define S5PCFB_C110_SDA_READ gpio_get_value(&gpio->gpio_mp0_4, 3) -const unsigned short SEQ_PANEL_CONDITION_SET[] = { +static const unsigned short SEQ_PANEL_CONDITION_SET[] = { 0xF8, 0x01, DATA_ONLY, 0x27, DATA_ONLY, 0x27, @@ -63,7 +63,7 @@ const unsigned short SEQ_PANEL_CONDITION_SET[] = { ENDDEF, 0x0000 }; -const unsigned short SEQ_DISPLAY_CONDITION_SET[] = { +static const unsigned short SEQ_DISPLAY_CONDITION_SET[] = { 0xf2, 0x02, DATA_ONLY, 0x03, DATA_ONLY, 0x1c, @@ -77,7 +77,7 @@ const unsigned short SEQ_DISPLAY_CONDITION_SET[] = { ENDDEF, 0x0000 }; -const unsigned short SEQ_GAMMA_SETTING[] = { +static const unsigned short SEQ_GAMMA_SETTING[] = { 0xfa, 0x00, DATA_ONLY, 0x17, DATA_ONLY, 0x05, @@ -105,7 +105,7 @@ const unsigned short SEQ_GAMMA_SETTING[] = { ENDDEF, 0x0000 }; -const unsigned short SEQ_ETC_CONDITION_SET[] = { +static const unsigned short SEQ_ETC_CONDITION_SET[] = { 0xf6, 0x00, DATA_ONLY, 0x8c, DATA_ONLY, 0x07, @@ -273,14 +273,20 @@ const unsigned short SEQ_ETC_CONDITION_SET[] = { }; -const unsigned short SEQ_STAND_BY_OFF[] = { +static const unsigned short SEQ_STAND_BY_OFF[] = { 0x11, COMMAND_ONLY, ENDDEF, 0x0000 }; +static const unsigned short SEQ_STAND_BY_ON[] = { + 0x10, COMMAND_ONLY, + + ENDDEF, 0x0000 +}; + /* added */ -const unsigned short SEQ_DISPLAY_ON[] = { +static const unsigned short SEQ_DISPLAY_ON[] = { 0x29, COMMAND_ONLY, ENDDEF, 0x0000 @@ -406,51 +412,29 @@ static void s6e63m0_panel_send_sequence(const unsigned short *wbuf) } } -void s6e63m0_lcd_panel_power_on(void) -{ - char data = 0; - - udelay(25000); - - /* set gpio data for MLCD_ON to HIGH */ - gpio_set_value(&gpio->gpio_j1, 3, 1); - - /* set gpio data for MLCD_RST to HIGH */ - gpio_set_value(&gpio->gpio_mp0_5, 5, 1); - - udelay(120000); +void s6e63m0_lcd_panel_init(void); +void s6e63m0_cfg_ldo(void) +{ + s6e63m0_lcd_panel_init(); /* data = s6e63m0_c110_spi_read_byte(0x0, 0xdd); printf("data = %d, %x\n", data, &data); */ - s6e63m0_panel_send_sequence(SEQ_PANEL_CONDITION_SET); s6e63m0_panel_send_sequence(SEQ_DISPLAY_CONDITION_SET); s6e63m0_panel_send_sequence(SEQ_GAMMA_SETTING); s6e63m0_panel_send_sequence(SEQ_ETC_CONDITION_SET); } -static inline void s6e63m0_c110_panel_hw_reset(void) -{ - /* set gpio pin for MLCD_RST to LOW */ - gpio_set_value(&gpio->gpio_mp0_5, 5, 0); - - /* Shorter than 5 usec */ - udelay(1); - - /* set gpio pin for MLCD_RST to HIGH */ - gpio_set_value(&gpio->gpio_mp0_5, 5, 1); -} - -void s6e63m0_lcd_panel_enable(void) -{ - s6e63m0_panel_send_sequence(SEQ_STAND_BY_OFF); - s6e63m0_panel_send_sequence(SEQ_DISPLAY_ON); -} - -static void s6e63m0_panel_disable(void) +void s6e63m0_enable_ldo(unsigned int onoff) { + if (onoff) { + s6e63m0_panel_send_sequence(SEQ_STAND_BY_OFF); + s6e63m0_panel_send_sequence(SEQ_DISPLAY_ON); + } else { + s6e63m0_panel_send_sequence(SEQ_STAND_BY_ON); + } } void s6e63m0_lcd_panel_init(void) diff --git a/include/lcd.h b/include/lcd.h index 3d8acca..2768443 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -207,6 +207,17 @@ typedef struct vidinfo { u_char vl_vpw; /* Vertical sync pulse width */ u_char vl_bfw; /* Wait before of frame */ u_char vl_efw; /* Wait end of frame */ + + void (*cfg_gpio)(void); + void (*backlight_on)(unsigned int onoff); + void (*reset_lcd)(void); + void (*lcd_power_on)(unsigned int onoff); + void (*cfg_ldo)(void); + void (*enable_ldo)(unsigned int onoff); + + unsigned int init_delay; + unsigned int power_on_delay; + unsigned int reset_delay; } vidinfo_t; #else -- 2.7.4