All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/7] video: fbdev: pmag-ba-fb: Optimize Bt455 colormap addressing
Date: Mon, 22 Feb 2016 01:55:27 +0000 (GMT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1602220140470.7431@eddie.linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.20.1602220110330.7431@eddie.linux-mips.org>

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: Maciej W. Rozycki <macro@linux-mips.org>
---
linux-bt455-cmap-addr.diff
Index: linux-20160211-4maxp64/drivers/video/fbdev/bt455.h
===================================================================
--- linux-20160211-4maxp64.orig/drivers/video/fbdev/bt455.h
+++ linux-20160211-4maxp64/drivers/video/fbdev/bt455.h
@@ -30,13 +30,17 @@ static inline void bt455_select_reg(stru
 	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.
  */
-static inline void bt455_read_cmap_entry(struct bt455_regs *regs,
-					 int cr, u8 *grey)
+static inline void bt455_read_cmap_next(struct bt455_regs *regs, u8 *grey)
 {
-	bt455_select_reg(regs, cr);
 	mb();
 	regs->addr_cmap_data;
 	rmb();
@@ -45,10 +49,8 @@ static inline void bt455_read_cmap_entry
 	regs->addr_cmap_data;
 }
 
-static inline void bt455_write_cmap_entry(struct bt455_regs *regs,
-					  int cr, u8 grey)
+static inline void bt455_write_cmap_next(struct bt455_regs *regs, u8 grey)
 {
-	bt455_select_reg(regs, cr);
 	wmb();
 	regs->addr_cmap_data = 0x0;
 	wmb();
@@ -57,10 +59,8 @@ static inline void bt455_write_cmap_entr
 	regs->addr_cmap_data = 0x0;
 }
 
-static inline void bt455_write_ovly_entry(struct bt455_regs *regs,
-					  int cr, u8 grey)
+static inline void bt455_write_ovly_next(struct bt455_regs *regs, u8 grey)
 {
-	bt455_select_reg(regs, cr);
 	wmb();
 	regs->addr_ovly = 0x0;
 	wmb();
@@ -68,3 +68,23 @@ static inline void bt455_write_ovly_entr
 	wmb();
 	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);
+}
Index: linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c
===================================================================
--- linux-20160211-4maxp64.orig/drivers/video/fbdev/pmag-aa-fb.c
+++ linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c
@@ -122,8 +122,8 @@ static int aafb_cursor(struct fb_info *i
 		u8 bg = cursor->image.bg_color ? 0xf : 0x0;
 
 		bt455_write_cmap_entry(par->bt455, 8, bg);
-		bt455_write_cmap_entry(par->bt455, 9, bg);
-		bt455_write_ovly_entry(par->bt455, 0, fg);
+		bt455_write_cmap_next(par->bt455, bg);
+		bt455_write_ovly_next(par->bt455, fg);
 	}
 	if (cursor->set & (FB_CUR_SETSIZE | FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
 		bt431_set_cursor(par->bt431,
@@ -212,7 +212,7 @@ static int pmagaafb_probe(struct device 
 
 	/* Init colormap. */
 	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. */
 	bt431_erase_cursor(par->bt431);

WARNING: multiple messages have this Message-ID (diff)
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/7] video: fbdev: pmag-ba-fb: Optimize Bt455 colormap addressing
Date: Mon, 22 Feb 2016 01:55:27 +0000	[thread overview]
Message-ID: <alpine.LFD.2.20.1602220140470.7431@eddie.linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.20.1602220110330.7431@eddie.linux-mips.org>

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: Maciej W. Rozycki <macro@linux-mips.org>
---
linux-bt455-cmap-addr.diff
Index: linux-20160211-4maxp64/drivers/video/fbdev/bt455.h
=================================--- linux-20160211-4maxp64.orig/drivers/video/fbdev/bt455.h
+++ linux-20160211-4maxp64/drivers/video/fbdev/bt455.h
@@ -30,13 +30,17 @@ static inline void bt455_select_reg(stru
 	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.
  */
-static inline void bt455_read_cmap_entry(struct bt455_regs *regs,
-					 int cr, u8 *grey)
+static inline void bt455_read_cmap_next(struct bt455_regs *regs, u8 *grey)
 {
-	bt455_select_reg(regs, cr);
 	mb();
 	regs->addr_cmap_data;
 	rmb();
@@ -45,10 +49,8 @@ static inline void bt455_read_cmap_entry
 	regs->addr_cmap_data;
 }
 
-static inline void bt455_write_cmap_entry(struct bt455_regs *regs,
-					  int cr, u8 grey)
+static inline void bt455_write_cmap_next(struct bt455_regs *regs, u8 grey)
 {
-	bt455_select_reg(regs, cr);
 	wmb();
 	regs->addr_cmap_data = 0x0;
 	wmb();
@@ -57,10 +59,8 @@ static inline void bt455_write_cmap_entr
 	regs->addr_cmap_data = 0x0;
 }
 
-static inline void bt455_write_ovly_entry(struct bt455_regs *regs,
-					  int cr, u8 grey)
+static inline void bt455_write_ovly_next(struct bt455_regs *regs, u8 grey)
 {
-	bt455_select_reg(regs, cr);
 	wmb();
 	regs->addr_ovly = 0x0;
 	wmb();
@@ -68,3 +68,23 @@ static inline void bt455_write_ovly_entr
 	wmb();
 	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);
+}
Index: linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c
=================================--- linux-20160211-4maxp64.orig/drivers/video/fbdev/pmag-aa-fb.c
+++ linux-20160211-4maxp64/drivers/video/fbdev/pmag-aa-fb.c
@@ -122,8 +122,8 @@ static int aafb_cursor(struct fb_info *i
 		u8 bg = cursor->image.bg_color ? 0xf : 0x0;
 
 		bt455_write_cmap_entry(par->bt455, 8, bg);
-		bt455_write_cmap_entry(par->bt455, 9, bg);
-		bt455_write_ovly_entry(par->bt455, 0, fg);
+		bt455_write_cmap_next(par->bt455, bg);
+		bt455_write_ovly_next(par->bt455, fg);
 	}
 	if (cursor->set & (FB_CUR_SETSIZE | FB_CUR_SETSHAPE | FB_CUR_SETIMAGE))
 		bt431_set_cursor(par->bt431,
@@ -212,7 +212,7 @@ static int pmagaafb_probe(struct device 
 
 	/* Init colormap. */
 	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. */
 	bt431_erase_cursor(par->bt431);

  parent reply	other threads:[~2016-02-22  1:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  1:54 [PATCH 0/7] PMAG-AA frame buffer driver rework Maciej W. Rozycki
2016-02-22  1:54 ` Maciej W. Rozycki
2016-02-22  1:54 ` [PATCH 1/7] video: fbdev: pmag-aa-fb: Adapt to current APIs Maciej W. Rozycki
2016-02-22  1:54   ` Maciej W. Rozycki
2016-02-22  1:55 ` [PATCH 2/7] video: fbdev: pmag-aa-fb: Enable building as a module Maciej W. Rozycki
2016-02-22  1:55   ` Maciej W. Rozycki
2016-02-22  1:55 ` [PATCH 3/7] video: fbdev: pmag-aa-fb: Report video timings Maciej W. Rozycki
2016-02-22  1:55   ` Maciej W. Rozycki
2016-02-22  1:55 ` [PATCH 4/7] video: fbdev: bt455: Remove unneeded colormap helpers for cursor support Maciej W. Rozycki
2016-02-22  1:55   ` Maciej W. Rozycki
2016-02-22  1:55 ` [PATCH 5/7] video: fbdev: pmag-ba-fb: Fix and rework Bt455 colormap handling Maciej W. Rozycki
2016-02-22  1:55   ` Maciej W. Rozycki
2016-02-22  1:55 ` Maciej W. Rozycki [this message]
2016-02-22  1:55   ` [PATCH 6/7] video: fbdev: pmag-ba-fb: Optimize Bt455 colormap addressing Maciej W. Rozycki
2016-02-22  1:55 ` [PATCH 7/7] video: fbdev: bt431: Correct cursor format control macro Maciej W. Rozycki
2016-02-22  1:55   ` Maciej W. Rozycki
2016-02-26 11:15 ` [PATCH 0/7] PMAG-AA frame buffer driver rework Tomi Valkeinen
2016-02-26 11:15   ` Tomi Valkeinen
2016-02-27 22:23   ` Maciej W. Rozycki
2016-02-27 22:23     ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1602220140470.7431@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.