Commit b3d12e9bca1b23a537d77af2ae019cddc59f2031

Authored by Nikita Kiryanov
Committed by Anatolij Gustschin
1 parent 38b550877f

lcd: atmel: move atmel-specific fb_put_word to atmel_lcdfb

Reduce the amount of platform-specific code in common/lcd.c by moving Atmel
implementation of fb_put_word() to atmel_lcdfb.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 <nikita@compulab.co.il>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Bo Shen <voice.shen@atmel.com>
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 2 changed files with 10 additions and 10 deletions Side-by-side Diff

... ... @@ -642,20 +642,11 @@
642 642 #endif
643 643  
644 644 #if defined(CONFIG_BMP_16BPP)
645   -#if defined(CONFIG_ATMEL_LCD_BGR555)
646   -static inline void fb_put_word(uchar **fb, uchar **from)
  645 +__weak void fb_put_word(uchar **fb, uchar **from)
647 646 {
648   - *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
649   - *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
650   - *from += 2;
651   -}
652   -#else
653   -static inline void fb_put_word(uchar **fb, uchar **from)
654   -{
655 647 *(*fb)++ = *(*from)++;
656 648 *(*fb)++ = *(*from)++;
657 649 }
658   -#endif
659 650 #endif /* CONFIG_BMP_16BPP */
660 651  
661 652 int lcd_display_bitmap(ulong bmp_image, int x, int y)
drivers/video/atmel_lcdfb.c
... ... @@ -34,6 +34,15 @@
34 34 return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
35 35 }
36 36  
  37 +#if defined(CONFIG_BMP_16BPP) && defined(CONFIG_ATMEL_LCD_BGR555)
  38 +void fb_put_word(uchar **fb, uchar **from)
  39 +{
  40 + *(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
  41 + *(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
  42 + *from += 2;
  43 +}
  44 +#endif
  45 +
37 46 void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
38 47 {
39 48 #if defined(CONFIG_ATMEL_LCD_BGR555)