]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/lcd.c
lcd: remove unused includes
[karo-tx-uboot.git] / common / lcd.c
index 47a4f3533b09ab513d5f8acc3a189c9c2e649016..66960c6a6810c2540d66cc5ef71959bd74a17480 100644 (file)
 #include <config.h>
 #include <common.h>
 #include <command.h>
-#include <stdarg.h>
-#include <search.h>
 #include <env_callback.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
-#if defined(CONFIG_POST)
-#include <post.h>
-#endif
 #include <lcd.h>
 #include <watchdog.h>
 #include <asm/unaligned.h>
 #include <asm/unaligned.h>
 #include <fdt_support.h>
 
-#if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
-       defined(CONFIG_CPU_MONAHANS)
-#include <asm/byteorder.h>
-#endif
-
-#if defined(CONFIG_MPC823)
-#include <lcdvideo.h>
-#endif
-
-#if defined(CONFIG_ATMEL_LCD)
-#include <atmel_lcdc.h>
-#endif
-
 #if defined(CONFIG_LCD_DT_SIMPLEFB)
 #include <libfdt.h>
 #endif
@@ -397,67 +379,32 @@ int lcd_getbgcolor(void)
 /************************************************************************/
 
 #ifdef CONFIG_LCD_LOGO
+__weak void lcd_logo_set_cmap(void)
+{
+       int i;
+       ushort *cmap = configuration_get_cmap();
+
+       for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i)
+               *cmap++ = bmp_logo_palette[i];
+}
+
 void bitmap_plot(int x, int y)
 {
-#ifdef CONFIG_ATMEL_LCD
-       uint *cmap = (uint *)bmp_logo_palette;
-#else
-       ushort *cmap = (ushort *)bmp_logo_palette;
-#endif
        ushort i, j;
        uchar *bmap;
        uchar *fb;
        ushort *fb16;
-#if defined(CONFIG_MPC823)
-       immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-       cpm8xx_t *cp = &(immr->im_cpm);
-#endif
        unsigned bpix = NBITS(panel_info.vl_bpix);
 
-       debug("Logo: width %d  height %d  colors %d  cmap %d\n",
-               BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
-               ARRAY_SIZE(bmp_logo_palette));
+       debug("Logo: width %d  height %d  colors %d\n",
+             BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS);
 
        bmap = &bmp_logo_bitmap[0];
        fb   = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
 
        if (bpix < 12) {
-               /* Leave room for default color map
-                * default case: generic system with no cmap (most likely 16bpp)
-                * cmap was set to the source palette, so no change is done.
-                * This avoids even more ifdefs in the next stanza
-                */
-#if defined(CONFIG_MPC823)
-               cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
-#elif defined(CONFIG_ATMEL_LCD)
-               cmap = (uint *)configuration_get_cmap();
-#else
-               cmap = configuration_get_cmap();
-#endif
-
                WATCHDOG_RESET();
-
-               /* Set color map */
-               for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
-                       ushort colreg = bmp_logo_palette[i];
-#ifdef CONFIG_ATMEL_LCD
-                       uint lut_entry;
-#ifdef CONFIG_ATMEL_LCD_BGR555
-                       lut_entry = ((colreg & 0x000F) << 11) |
-                                       ((colreg & 0x00F0) <<  2) |
-                                       ((colreg & 0x0F00) >>  7);
-#else /* CONFIG_ATMEL_LCD_RGB565 */
-                       lut_entry = ((colreg & 0x000F) << 1) |
-                                       ((colreg & 0x00F0) << 3) |
-                                       ((colreg & 0x0F00) << 4);
-#endif
-                       *(cmap + BMP_LOGO_OFFSET) = lut_entry;
-                       cmap++;
-#else /* !CONFIG_ATMEL_LCD */
-                       *cmap++ = colreg;
-#endif /* CONFIG_ATMEL_LCD */
-               }
-
+               lcd_logo_set_cmap();
                WATCHDOG_RESET();
 
                for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
@@ -674,15 +621,27 @@ __weak void fb_put_word(uchar **fb, uchar **from)
 }
 #endif /* CONFIG_BMP_16BPP */
 
-static inline bmp_color_table_entry_t *get_color_table(bmp_image_t *bmp)
+__weak void lcd_set_cmap(bmp_image_t *bmp, unsigned colors)
 {
-       bmp_header_t *bh = &bmp->header;
-       return (void *)bmp + offsetof(bmp_header_t, size) + bh->size;
+       int i;
+       bmp_color_table_entry_t cte;
+       ushort *cmap = configuration_get_cmap();
+
+       for (i = 0; i < colors; ++i) {
+               cte = bmp->color_table[i];
+               *cmap = (((cte.red)   << 8) & 0xf800) |
+                       (((cte.green) << 3) & 0x07e0) |
+                       (((cte.blue)  >> 3) & 0x001f);
+#if defined(CONFIG_MPC823)
+               cmap--;
+#else
+               cmap++;
+#endif
+       }
 }
 
 int lcd_display_bitmap(ulong bmp_image, int x, int y)
 {
-       ushort *cmap = NULL;
        ushort *cmap_base = NULL;
        ushort i, j;
        uchar *fb;
@@ -732,29 +691,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        debug("Display-bmp: %lu x %lu  with %llu colors\n",
                width, height, colors);
 
-       cte = get_color_table(bmp);
-       if (bmp_bpix == 8) {
-               cmap = configuration_get_cmap();
-               cmap_base = cmap;
-
-               /* Set color map */
-               for (i = 0; i < colors; ++i) {
-#if !defined(CONFIG_ATMEL_LCD)
-                       ushort colreg =
-                               ( ((cte[i].red)   << 8) & 0xf800) |
-                               ( ((cte[i].green) << 3) & 0x07e0) |
-                               ( ((cte[i].blue)  >> 3) & 0x001f) ;
-                       *cmap = colreg;
-#if defined(CONFIG_MPC823)
-                       cmap--;
-#else
-                       cmap++;
-#endif
-#else /* CONFIG_ATMEL_LCD */
-                       lcd_setcolreg(i, cte[i].red, cte[i].green, cte[i].blue);
-#endif
-               }
-       }
+       if (bmp_bpix == 8)
+               lcd_set_cmap(bmp, colors);
 
        padded_width = ALIGN(width, 4);
 
@@ -777,6 +715,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        switch (bmp_bpix) {
        case 1: /* pass through */
        case 8: {
+               cmap_base = configuration_get_cmap();
 #ifdef CONFIG_LCD_BMP_RLE8
                u32 compression = get_unaligned_le32(&bmp->header.compression);
                if (compression == BMP_BI_RLE8) {