From aa772afe9f67798ebb802a65d1d95c4083274ea4 Mon Sep 17 00:00:00 2001 From: Klaus Pedersen Date: Fri, 15 Feb 2008 23:31:43 +0200 Subject: [PATCH] tsc2301 - Remove OMAP gpio from ts & kb driver Still need to find a solution to tsc2301-core.c.... Signed-off-by: Klaus Pedersen Signed-off-by: Tony Lindgren --- 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 878efc11210..2682acbf68c 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 3703cd5489b..6308ee51507 100644 --- a/drivers/input/keyboard/tsc2301_kp.c +++ b/drivers/input/keyboard/tsc2301_kp.c @@ -30,10 +30,6 @@ #include #include -#ifdef CONFIG_ARCH_OMAP -#include -#endif - #include #define TSC2301_KEYBOARD_PRODUCT_ID 0x0051 diff --git a/drivers/input/touchscreen/tsc2301_ts.c b/drivers/input/touchscreen/tsc2301_ts.c index 03c1317ccd0..ad8603c28e8 100644 --- a/drivers/input/touchscreen/tsc2301_ts.c +++ b/drivers/input/touchscreen/tsc2301_ts.c @@ -28,10 +28,6 @@ #include #include -#ifdef CONFIG_ARCH_OMAP -#include -#endif - #include /** @@ -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 "); diff --git a/include/linux/spi/tsc2301.h b/include/linux/spi/tsc2301.h index e30d01ddee3..d2c9ddada51 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 -- 2.41.0