Commit cfcd1c03e44fc22f2146948dc9f341b28e6ec583

Authored by Bo Shen
Committed by Anatolij Gustschin
1 parent d484b52e6f

video: atmel: implement lcd_setcolreg function

implement the common api lcd_setcolreg in include/lcd.h

Signed-off-by: Bo Shen <voice.shen@atmel.com>
[agust: fixed commit log and gcc 4.6 -Wparentheses warnings]
Signed-off-by: Anatolij Gustschin <agust@denx.de>

Showing 2 changed files with 19 additions and 0 deletions Side-by-side Diff

drivers/video/atmel_hlcdfb.c
... ... @@ -51,6 +51,18 @@
51 51 #define lcdc_readl(reg) __raw_readl((reg))
52 52 #define lcdc_writel(reg, val) __raw_writel((val), (reg))
53 53  
  54 +/*
  55 + * the CLUT register map as following
  56 + * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0)
  57 + */
  58 +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
  59 +{
  60 + lcdc_writel(((red << LCDC_BASECLUT_RCLUT_Pos) & LCDC_BASECLUT_RCLUT_Msk)
  61 + | ((green << LCDC_BASECLUT_GCLUT_Pos) & LCDC_BASECLUT_GCLUT_Msk)
  62 + | ((blue << LCDC_BASECLUT_BCLUT_Pos) & LCDC_BASECLUT_BCLUT_Msk),
  63 + panel_info.mmio + ATMEL_LCDC_LUT(regno));
  64 +}
  65 +
54 66 void lcd_ctrl_init(void *lcdbase)
55 67 {
56 68 unsigned long value;
include/atmel_hlcdc.h
... ... @@ -217,6 +217,13 @@
217 217 #define LCDC_BASECFG3_RDEF(value) \
218 218 ((LCDC_BASECFG3_RDEF_Msk & ((value) << LCDC_BASECFG3_RDEF_Pos)))
219 219  
  220 +#define LCDC_BASECLUT_BCLUT_Pos 0
  221 +#define LCDC_BASECLUT_BCLUT_Msk (0xff << LCDC_BASECLUT_BCLUT_Pos)
  222 +#define LCDC_BASECLUT_GCLUT_Pos 8
  223 +#define LCDC_BASECLUT_GCLUT_Msk (0xff << LCDC_BASECLUT_GCLUT_Pos)
  224 +#define LCDC_BASECLUT_RCLUT_Pos 16
  225 +#define LCDC_BASECLUT_RCLUT_Msk (0xff << LCDC_BASECLUT_RCLUT_Pos)
  226 +
220 227 #define LCDC_BASECFG4_DMA (0x1 << 8)
221 228 #define LCDC_BASECFG4_REP (0x1 << 9)
222 229