diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2015-02-03 13:32:24 +0200 |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2015-02-10 13:27:28 +0100 |
commit | a02e9481396bbd831d9bd970515f277de516fa28 (patch) | |
tree | 7a25c98d7723dc4d5e56e0bfd7db288ac9c7cac0 /drivers/video | |
parent | 27fad01b7fca1ed9ae946ced37c3d4bde828ba14 (diff) | |
download | u-boot-imx-a02e9481396bbd831d9bd970515f277de516fa28.zip u-boot-imx-a02e9481396bbd831d9bd970515f277de516fa28.tar.gz u-boot-imx-a02e9481396bbd831d9bd970515f277de516fa28.tar.bz2 |
lcd: atmel: introduce lcd_logo_set_cmap
Reduce the bitmap_plot #ifdef complexity by extracting Atmel-specific code for
setting cmap into a new function lcd_logo_set_cmap(), which is implemented in
atmel_lcdfb driver and defined as part of common/lcd.c api with a weak dummy
version. In the Atmel 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 <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 'drivers/video')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index c7991cd..2a71eba 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -43,6 +43,32 @@ void fb_put_word(uchar **fb, uchar **from) } #endif +#ifdef CONFIG_LCD_LOGO +#include <bmp_logo.h> +void lcd_logo_set_cmap(void) +{ + int i; + uint lut_entry; + ushort colreg; + uint *cmap = (uint *)configuration_get_cmap(); + + for (i = 0; i < BMP_LOGO_COLORS; ++i) { + colreg = bmp_logo_palette[i]; +#ifdef CONFIG_ATMEL_LCD_BGR555 + lut_entry = ((colreg & 0x000F) << 11) | + ((colreg & 0x00F0) << 2) | + ((colreg & 0x0F00) >> 7); +#else + lut_entry = ((colreg & 0x000F) << 1) | + ((colreg & 0x00F0) << 3) | + ((colreg & 0x0F00) << 4); +#endif + *(cmap + BMP_LOGO_OFFSET) = lut_entry; + cmap++; + } +} +#endif + void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) { #if defined(CONFIG_ATMEL_LCD_BGR555) |