[PATCH 09/11] tsc2301 - Remove OMAP gpio from ts & kb driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Still need to find a solution to tsc2301-core.c....

Signed-off-by: Klaus Pedersen <klaus.k.pedersen@xxxxxxxxx>
---
 arch/arm/mach-omap2/board-n800.c       |   26 +++++++++++++++++++-------
 drivers/input/keyboard/tsc2301_kp.c    |    4 ----
 drivers/input/touchscreen/tsc2301_ts.c |   32 +++++---------------------------
 include/linux/spi/tsc2301.h            |    2 +-
 4 files changed, 25 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-omap2/board-n800.c b/arch/arm/mach-omap2/board-n800.c
index 878efc1..2682acb 100644
--- a/arch/arm/mach-omap2/board-n800.c
+++ b/arch/arm/mach-omap2/board-n800.c
@@ -45,6 +45,8 @@
 #define N800_BLIZZARD_POWERDOWN_GPIO	15
 #define N800_STI_GPIO			62
 #define N800_KEYB_IRQ_GPIO		109
+#define N800_DAV_IRQ_GPIO		103
+#define N800_TSC2301_RESET_GPIO		118
 
 void __init nokia_n800_init_irq(void)
 {
@@ -210,8 +212,7 @@ static struct omap_board_config_kernel n800_config[] __initdata = {
 };
 
 static struct tsc2301_platform_data tsc2301_config = {
-	.reset_gpio	= 118,
-	.dav_gpio	= 103,
+	.reset_gpio	= N800_TSC2301_RESET_GPIO,
 	.keymap = {
 		-1,		/* Event for bit 0 */
 		KEY_UP,		/* Event for bit 1 (up) */
@@ -235,14 +236,25 @@ static struct tsc2301_platform_data tsc2301_config = {
 
 static void tsc2301_dev_init(void)
 {
+	int r;
 	int gpio = N800_KEYB_IRQ_GPIO;
 
-	if (omap_request_gpio(gpio) < 0) {
-		printk(KERN_ERR "can't get KBIRQ GPIO\n");
-		return;
+	r = gpio_request(gpio, "tsc2301 KBD IRQ");
+	if (r >= 0) {
+		gpio_direction_input(gpio);
+		tsc2301_config.keyb_int = OMAP_GPIO_IRQ(gpio);
+	} else {
+		printk(KERN_ERR "unable to get KBD GPIO");
+	}
+
+	gpio = N800_DAV_IRQ_GPIO;
+	r = gpio_request(gpio, "tsc2301 DAV IRQ");
+	if (r >= 0) {
+		gpio_direction_input(gpio);
+		tsc2301_config.dav_int = OMAP_GPIO_IRQ(gpio);
+	} else {
+		printk(KERN_ERR "unable to get DAV GPIO");
 	}
-	omap_set_gpio_direction(gpio, 1);
-	tsc2301_config.keyb_int = OMAP_GPIO_IRQ(gpio);
 }
 
 static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
diff --git a/drivers/input/keyboard/tsc2301_kp.c b/drivers/input/keyboard/tsc2301_kp.c
index 3703cd5..6308ee5 100644
--- a/drivers/input/keyboard/tsc2301_kp.c
+++ b/drivers/input/keyboard/tsc2301_kp.c
@@ -30,10 +30,6 @@
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 
-#ifdef CONFIG_ARCH_OMAP
-#include <asm/arch/gpio.h>
-#endif
-
 #include <linux/spi/tsc2301.h>
 
 #define TSC2301_KEYBOARD_PRODUCT_ID      0x0051
diff --git a/drivers/input/touchscreen/tsc2301_ts.c b/drivers/input/touchscreen/tsc2301_ts.c
index 03c1317..ad8603c 100644
--- a/drivers/input/touchscreen/tsc2301_ts.c
+++ b/drivers/input/touchscreen/tsc2301_ts.c
@@ -28,10 +28,6 @@
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 
-#ifdef CONFIG_ARCH_OMAP
-#include <asm/arch/gpio.h>
-#endif
-
 #include <linux/spi/tsc2301.h>
 
 /**
@@ -143,8 +139,6 @@ struct tsc2301_ts {
 	u8			disable_depth;
 
 	int			hw_flags;
-
-	s16			dav_gpio;
 	int			irq;
 };
 
@@ -550,31 +544,22 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc,
 {
 	struct tsc2301_ts *ts;
 	struct input_dev *idev;
-	int dav_gpio, r;
+	int r;
 	int x_max, y_max;
 	int x_fudge, y_fudge, p_fudge;
 
-	if (pdata->dav_gpio < 0) {
-		dev_err(&tsc->spi->dev, "need DAV GPIO");
+	if (pdata->dav_int <= 0) {
+		dev_err(&tsc->spi->dev, "need DAV IRQ");
 		return -EINVAL;
 	}
-	dav_gpio = pdata->dav_gpio;
 
 	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
 	if (ts == NULL)
 		return -ENOMEM;
 	tsc->ts = ts;
 
-	ts->dav_gpio = dav_gpio;
-#ifdef CONFIG_ARCH_OMAP
-	r = omap_request_gpio(dav_gpio);
-	if (r < 0) {
-		dev_err(&tsc->spi->dev, "unable to get DAV GPIO");
-		goto err1;
-	}
-	omap_set_gpio_direction(dav_gpio, 1);
-	ts->irq = OMAP_GPIO_IRQ(dav_gpio);
-#endif
+	ts->irq = pdata->dav_int;
+
 	init_timer(&ts->penup_timer);
 	setup_timer(&ts->penup_timer, tsc2301_ts_timer_handler,
 			(unsigned long)tsc);
@@ -654,10 +639,6 @@ err3:
 	tsc2301_ts_stop_scan(tsc);
 	input_free_device(idev);
 err2:
-#ifdef CONFIG_ARCH_OMAP
-	omap_free_gpio(dav_gpio);
-#endif
-err1:
 	kfree(ts);
 	return r;
 }
@@ -674,9 +655,6 @@ void __devexit tsc2301_ts_exit(struct tsc2301 *tsc)
 	free_irq(ts->irq, tsc);
 	input_unregister_device(ts->idev);
 
-#ifdef CONFIG_ARCH_OMAP
-	omap_free_gpio(ts->dav_gpio);
-#endif
 	kfree(ts);
 }
 MODULE_AUTHOR("Jarkko Oikarinen <jarkko.oikarinen@xxxxxxxxx>");
diff --git a/include/linux/spi/tsc2301.h b/include/linux/spi/tsc2301.h
index e30d01d..d2c9dda 100644
--- a/include/linux/spi/tsc2301.h
+++ b/include/linux/spi/tsc2301.h
@@ -16,7 +16,7 @@ struct tsc2301_platform_data {
 	/*
 	 * Touchscreen
 	 */
-	s16	dav_gpio;
+	s16	dav_int;
 	u16	ts_x_plate_ohm;
 	u32	ts_stab_time;	/* voltage settling time */
 	u8	ts_hw_avg;	/* HW assiseted averaging. Can be
-- 
1.5.3.3

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux