linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/13] FB: sa11x0: convert shannon display enable accesses to use GPIO subsystem
Date: Sat, 04 Feb 2012 09:42:30 +0000	[thread overview]
Message-ID: <E1Rtc8c-0000bB-4w@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20120204093744.GQ889@n2100.arm.linux.org.uk>

Rather than accessing GPSR and GPCR directly, use the GPIO subsystem
instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-sa1100/include/mach/shannon.h |    2 +-
 drivers/video/sa1100fb.c                    |   24 ++++++++++++++++--------
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-sa1100/include/mach/shannon.h b/arch/arm/mach-sa1100/include/mach/shannon.h
index ec27d6e..a0d1114 100644
--- a/arch/arm/mach-sa1100/include/mach/shannon.h
+++ b/arch/arm/mach-sa1100/include/mach/shannon.h
@@ -21,7 +21,7 @@
 #define SHANNON_GPIO_U3_RTS		GPIO_GPIO (19)	/* ?? */
 #define SHANNON_GPIO_U3_CTS		GPIO_GPIO (20)	/* ?? */
 #define SHANNON_GPIO_SENSE_12V		GPIO_GPIO (21)	/* Input, 12v flash unprotect detected */
-#define SHANNON_GPIO_DISP_EN		GPIO_GPIO (22)	/* out */
+#define SHANNON_GPIO_DISP_EN		22		/* out */
 /* XXX GPIO 23 unaccounted for */
 #define SHANNON_GPIO_EJECT_0		GPIO_GPIO (24)	/* in */
 #define SHANNON_IRQ_GPIO_EJECT_0	IRQ_GPIO24
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index f3f55eb..379b2c5 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -173,6 +173,7 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/cpufreq.h>
+#include <linux/gpio.h>
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/mutex.h>
@@ -796,10 +797,8 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi)
 	DBAR2 = fbi->dbar2;
 	LCCR0 |= LCCR0_LEN;
 
-	if (machine_is_shannon()) {
-		GPDR |= SHANNON_GPIO_DISP_EN;
-		GPSR = SHANNON_GPIO_DISP_EN;
-	}
+	if (machine_is_shannon())
+		gpio_set_value(SHANNON_GPIO_DISP_EN, 1);
 
 	dev_dbg(fbi->dev, "DBAR1 = 0x%08lx\n", DBAR1);
 	dev_dbg(fbi->dev, "DBAR2 = 0x%08lx\n", DBAR2);
@@ -815,9 +814,8 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi)
 
 	dev_dbg(fbi->dev, "Disabling LCD controller\n");
 
-	if (machine_is_shannon()) {
-		GPCR = SHANNON_GPIO_DISP_EN;
-	}	
+	if (machine_is_shannon())
+		gpio_set_value(SHANNON_GPIO_DISP_EN, 0);
 
 	set_current_state(TASK_UNINTERRUPTIBLE);
 	add_wait_queue(&fbi->ctrlr_wait, &wait);
@@ -1230,6 +1228,13 @@ static int __devinit sa1100fb_probe(struct platform_device *pdev)
 		goto failed;
 	}
 
+	if (machine_is_shannon()) {
+		ret = gpio_request_one(SHANNON_GPIO_DISP_EN,
+			GPIOF_OUT_INIT_LOW, "display enable");
+		if (ret)
+			goto err_free_irq;
+	}
+
 	/*
 	 * This makes sure that our colour bitfield
 	 * descriptors are correctly initialised.
@@ -1240,7 +1245,7 @@ static int __devinit sa1100fb_probe(struct platform_device *pdev)
 
 	ret = register_framebuffer(&fbi->fb);
 	if (ret < 0)
-		goto err_free_irq;
+		goto err_reg_fb;
 
 #ifdef CONFIG_CPU_FREQ
 	fbi->freq_transition.notifier_call = sa1100fb_freq_transition;
@@ -1252,6 +1257,9 @@ static int __devinit sa1100fb_probe(struct platform_device *pdev)
 	/* This driver cannot be unloaded at the moment */
 	return 0;
 
+ err_reg_fb:
+	if (machine_is_shannon())
+		gpio_free(SHANNON_GPIO_DISP_EN);
  err_free_irq:
 	free_irq(irq, fbi);
  failed:
-- 
1.7.4.4


  parent reply	other threads:[~2012-02-04  9:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-04  9:37 [PATCH 00/13] sa1100fb cleanups Russell King - ARM Linux
2012-02-04  9:38 ` [PATCH 01/13] FB: sa1100: avoid section mismatch warnings Russell King - ARM Linux
2012-02-04  9:38 ` [PATCH 02/13] FB: sa1100: add .owner initializer to driver structure Russell King - ARM Linux
2012-02-04  9:39 ` [PATCH 03/13] FB: sa1100: constify rgb structures Russell King - ARM Linux
2012-02-04  9:39 ` [PATCH 04/13] FB: sa1100: convert printks to dev_xxx() Russell King - ARM Linux
2012-02-04  9:39 ` [PATCH 05/13] FB: sa1100: combine RGB bitfield overrides into sa1100fb_mach_info Russell King - ARM Linux
2012-02-04  9:40 ` [PATCH 06/13] FB: sa1100: move machine inf structures to <video/sa1100fb.h> Russell King - ARM Linux
2012-02-04  9:40 ` [PATCH 07/13] FB: sa1100: move platform data to platform files Russell King - ARM Linux
2012-02-04  9:40 ` [PATCH 08/13] FB: sa1100: remove global sa1100fb_.*_power function pointers Russell King - ARM Linux
2012-02-04  9:41 ` [PATCH 09/13] FB: sa1100: remove assabet specific initialization Russell King - ARM Linux
2012-02-04  9:41 ` [PATCH 10/13] FB: sa1100: use inf members directly Russell King - ARM Linux
2012-02-04  9:41 ` [PATCH 11/13] FB: sa1100: make GPIO configuration setting safe Russell King - ARM Linux
2012-02-04  9:42 ` [PATCH 12/13] FB: sa11x0: fix shannon GPSR/GPCR accesses Russell King - ARM Linux
2012-02-04  9:42 ` Russell King - ARM Linux [this message]
2012-02-19 22:40 ` [PATCH 00/13] sa1100fb cleanups Florian Tobias Schandinat

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=E1Rtc8c-0000bB-4w@rmk-PC.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --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).