Commit 38b550877fd819ce7842b73530dcbacc098c9f0f

Authored by Nikita Kiryanov
Committed by Anatolij Gustschin
1 parent baaa7dd706

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 <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>

Showing 7 changed files with 47 additions and 19 deletions Side-by-side Diff

... ... @@ -383,25 +383,6 @@
383 383 /************************************************************************/
384 384 /* ** Chipset depending Bitmap / Logo stuff... */
385 385 /************************************************************************/
386   -static inline ushort *configuration_get_cmap(void)
387   -{
388   -#if defined CONFIG_CPU_PXA
389   - struct pxafb_info *fbi = &panel_info.pxa;
390   - return (ushort *)fbi->palette;
391   -#elif defined(CONFIG_MPC823)
392   - immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
393   - cpm8xx_t *cp = &(immr->im_cpm);
394   - return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
395   -#elif defined(CONFIG_ATMEL_LCD)
396   - return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
397   -#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB)
398   - return panel_info.cmap;
399   -#elif defined(CONFIG_LCD_LOGO)
400   - return bmp_logo_palette;
401   -#else
402   - return NULL;
403   -#endif
404   -}
405 386  
406 387 #ifdef CONFIG_LCD_LOGO
407 388 void bitmap_plot(int x, int y)
drivers/video/atmel_hlcdfb.c
... ... @@ -13,6 +13,10 @@
13 13 #include <lcd.h>
14 14 #include <atmel_hlcdc.h>
15 15  
  16 +#if defined(CONFIG_LCD_LOGO)
  17 +#include <bmp_logo.h>
  18 +#endif
  19 +
16 20 /* configurable parameters */
17 21 #define ATMEL_LCDC_CVAL_DEFAULT 0xc8
18 22 #define ATMEL_LCDC_DMA_BURST_LEN 8
... ... @@ -35,6 +39,15 @@
35 39 | ((green << LCDC_BASECLUT_GCLUT_Pos) & LCDC_BASECLUT_GCLUT_Msk)
36 40 | ((blue << LCDC_BASECLUT_BCLUT_Pos) & LCDC_BASECLUT_BCLUT_Msk),
37 41 panel_info.mmio + ATMEL_LCDC_LUT(regno));
  42 +}
  43 +
  44 +ushort *configuration_get_cmap(void)
  45 +{
  46 +#if defined(CONFIG_LCD_LOGO)
  47 + return bmp_logo_palette;
  48 +#else
  49 + return NULL;
  50 +#endif
38 51 }
39 52  
40 53 void lcd_ctrl_init(void *lcdbase)
drivers/video/atmel_lcdfb.c
... ... @@ -29,6 +29,11 @@
29 29 #define lcdc_readl(mmio, reg) __raw_readl((mmio)+(reg))
30 30 #define lcdc_writel(mmio, reg, val) __raw_writel((val), (mmio)+(reg))
31 31  
  32 +ushort *configuration_get_cmap(void)
  33 +{
  34 + return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
  35 +}
  36 +
32 37 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
33 38 {
34 39 #if defined(CONFIG_ATMEL_LCD_BGR555)
drivers/video/exynos_fb.c
... ... @@ -37,6 +37,15 @@
37 37 };
38 38 #endif
39 39  
  40 +ushort *configuration_get_cmap(void)
  41 +{
  42 +#if defined(CONFIG_LCD_LOGO)
  43 + return bmp_logo_palette;
  44 +#else
  45 + return NULL;
  46 +#endif
  47 +}
  48 +
40 49 static void exynos_lcd_init_mem(void *lcdbase, vidinfo_t *vid)
41 50 {
42 51 unsigned long palette_size;
drivers/video/mpc8xx_lcd.c
... ... @@ -357,6 +357,13 @@
357 357  
358 358 /*----------------------------------------------------------------------*/
359 359  
  360 +ushort *configuration_get_cmap(void)
  361 +{
  362 + immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  363 + cpm8xx_t *cp = &(immr->im_cpm);
  364 + return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
  365 +}
  366 +
360 367 void lcd_enable (void)
361 368 {
362 369 volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
drivers/video/pxa_lcd.c
... ... @@ -342,6 +342,12 @@
342 342 /* --------------- PXA chipset specific functions ------------------- */
343 343 /************************************************************************/
344 344  
  345 +ushort *configuration_get_cmap(void)
  346 +{
  347 + struct pxafb_info *fbi = &panel_info.pxa;
  348 + return (ushort *)fbi->palette;
  349 +}
  350 +
345 351 void lcd_ctrl_init (void *lcdbase)
346 352 {
347 353 pxafb_init_mem(lcdbase, &panel_info);
... ... @@ -60,7 +60,14 @@
60 60  
61 61 void *priv; /* Pointer to driver-specific data */
62 62 } vidinfo_t;
  63 +
  64 +static __maybe_unused ushort *configuration_get_cmap(void)
  65 +{
  66 + return panel_info.cmap;
  67 +}
63 68 #endif
  69 +
  70 +ushort *configuration_get_cmap(void);
64 71  
65 72 extern vidinfo_t panel_info;
66 73