public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org, David Brownell <david-b@pacbell.net>,
	David Brownell <dbrownell@users.sourceforge.net>,
	Tony Lindgren <tony@atomide.com>
Subject: [PATCH 2/14] ARM: OMAP: 5912 OSK GPIO updates
Date: Mon, 17 Mar 2008 11:42:26 +0200	[thread overview]
Message-ID: <1205746958-11242-3-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1205746958-11242-2-git-send-email-tony@atomide.com>

From: David Brownell <david-b@pacbell.net>

Start cleaning up GPIO handling for OMAP5912 OSK board:

 - Initialize GPIOs using the cross-platform calls, not the old
   OMAP-private ones.

 - Move touchscreen setup out of ads7846 code into board-specfic
   setup code, where it belongs.

This doesn't depend on the patches to update OMAP to use the
gpiolib implementation framework.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/board-osk.c     |   30 ++++++++++++++-----------
 drivers/input/touchscreen/ads7846.c |   40 -----------------------------------
 2 files changed, 17 insertions(+), 53 deletions(-)

diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 5279e35..dd9ece8 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -198,7 +198,7 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = {
 
 static void __init osk_init_smc91x(void)
 {
-	if ((omap_request_gpio(0)) < 0) {
+	if ((gpio_request(0, "smc_irq")) < 0) {
 		printk("Error requesting gpio 0 for smc91x irq\n");
 		return;
 	}
@@ -210,7 +210,7 @@ static void __init osk_init_smc91x(void)
 static void __init osk_init_cf(void)
 {
 	omap_cfg_reg(M7_1610_GPIO62);
-	if ((omap_request_gpio(62)) < 0) {
+	if ((gpio_request(62, "cf_irq")) < 0) {
 		printk("Error requesting gpio 62 for CF irq\n");
 		return;
 	}
@@ -334,7 +334,7 @@ static struct platform_device *mistral_devices[] __initdata = {
 
 static int mistral_get_pendown_state(void)
 {
-	return !omap_get_gpio_datain(4);
+	return !gpio_get_value(4);
 }
 
 static const struct ads7846_platform_data mistral_ts_info = {
@@ -396,25 +396,31 @@ static void __init osk_mistral_init(void)
 	omap_cfg_reg(W14_1610_CCP_DATAP);
 
 	/* CAM_PWDN */
-	if (omap_request_gpio(11) == 0) {
+	if (gpio_request(11, "cam_pwdn") == 0) {
 		omap_cfg_reg(N20_1610_GPIO11);
-		omap_set_gpio_direction(11, 0 /* out */);
-		omap_set_gpio_dataout(11, 0 /* off */);
+		gpio_direction_output(11, 0);
 	} else
 		pr_debug("OSK+Mistral: CAM_PWDN is awol\n");
 
 
 	/* omap_cfg_reg(P19_1610_GPIO6); */	/* BUSY */
+	gpio_request(6, "ts_busy");
+	gpio_direction_input(6);
+
 	omap_cfg_reg(P20_1610_GPIO4);	/* PENIRQ */
+	gpio_request(4, "ts_int");
+	gpio_direction_input(4);
 	set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING);
+
 	spi_register_board_info(mistral_boardinfo,
 			ARRAY_SIZE(mistral_boardinfo));
 
 	/* the sideways button (SW1) is for use as a "wakeup" button */
 	omap_cfg_reg(N15_1610_MPUIO2);
-	if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
+	if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) {
 		int ret = 0;
-		omap_set_gpio_direction(OMAP_MPUIO(2), 1);
+
+		gpio_direction_input(OMAP_MPUIO(2));
 		set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
 #ifdef	CONFIG_PM
 		/* share the IRQ in case someone wants to use the
@@ -425,7 +431,7 @@ static void __init osk_mistral_init(void)
 				IRQF_SHARED, "mistral_wakeup",
 				&osk_mistral_wake_interrupt);
 		if (ret != 0) {
-			omap_free_gpio(OMAP_MPUIO(2));
+			gpio_free(OMAP_MPUIO(2));
 			printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
 				ret);
 		} else
@@ -438,10 +444,8 @@ static void __init osk_mistral_init(void)
 	 * board, like the touchscreen, EEPROM, and wakeup (!) switch.
 	 */
 	omap_cfg_reg(PWL);
-	if (omap_request_gpio(2) == 0) {
-		omap_set_gpio_direction(2, 0 /* out */);
-		omap_set_gpio_dataout(2, 1 /* on */);
-	}
+	if (gpio_request(2, "lcd_pwr") == 0)
+		gpio_direction_output(2, 1);
 
 	platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices));
 }
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 58934a4..7077090 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -28,13 +28,6 @@
 #include <linux/spi/ads7846.h>
 #include <asm/irq.h>
 
-#ifdef	CONFIG_ARM
-#include <asm/mach-types.h>
-#ifdef	CONFIG_ARCH_OMAP
-#include <asm/arch/gpio.h>
-#endif
-#endif
-
 
 /*
  * This code has been heavily tested on a Nokia 770, and lightly
@@ -1174,31 +1167,6 @@ static struct spi_driver ads7846_driver = {
 
 static int __init ads7846_init(void)
 {
-	/* grr, board-specific init should stay out of drivers!! */
-
-#ifdef	CONFIG_ARCH_OMAP
-	if (machine_is_omap_osk()) {
-		/* GPIO4 = PENIRQ; GPIO6 = BUSY */
-		omap_request_gpio(4);
-		omap_set_gpio_direction(4, 1);
-		omap_request_gpio(6);
-		omap_set_gpio_direction(6, 1);
-	}
-	// also TI 1510 Innovator, bitbanging through FPGA
-	// also Nokia 770
-	// also Palm Tungsten T2
-#endif
-
-	// PXA:
-	// also Dell Axim X50
-	// also HP iPaq H191x/H192x/H415x/H435x
-	// also Intel Lubbock (additional to UCB1400; as temperature sensor)
-	// also Sharp Zaurus C7xx, C8xx (corgi/sheperd/husky)
-
-	// Atmel at91sam9261-EK uses ads7843
-
-	// also various AMD Au1x00 devel boards
-
 	return spi_register_driver(&ads7846_driver);
 }
 module_init(ads7846_init);
@@ -1206,14 +1174,6 @@ module_init(ads7846_init);
 static void __exit ads7846_exit(void)
 {
 	spi_unregister_driver(&ads7846_driver);
-
-#ifdef	CONFIG_ARCH_OMAP
-	if (machine_is_omap_osk()) {
-		omap_free_gpio(4);
-		omap_free_gpio(6);
-	}
-#endif
-
 }
 module_exit(ads7846_exit);
 
-- 
1.5.3.6


  reply	other threads:[~2008-03-17  9:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17  9:42 [PATCH 0/14] Omap patches for post 2.6.25 Tony Lindgren
2008-03-17  9:42 ` [PATCH 1/14] ARM: OMAP: Use gpiolib Tony Lindgren
2008-03-17  9:42   ` Tony Lindgren [this message]
2008-03-17  9:42     ` [PATCH 3/14] ARM: OMAP: I2C: tps65010 driver converts to gpiolib Tony Lindgren
2008-03-17  9:42       ` [PATCH 4/14] ARM: OMAP: Use gpiolib with tps65010 for OSK 5912 Tony Lindgren
2008-03-17  9:42         ` [PATCH 5/14] ARM: OMAP: Clear level-triggered GPIO interrupts in unmask hook Tony Lindgren
2008-03-17  9:42           ` [PATCH 6/14] ARM: OMAP: use edge/level handlers from generic IRQ framework Tony Lindgren
2008-03-17  9:42             ` [PATCH 7/14] ARM: OMAP: Allow registering pin mux function Tony Lindgren
2008-03-17  9:42               ` [PATCH 8/14] ARM: OMAP: Split omap_cfg_reg() into omap processor specific functions Tony Lindgren
2008-03-17  9:42                 ` [PATCH 9/14] ARM: OMAP: Timer32K: Re-organize duplicated 32k-timer code Tony Lindgren
2008-03-17  9:42                   ` [PATCH 10/14] ARM: OMAP: Timer32K: Move 32k-based sched_clock() to common code Tony Lindgren
2008-03-17  9:42                     ` [PATCH 11/14] ARM: OMAP: Timer32K: Move timer32k to mach-omap1 Tony Lindgren
2008-03-17  9:42                       ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up Tony Lindgren
2008-03-17  9:42                         ` [PATCH 13/14] ARM: OMAP: TimerMPU: Remove unused cycles-to-nsec conversions Tony Lindgren
2008-03-17  9:42                           ` [PATCH 14/14] ARM: OMAP: TimerMPU: Remove MPU-timer based sched_clock() Tony Lindgren
2008-03-20 16:52                         ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up Russell King - ARM Linux
2008-03-20 18:25                           ` Kevin Hilman
2008-03-21 11:38                             ` Thomas Gleixner
2008-03-21 12:04                             ` Russell King - ARM Linux
2008-03-25 10:09                               ` [PATCH 12/14] ARM: OMAP1: Timer32K: Fix timer32K for clockevents and clean it up, take #2 Tony Lindgren
2008-03-25 22:16                                 ` Russell King - ARM Linux
2008-03-28 12:26                                   ` Tony Lindgren

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=1205746958-11242-3-git-send-email-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=david-b@pacbell.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.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