From 38b550877fd819ce7842b73530dcbacc098c9f0f Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Tue, 3 Feb 2015 13:32:21 +0200 Subject: lcd: split configuration_get_cmap configuration_get_cmap() is multiple platform-specific functions stuffed into one function. Split it into multiple versions, and move each version to the appropriate driver to reduce the #ifdef complexity. Signed-off-by: Nikita Kiryanov Reviewed-by: Simon Glass Tested-by: Bo Shen Tested-by: Josh Wu Cc: Bo Shen Cc: Simon Glass Cc: Anatolij Gustschin --- drivers/video/mpc8xx_lcd.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/video/mpc8xx_lcd.c') diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c index add7215..9d2e5ed 100644 --- a/drivers/video/mpc8xx_lcd.c +++ b/drivers/video/mpc8xx_lcd.c @@ -357,6 +357,13 @@ lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue) /*----------------------------------------------------------------------*/ +ushort *configuration_get_cmap(void) +{ + immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; + cpm8xx_t *cp = &(immr->im_cpm); + return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); +} + void lcd_enable (void) { volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; -- cgit v1.1 From 27fad01b7fca1ed9ae946ced37c3d4bde828ba14 Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Tue, 3 Feb 2015 13:32:23 +0200 Subject: lcd: mpc8xx: move mpc823-specific fb_put_byte to mpc8xx_lcd.c Reduce the amount of platform-specific code in common/lcd.c by moving MPC823 implementation of fb_put_byte() to mpc8xx_lcd.c. Since we must also have a default implementation for everybody else, make the remainder of the code into a weak function. Signed-off-by: Nikita Kiryanov Reviewed-by: Simon Glass Tested-by: Bo Shen Tested-by: Josh Wu Cc: Simon Glass Cc: Anatolij Gustschin --- drivers/video/mpc8xx_lcd.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/video/mpc8xx_lcd.c') diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c index 9d2e5ed..190c05a 100644 --- a/drivers/video/mpc8xx_lcd.c +++ b/drivers/video/mpc8xx_lcd.c @@ -364,6 +364,13 @@ ushort *configuration_get_cmap(void) return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); } +#if defined(CONFIG_MPC823) +void fb_put_byte(uchar **fb, uchar **from) +{ + *(*fb)++ = (255 - *(*from)++); +} +#endif + void lcd_enable (void) { volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; -- cgit v1.1 From 0ee261f6d3f387a33687bff29342e9321e2f8194 Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Tue, 3 Feb 2015 13:32:25 +0200 Subject: lcd: mpc823: move mpc823-specific lcd_logo_set_cmap code to mpc8xx_lcd.c Reduce the bitmap_plot #ifdef complexity by extracting MPC823-specific code for setting cmap into its own implementation of lcd_logo_set_cmap(), implemented in mpc8xx_lcd.c. In the MPC823 implementation, ARRAY_SIZE(bmp_logo_palette) is switched for BMP_LOGO_COLORS to avoid having to include bmp_logo_data.h, which would cause a compilation error because the logo data and palette arrays would be defined twice. This is a step towards cleaning bitmap_plot() of platform-specific code. Signed-off-by: Nikita Kiryanov Reviewed-by: Simon Glass Tested-by: Bo Shen Tested-by: Josh Wu Cc: Simon Glass Cc: Anatolij Gustschin --- drivers/video/mpc8xx_lcd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/video/mpc8xx_lcd.c') diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c index 190c05a..faa58c0 100644 --- a/drivers/video/mpc8xx_lcd.c +++ b/drivers/video/mpc8xx_lcd.c @@ -371,6 +371,21 @@ void fb_put_byte(uchar **fb, uchar **from) } #endif +#ifdef CONFIG_LCD_LOGO +#include +void lcd_logo_set_cmap(void) +{ + int i; + ushort *cmap; + immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; + cpm8xx_t *cp = &(immr->im_cpm); + cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); + + for (i = 0; i < BMP_LOGO_COLORS; ++i) + *cmap++ = bmp_logo_palette[i]; +} +#endif + void lcd_enable (void) { volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; -- cgit v1.1