From 2bd7d1c7a8358f03ae410e392830549d133c464b Mon Sep 17 00:00:00 2001 From: daeinki Date: Thu, 3 Dec 2009 16:34:42 +0900 Subject: [PATCH] s5pc110: fb: updated driver. Signed-off-by: daeinki --- drivers/video/s5p-fb.c | 135 +++++++++++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 55 deletions(-) diff --git a/drivers/video/s5p-fb.c b/drivers/video/s5p-fb.c index 6450f41..ab3206a 100644 --- a/drivers/video/s5p-fb.c +++ b/drivers/video/s5p-fb.c @@ -35,15 +35,6 @@ #include "opening_logo_rgb24_143_44.h" */ -#define PANEL_WIDTH 480 -#define PANEL_HEIGHT 800 -#define S5P_LCD_BPP 32 -/* AMOLED Panel -#define PANEL_WIDTH 1024 -#define PANEL_HEIGHT 600 -#define S5P_LCD_BPP 32 -*/ - extern void tl2796_panel_power_on(void); extern void tl2796_panel_enable(void); extern void tl2796_panel_init(void); @@ -58,6 +49,8 @@ void *lcd_console_address; short console_col; short console_row; +static unsigned int panel_width, panel_height; + static unsigned short makepixel565(char r, char g, char b) { return (unsigned short)(((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)); @@ -77,7 +70,7 @@ static void read_image16(char* pImg, int x1pos, int y1pos, int x2pos, for(i = y1pos; i < y2pos; i++) { for(j = x1pos; j < x2pos; j++) { - offset_s = i * PANEL_WIDTH + j; + offset_s = i * panel_width + j; *(pDst + offset_s) = pixel; } } @@ -92,7 +85,7 @@ static void read_image32(char* pImg, int x1pos, int y1pos, int x2pos, for(i = y1pos; i < y2pos; i++) { for(j = x1pos; j < x2pos; j++) { - offset_s = i * PANEL_WIDTH + j; + offset_s = i * panel_width + j; *(pDst+offset_s) = pixel; } } @@ -100,46 +93,10 @@ static void read_image32(char* pImg, int x1pos, int y1pos, int x2pos, /* LCD Panel data */ vidinfo_t panel_info = { - .vl_col = PANEL_WIDTH, - .vl_row = PANEL_HEIGHT, - .vl_width = PANEL_WIDTH, - .vl_height = PANEL_HEIGHT, - .vl_clkp = CONFIG_SYS_HIGH, - .vl_hsp = CONFIG_SYS_LOW, - .vl_vsp = CONFIG_SYS_LOW, - .vl_dp = CONFIG_SYS_HIGH, - .vl_bpix = S5P_LCD_BPP, .vl_lbw = 0, .vl_splt = 0, .vl_clor = 1, .vl_tft = 1, - - /* S6E63M0 LCD Panel */ - .vl_hpw = 2, - .vl_blw = 16, - .vl_elw = 16, - - .vl_vpw = 2, - .vl_bfw = 3, - .vl_efw = 28, - /* tl2796 panel. - .vl_hpw = 4, - .vl_blw = 8, - .vl_elw = 8, - - .vl_vpw = 4, - .vl_bfw = 8, - .vl_efw = 8, - */ - /* AMS701KA AMOLED Panel - .vl_hpw = 30, - .vl_blw = 114, - .vl_elw = 48, - - .vl_vpw = 2, - .vl_bfw = 6, - .vl_efw = 8, - */ }; static void s5pc_lcd_init_mem(void *lcdbase, vidinfo_t *vid) @@ -223,7 +180,7 @@ void draw_bitmap(void *lcdbase, int x, int y, int w, int h, unsigned long *bmp) for (j = y; j < (y + h); j++) { for (i = x; i < (x + w); i++) - *(fb + (j * PANEL_WIDTH) + i) = *(bmp + k++); + *(fb + (j * panel_width) + i) = *(bmp + k++); } } @@ -240,10 +197,10 @@ void _draw_samsung_logo(void *lcdbase, int x, int y, int w, int h, unsigned shor /* 40 lines under samsung logo image are error range. */ if (j > h + y - error_range) - *(fb + (j * PANEL_WIDTH) + i) = + *(fb + (j * panel_width) + i) = conv_rgb565_to_rgb888(pixel, 1); else - *(fb + (j * PANEL_WIDTH) + i) = + *(fb + (j * panel_width) + i) = conv_rgb565_to_rgb888(pixel, 0); } } @@ -253,12 +210,79 @@ static void draw_samsung_logo(void* lcdbase) { int x, y; - x = (PANEL_WIDTH - 298) / 2; - y = (PANEL_HEIGHT - 78) / 2 - 5; + x = (panel_width - 298) / 2; + y = (panel_height - 78) / 2 - 5; _draw_samsung_logo(lcdbase, x, y, 298, 78, (unsigned short *) logo); } +static void s5pc_init_panel_info(vidinfo_t *vid) +{ +#if 1 + 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 */ +#endif +#if 0 + 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_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 + + panel_width = vid->vl_col; + panel_height = vid->vl_row; +} + static void lcd_panel_on(void) { lcd_panel_init(); @@ -273,6 +297,9 @@ 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); + option = getenv("lcd"); /* @@ -287,7 +314,7 @@ void lcd_ctrl_init(void *lcdbase) } */ - memset(lcdbase, 0, PANEL_WIDTH*PANEL_HEIGHT*S5P_LCD_BPP >> 3); + memset(lcdbase, 0, panel_width * panel_height * (32 >> 3)); draw_samsung_logo(lcdbase); s5pc_gpio_setup(); @@ -323,6 +350,4 @@ void s5pc1xxfb_test(void *lcdbase) { lcd_ctrl_init(lcdbase); lcd_enable(); - - //memcpy(lcdbase, LOGO_RGB24, PANEL_WIDTH*PANEL_HEIGHT*S5P_LCD_BPP >> 3); } -- 2.7.4