diff mbox

[U-Boot,v4] video: atmel: implement lcd_setcolreg funtion

Message ID 1352365815-24421-1-git-send-email-voice.shen@atmel.com
State Superseded
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Bo Shen Nov. 8, 2012, 9:10 a.m. UTC
implement the common api lce_setcolreg in include/lcd.h

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---
since v3:
  * add magic number
since v2:
  * add this single patch
---
 drivers/video/atmel_hlcdfb.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Marek Vasut Nov. 8, 2012, 1:08 p.m. UTC | #1
Dear Bo Shen,

[...]
> +/*
> + * the CLUT register map as following
> + * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0)
> + */
> +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
> +{
> +	lcdc_writel((red << 16) & 0xff0000 | (green << 8) & 0xff00 |
> +		blue & 0xff, panel_info.mmio + ATMEL_LCDC_LUT(regno));
> +}
> +

Why don't you #define these values instead?

>  void lcd_ctrl_init(void *lcdbase)
>  {
>  	unsigned long value;

Best regards,
Marek Vasut
Bo Shen Nov. 9, 2012, 3:46 a.m. UTC | #2
Hi Marek Vasut,

On 11/8/2012 21:08, Marek Vasut wrote:
> Dear Bo Shen,
>
> [...]
>> +/*
>> + * the CLUT register map as following
>> + * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0)
>> + */
>> +void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
>> +{
>> +	lcdc_writel((red << 16) & 0xff0000 | (green << 8) & 0xff00 |
>> +		blue & 0xff, panel_info.mmio + ATMEL_LCDC_LUT(regno));
>> +}
>> +
>
> Why don't you #define these values instead?

Ok, I will change to use #define.

Thanks,

Best Regards,
Bo Shen
diff mbox

Patch

diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index beb7fa3..8ebde04 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -51,6 +51,16 @@  short console_row;
 #define lcdc_readl(reg)		__raw_readl((reg))
 #define lcdc_writel(reg, val)	__raw_writel((val), (reg))
 
+/*
+ * the CLUT register map as following
+ * RCLUT(24 ~ 16), GCLUT(15 ~ 8), BCLUT(7 ~ 0)
+ */
+void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
+{
+	lcdc_writel((red << 16) & 0xff0000 | (green << 8) & 0xff00 |
+		blue & 0xff, panel_info.mmio + ATMEL_LCDC_LUT(regno));
+}
+
 void lcd_ctrl_init(void *lcdbase)
 {
 	unsigned long value;