linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <jhovold@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] atmel_lcdfb: move lcdcon2 register access to compute_hozval
Date: Tue, 05 Feb 2013 13:35:14 +0000	[thread overview]
Message-ID: <1360071315-4032-5-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1360071315-4032-1-git-send-email-jhovold@gmail.com>

Pass atmel_lcd_info structure to compute_hozval and only do the register
access on SOCs that actually use it.

This will also simplify the removal of the cpu_is macros.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
 drivers/video/atmel_lcdfb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 93910e3..347bab2 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -193,14 +193,17 @@ static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
 	.accel		= FB_ACCEL_NONE,
 };
 
-static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2)
+static unsigned long compute_hozval(struct atmel_lcdfb_info *sinfo,
+							unsigned long xres)
 {
+	unsigned long lcdcon2;
 	unsigned long value;
 
 	if (!(cpu_is_at91sam9261() || cpu_is_at91sam9g10()
 		|| cpu_is_at32ap7000()))
 		return xres;
 
+	lcdcon2 = lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2);
 	value = xres;
 	if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) {
 		/* STN display */
@@ -590,8 +593,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
 	lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value);
 
 	/* Horizontal value (aka line size) */
-	hozval_linesz = compute_hozval(info->var.xres,
-					lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2));
+	hozval_linesz = compute_hozval(sinfo, info->var.xres);
 
 	/* Display size */
 	value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET;
-- 
1.8.1.1


  parent reply	other threads:[~2013-02-05 13:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-10 12:28 [PATCH 0/3] atmel_lcdfb: fix 16-bpp regression Johan Hovold
2012-12-10 12:28 ` [PATCH 1/3] atmel_lcdfb: fix 16-bpp modes on older SOCs Johan Hovold
2012-12-10 12:50   ` Peter Korsgaard
2013-01-29 13:54   ` Jean-Christophe PLAGNIOL-VILLARD
2013-01-30 13:26     ` Johan Hovold
2013-02-05 13:35     ` [PATCH 0/5] atmel_lcdfb: regression fixes and cpu_is removal Johan Hovold
2013-02-05 13:35       ` [PATCH 1/5] atmel_lcdfb: fix 16-bpp modes on older SOCs Johan Hovold
2013-02-05 13:35       ` [PATCH 2/5] ARM: at91/neocore926: fix LCD-wiring mode Johan Hovold
2013-02-05 13:35       ` [PATCH 3/5] atmel_lcdfb: remove unsupported 15-bpp mode Johan Hovold
2013-02-05 13:35       ` Johan Hovold [this message]
2013-02-05 13:35       ` [PATCH 5/5] ARM: at91/avr32/atmel_lcdfb: replace cpu_is macros with device-id table Johan Hovold
2013-02-05 20:11         ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-07 15:31           ` [PATCH v2 0/3] ARM: at91/avr32/atmel_lcdfb: remove cpu_is macros Johan Hovold
2013-02-07 15:31             ` [PATCH v2 1/3] ARM: at91/avr32/atmel_lcdfb: add bus-clock entry Johan Hovold
2013-02-07 15:31             ` [PATCH v2 2/3] atmel_lcdfb: move lcdcon2 register access to compute_hozval Johan Hovold
2013-02-07 15:31             ` [PATCH v2 3/3] ARM: at91/avr32/atmel_lcdfb: add platform device-id table Johan Hovold
2012-12-10 12:28 ` [PATCH 2/3] ARM: at91/neocore926: fix LCD-wiring mode Johan Hovold
2012-12-10 12:50   ` Peter Korsgaard
2012-12-10 12:28 ` [PATCH 3/3] atmel_lcdfb: remove unsupported 15-bpp mode Johan Hovold
2012-12-10 12:51   ` Peter Korsgaard
2013-01-26 15:44 ` [PATCH 0/3] atmel_lcdfb: fix 16-bpp regression Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2013-02-08 16:35 [PATCH 0/5] at91: atmel_lcdfb: regression fixes and cpu_is removal Nicolas Ferre
2013-02-08 16:35 ` [PATCH 4/5] atmel_lcdfb: move lcdcon2 register access to compute_hozval Nicolas Ferre

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=1360071315-4032-5-git-send-email-jhovold@gmail.com \
    --to=jhovold@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).