Commit 5832706e authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by Tomi Valkeinen

video: fbdev: pmag-ba-fb: Optimize Bt455 colormap addressing

Use the address autoincrement feature when accessing successive palette
entries and also skip loading a palette address in overlay register
assesses which do not use that address.  Provide a red/green/blue
register sequencer reset helper for use in overlay register assesses
where the state of the sequencer is not known.

References:

[1] "Bt454 Bt455 170 MHz Monolithic CMOS 16 Color Palette RAMDAC",
    Brooktree Corporation, Document Number: L454001, Rev. I
Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 01ac59c3
...@@ -30,13 +30,17 @@ static inline void bt455_select_reg(struct bt455_regs *regs, int ir) ...@@ -30,13 +30,17 @@ static inline void bt455_select_reg(struct bt455_regs *regs, int ir)
regs->addr_cmap = ir & 0x0f; regs->addr_cmap = ir & 0x0f;
} }
static inline void bt455_reset_reg(struct bt455_regs *regs)
{
mb();
regs->addr_clr = 0;
}
/* /*
* Read/write to a Bt455 color map register. * Read/write to a Bt455 color map register.
*/ */
static inline void bt455_read_cmap_entry(struct bt455_regs *regs, static inline void bt455_read_cmap_next(struct bt455_regs *regs, u8 *grey)
int cr, u8 *grey)
{ {
bt455_select_reg(regs, cr);
mb(); mb();
regs->addr_cmap_data; regs->addr_cmap_data;
rmb(); rmb();
...@@ -45,10 +49,8 @@ static inline void bt455_read_cmap_entry(struct bt455_regs *regs, ...@@ -45,10 +49,8 @@ static inline void bt455_read_cmap_entry(struct bt455_regs *regs,
regs->addr_cmap_data; regs->addr_cmap_data;
} }
static inline void bt455_write_cmap_entry(struct bt455_regs *regs, static inline void bt455_write_cmap_next(struct bt455_regs *regs, u8 grey)
int cr, u8 grey)
{ {
bt455_select_reg(regs, cr);
wmb(); wmb();
regs->addr_cmap_data = 0x0; regs->addr_cmap_data = 0x0;
wmb(); wmb();
...@@ -57,10 +59,8 @@ static inline void bt455_write_cmap_entry(struct bt455_regs *regs, ...@@ -57,10 +59,8 @@ static inline void bt455_write_cmap_entry(struct bt455_regs *regs,
regs->addr_cmap_data = 0x0; regs->addr_cmap_data = 0x0;
} }
static inline void bt455_write_ovly_entry(struct bt455_regs *regs, static inline void bt455_write_ovly_next(struct bt455_regs *regs, u8 grey)
int cr, u8 grey)
{ {
bt455_select_reg(regs, cr);
wmb(); wmb();
regs->addr_ovly = 0x0; regs->addr_ovly = 0x0;
wmb(); wmb();
...@@ -68,3 +68,23 @@ static inline void bt455_write_ovly_entry(struct bt455_regs *regs, ...@@ -68,3 +68,23 @@ static inline void bt455_write_ovly_entry(struct bt455_regs *regs,
wmb(); wmb();
regs->addr_ovly = 0x0; regs->addr_ovly = 0x0;
} }
static inline void bt455_read_cmap_entry(struct bt455_regs *regs,
int cr, u8 *grey)
{
bt455_select_reg(regs, cr);
bt455_read_cmap_next(regs, grey);
}
static inline void bt455_write_cmap_entry(struct bt455_regs *regs,
int cr, u8 grey)
{
bt455_select_reg(regs, cr);
bt455_write_cmap_next(regs, grey);
}
static inline void bt455_write_ovly_entry(struct bt455_regs *regs, u8 grey)
{
bt455_reset_reg(regs);
bt455_write_ovly_next(regs, grey);
}
...@@ -122,8 +122,8 @@ static int aafb_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -122,8 +122,8 @@ static int aafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
u8 bg = cursor->image.bg_color ? 0xf : 0x0; u8 bg = cursor->image.bg_color ? 0xf : 0x0;
bt455_write_cmap_entry(par->bt455, 8, bg); bt455_write_cmap_entry(par->bt455, 8, bg);
bt455_write_cmap_entry(par->bt455, 9, bg); bt455_write_cmap_next(par->bt455, bg);
bt455_write_ovly_entry(par->bt455, 0, fg); bt455_write_ovly_next(par->bt455, fg);
} }
if (cursor->set & (FB_CUR_SETSIZE | FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) if (cursor->set & (FB_CUR_SETSIZE | FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
bt431_set_cursor(par->bt431, bt431_set_cursor(par->bt431,
...@@ -212,7 +212,7 @@ static int pmagaafb_probe(struct device *dev) ...@@ -212,7 +212,7 @@ static int pmagaafb_probe(struct device *dev)
/* Init colormap. */ /* Init colormap. */
bt455_write_cmap_entry(par->bt455, 0, 0x0); bt455_write_cmap_entry(par->bt455, 0, 0x0);
bt455_write_cmap_entry(par->bt455, 1, 0xf); bt455_write_cmap_next(par->bt455, 0xf);
/* Init hardware cursor. */ /* Init hardware cursor. */
bt431_erase_cursor(par->bt431); bt431_erase_cursor(par->bt431);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment