diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2016-02-22 01:55:21 +0000 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-02-26 13:06:11 +0200 |
commit | 01ac59c34420d5807724a5bb21c1464e6dfb7a92 (patch) | |
tree | 3fa78bdc46ec0b5afbc3854ba9ef7a917fbf5305 /drivers/video | |
parent | e26d682e929d2e4141a4e08d7acc320896289b62 (diff) | |
download | linux-01ac59c34420d5807724a5bb21c1464e6dfb7a92.tar.bz2 |
video: fbdev: pmag-ba-fb: Fix and rework Bt455 colormap handling
The Bt455 is a greyscale RAMDAC, using the green color palette entries
only while still providing registers for the red and blue components,
all the three of which have to be loaded on palette updates. Chip
documentation [1] mandates that the unused red and blue registers are
written with 0.
Therefore update code to follow this requirement and given that it makes
the red and blue components unusable remove them from internal API calls
altogether.
References:
[1] "Bt454 Bt455 170 MHz Monolithic CMOS 16 Color Palette RAMDAC",
Brooktree Corporation, Document Number: L454001, Rev. I
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/bt455.h | 31 | ||||
-rw-r--r-- | drivers/video/fbdev/pmag-aa-fb.c | 12 |
2 files changed, 22 insertions, 21 deletions
diff --git a/drivers/video/fbdev/bt455.h b/drivers/video/fbdev/bt455.h index 9d584f99867b..a4bba5a49d77 100644 --- a/drivers/video/fbdev/bt455.h +++ b/drivers/video/fbdev/bt455.h @@ -2,6 +2,7 @@ * linux/drivers/video/bt455.h * * Copyright 2003 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> + * Copyright 2016 Maciej W. Rozycki <macro@linux-mips.org> * * This file is subject to the terms and conditions of the GNU General * Public License. See the file COPYING in the main directory of this @@ -32,38 +33,38 @@ static inline void bt455_select_reg(struct bt455_regs *regs, int ir) /* * Read/write to a Bt455 color map register. */ -static inline void bt455_read_cmap_entry(struct bt455_regs *regs, int cr, - u8* red, u8* green, u8* blue) +static inline void bt455_read_cmap_entry(struct bt455_regs *regs, + int cr, u8 *grey) { bt455_select_reg(regs, cr); mb(); - *red = regs->addr_cmap_data & 0x0f; + regs->addr_cmap_data; rmb(); - *green = regs->addr_cmap_data & 0x0f; + *grey = regs->addr_cmap_data & 0xf; rmb(); - *blue = regs->addr_cmap_data & 0x0f; + regs->addr_cmap_data; } -static inline void bt455_write_cmap_entry(struct bt455_regs *regs, int cr, - u8 red, u8 green, u8 blue) +static inline void bt455_write_cmap_entry(struct bt455_regs *regs, + int cr, u8 grey) { bt455_select_reg(regs, cr); wmb(); - regs->addr_cmap_data = red & 0x0f; + regs->addr_cmap_data = 0x0; wmb(); - regs->addr_cmap_data = green & 0x0f; + regs->addr_cmap_data = grey & 0xf; wmb(); - regs->addr_cmap_data = blue & 0x0f; + regs->addr_cmap_data = 0x0; } -static inline void bt455_write_ovly_entry(struct bt455_regs *regs, int cr, - u8 red, u8 green, u8 blue) +static inline void bt455_write_ovly_entry(struct bt455_regs *regs, + int cr, u8 grey) { bt455_select_reg(regs, cr); wmb(); - regs->addr_ovly = red & 0x0f; + regs->addr_ovly = 0x0; wmb(); - regs->addr_ovly = green & 0x0f; + regs->addr_ovly = grey & 0xf; wmb(); - regs->addr_ovly = blue & 0x0f; + regs->addr_ovly = 0x0; } diff --git a/drivers/video/fbdev/pmag-aa-fb.c b/drivers/video/fbdev/pmag-aa-fb.c index def86f7d412f..6f4466c39529 100644 --- a/drivers/video/fbdev/pmag-aa-fb.c +++ b/drivers/video/fbdev/pmag-aa-fb.c @@ -121,9 +121,9 @@ static int aafb_cursor(struct fb_info *info, struct fb_cursor *cursor) u8 fg = cursor->image.fg_color ? 0xf : 0x0; u8 bg = cursor->image.bg_color ? 0xf : 0x0; - bt455_write_cmap_entry(par->bt455, 8, 0, bg, 0); - bt455_write_cmap_entry(par->bt455, 9, 0, bg, 0); - bt455_write_ovly_entry(par->bt455, 0, 0, fg, 0); + bt455_write_cmap_entry(par->bt455, 8, bg); + bt455_write_cmap_entry(par->bt455, 9, bg); + bt455_write_ovly_entry(par->bt455, 0, fg); } if (cursor->set & (FB_CUR_SETSIZE | FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) bt431_set_cursor(par->bt431, @@ -143,7 +143,7 @@ static int aafb_blank(int blank, struct fb_info *info) struct aafb_par *par = info->par; u8 val = blank ? 0x00 : 0x0f; - bt455_write_cmap_entry(par->bt455, 1, val, val, val); + bt455_write_cmap_entry(par->bt455, 1, val); return 0; } @@ -211,8 +211,8 @@ static int pmagaafb_probe(struct device *dev) info->screen_size = info->fix.smem_len; /* Init colormap. */ - bt455_write_cmap_entry(par->bt455, 0, 0x00, 0x00, 0x00); - bt455_write_cmap_entry(par->bt455, 1, 0x0f, 0x0f, 0x0f); + bt455_write_cmap_entry(par->bt455, 0, 0x0); + bt455_write_cmap_entry(par->bt455, 1, 0xf); /* Init hardware cursor. */ bt431_erase_cursor(par->bt431); |