summaryrefslogtreecommitdiff
path: root/common/lcd.c
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2015-02-03 13:32:32 +0200
committerAnatolij Gustschin <agust@denx.de>2015-02-10 13:31:58 +0100
commit7bf71d1f55d31a81ade8dd0fc72f06e4672689d0 (patch)
tree24b4f3eb0b35b5002131a307d33075ff602e8473 /common/lcd.c
parent033167c4c5a9a31768f690353ce26be021ad9c36 (diff)
downloadu-boot-imx-7bf71d1f55d31a81ade8dd0fc72f06e4672689d0.zip
u-boot-imx-7bf71d1f55d31a81ade8dd0fc72f06e4672689d0.tar.gz
u-boot-imx-7bf71d1f55d31a81ade8dd0fc72f06e4672689d0.tar.bz2
lcd: split splash code into its own function
lcd_logo() currently performs tasks well beyond just displaying the logo. It has code which displays splash image, it has logic which determines when the different display features are displayed, and it is coupled with the lcd console because it holds the responsibility of returning the lcd console base address. Make lcd_logo() just about the logo by: * Moving splash image display code into a dedicated function * Moving the logic regarding when various features are displayed to lcd_clear() (which is arguably not the correct name for housing such code either, but it is currently the most fitting location code wise) * Move the responsibility of setting the console base address to lcd_clear() too. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Bo Shen <voice.shen@atmel.com> Tested-by: Josh Wu <josh.wu@atmel.com> Cc: Bo Shen <voice.shen@atmel.com> Cc: Simon Glass <sjg@chromium.org> Cc: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'common/lcd.c')
-rw-r--r--common/lcd.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/common/lcd.c b/common/lcd.c
index d0c0aff..f33942c 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -46,7 +46,7 @@
DECLARE_GLOBAL_DATA_PTR;
static int lcd_init(void *lcdbase);
-static void *lcd_logo(void);
+static void lcd_logo(void);
static void lcd_setfgcolor(int color);
static void lcd_setbgcolor(int color);
@@ -169,6 +169,9 @@ void lcd_clear(void)
{
short console_rows, console_cols;
int bg_color;
+ char *s;
+ ulong addr;
+ static int do_splash = 1;
#if LCD_BPP == LCD_COLOR8
/* Setting the palette */
lcd_setcolreg(CONSOLE_COLOR_BLACK, 0, 0, 0);
@@ -218,7 +221,23 @@ void lcd_clear(void)
#endif
console_cols = panel_info.vl_col / VIDEO_FONT_WIDTH;
lcd_init_console(lcd_base, console_rows, console_cols);
- lcd_init_console(lcd_logo(), console_rows, console_cols);
+ if (do_splash) {
+ s = getenv("splashimage");
+ if (s) {
+ do_splash = 0;
+ addr = simple_strtoul(s, NULL, 16);
+ if (lcd_splash(addr) == 0) {
+ lcd_sync();
+ return;
+ }
+ }
+ }
+
+ lcd_logo();
+#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
+ addr = (ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length;
+ lcd_init_console((void *)addr, console_rows, console_cols);
+#endif
lcd_sync();
}
@@ -701,29 +720,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
}
#endif
-static void *lcd_logo(void)
+static void lcd_logo(void)
{
-#ifdef CONFIG_SPLASH_SCREEN
- char *s;
- ulong addr;
- static int do_splash = 1;
-
- if (do_splash && (s = getenv("splashimage")) != NULL) {
- int x = 0, y = 0;
- do_splash = 0;
-
- if (splash_screen_prepare())
- return (void *)lcd_base;
-
- addr = simple_strtoul (s, NULL, 16);
-
- splash_get_pos(&x, &y);
-
- if (bmp_display(addr, x, y) == 0)
- return (void *)lcd_base;
- }
-#endif /* CONFIG_SPLASH_SCREEN */
-
lcd_logo_plot(0, 0);
#ifdef CONFIG_LCD_INFO
@@ -731,12 +729,6 @@ static void *lcd_logo(void)
lcd_set_row(LCD_INFO_Y / VIDEO_FONT_HEIGHT);
lcd_show_board_info();
#endif /* CONFIG_LCD_INFO */
-
-#if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO)
- return (void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length);
-#else
- return (void *)lcd_base;
-#endif /* CONFIG_LCD_LOGO && !defined(CONFIG_LCD_INFO_BELOW_LOGO) */
}
#ifdef CONFIG_SPLASHIMAGE_GUARD