mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Arnd Bergmann <arnd@arndb.de>,
	Daniel Mack <zonque@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Sven Neumann <s.neumann@raumfeld.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>
Subject: [ 30/37] Input: eeti_ts: pass gpio value instead of IRQ
Date: Fri, 17 Aug 2012 04:03:13 +0100	[thread overview]
Message-ID: <20120817030248.551809868@decadent.org.uk> (raw)
In-Reply-To: <20120817030243.807605523@decadent.org.uk>

3.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 4eef6cbfcc03b294d9d334368a851b35b496ce53 upstream.

The EETI touchscreen asserts its IRQ line as soon as it has data in its
internal buffers. The line is automatically deasserted once all data has
been read via I2C. Hence, the driver has to monitor the GPIO line and
cannot simply rely on the interrupt handler reception.

In the current implementation of the driver, irq_to_gpio() is used to
determine the GPIO number from the i2c_client's IRQ value.

As irq_to_gpio() is not available on all platforms, this patch changes
this and makes the driver ignore the passed in IRQ. Instead, a GPIO is
added to the platform_data struct and gpio_to_irq is used to derive the
IRQ from that GPIO. If this fails, bail out. The driver is only able to
work in environments where the touchscreen GPIO can be mapped to an
IRQ.

Without this patch, building raumfeld_defconfig results in:

drivers/input/touchscreen/eeti_ts.c: In function 'eeti_ts_irq_active':
drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio' [-Werror=implicit-function-declaration]

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Sven Neumann <s.neumann@raumfeld.com>
Cc: linux-input@vger.kernel.org
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
[bwh: Backported to 3.2: raumfeld_controller_i2c_board_info.irq was
 initialised using gpio_to_irq(), but this doesn't seem to matter]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/mach-pxa/raumfeld.c        |    2 +-
 drivers/input/touchscreen/eeti_ts.c |   21 +++++++++++++--------
 include/linux/input/eeti_ts.h       |    1 +
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 5905ed1..d89d87ae 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -953,12 +953,12 @@ static struct i2c_board_info raumfeld_connector_i2c_board_info __initdata = {
 
 static struct eeti_ts_platform_data eeti_ts_pdata = {
 	.irq_active_high = 1,
+	.irq_gpio = GPIO_TOUCH_IRQ,
 };
 
 static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
 	.type	= "eeti_ts",
 	.addr	= 0x0a,
-	.irq	= gpio_to_irq(GPIO_TOUCH_IRQ),
 	.platform_data = &eeti_ts_pdata,
 };
 
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 503c709..908407e 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -48,7 +48,7 @@ struct eeti_ts_priv {
 	struct input_dev *input;
 	struct work_struct work;
 	struct mutex mutex;
-	int irq, irq_active_high;
+	int irq_gpio, irq, irq_active_high;
 };
 
 #define EETI_TS_BITDEPTH	(11)
@@ -62,7 +62,7 @@ struct eeti_ts_priv {
 
 static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
 {
-	return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;
+	return gpio_get_value(priv->irq_gpio) == priv->irq_active_high;
 }
 
 static void eeti_ts_read(struct work_struct *work)
@@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
 static int __devinit eeti_ts_probe(struct i2c_client *client,
 				   const struct i2c_device_id *idp)
 {
-	struct eeti_ts_platform_data *pdata;
+	struct eeti_ts_platform_data *pdata = client->dev.platform_data;
 	struct eeti_ts_priv *priv;
 	struct input_dev *input;
 	unsigned int irq_flags;
@@ -199,9 +199,12 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
 
 	priv->client = client;
 	priv->input = input;
-	priv->irq = client->irq;
+	priv->irq_gpio = pdata->irq_gpio;
+	priv->irq = gpio_to_irq(pdata->irq_gpio);
 
-	pdata = client->dev.platform_data;
+	err = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
+	if (err < 0)
+		goto err1;
 
 	if (pdata)
 		priv->irq_active_high = pdata->irq_active_high;
@@ -215,13 +218,13 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
 
 	err = input_register_device(input);
 	if (err)
-		goto err1;
+		goto err2;
 
 	err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
 			  client->name, priv);
 	if (err) {
 		dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-		goto err2;
+		goto err3;
 	}
 
 	/*
@@ -233,9 +236,11 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
 	device_init_wakeup(&client->dev, 0);
 	return 0;
 
-err2:
+err3:
 	input_unregister_device(input);
 	input = NULL; /* so we dont try to free it below */
+err2:
+	gpio_free(pdata->irq_gpio);
 err1:
 	input_free_device(input);
 	kfree(priv);
diff --git a/include/linux/input/eeti_ts.h b/include/linux/input/eeti_ts.h
index f875b31..16625d7 100644
--- a/include/linux/input/eeti_ts.h
+++ b/include/linux/input/eeti_ts.h
@@ -2,6 +2,7 @@
 #define LINUX_INPUT_EETI_TS_H
 
 struct eeti_ts_platform_data {
+	int irq_gpio;
 	unsigned int irq_active_high;
 };
 



  parent reply	other threads:[~2012-08-17  3:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17  3:02 [ 00/37] 3.2.28-stable review Ben Hutchings
2012-08-17  3:02 ` [ 01/37] bnx2: Fix bug in bnx2_free_tx_skbs() Ben Hutchings
2012-08-17  3:02 ` [ 02/37] sch_sfb: Fix missing NULL check Ben Hutchings
2012-08-17  3:02 ` [ 03/37] sctp: Fix list corruption resulting from freeing an association on a list Ben Hutchings
2012-08-17  3:02 ` [ 04/37] caif: Fix access to freed pernet memory Ben Hutchings
2012-08-17  3:02 ` [ 05/37] cipso: dont follow a NULL pointer when setsockopt() is called Ben Hutchings
2012-08-17  3:02 ` [ 06/37] caif: fix NULL pointer check Ben Hutchings
2012-08-17  3:02 ` [ 07/37] wanmain: comparing array with NULL Ben Hutchings
2012-08-17  3:02 ` [ 08/37] tcp: Add TCP_USER_TIMEOUT negative value check Ben Hutchings
2012-08-17  3:02 ` [ 09/37] USB: kaweth.c: use GFP_ATOMIC under spin_lock Ben Hutchings
2012-08-17  3:02 ` [ 10/37] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Ben Hutchings
2012-08-17  3:02 ` [ 11/37] tcp: perform DMA to userspace only if there is a task waiting for it Ben Hutchings
2012-08-17  3:02 ` [ 12/37] net/tun: fix ioctl() based info leaks Ben Hutchings
2012-08-17  3:02 ` [ 13/37] e1000: add dropped DMA receive enable back in for WoL Ben Hutchings
2012-08-17  3:02 ` [ 14/37] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Ben Hutchings
2012-08-17  3:02 ` [ 15/37] hfsplus: fix overflow in sector calculations in hfsplus_submit_bio Ben Hutchings
2012-08-17  3:02 ` [ 16/37] drm/i915: fixup seqno allocation logic for lazy_request Ben Hutchings
2012-08-17  3:03 ` [ 17/37] KVM: VMX: Advertise CPU_BASED_RDPMC_EXITING for nested guests Ben Hutchings
2012-08-17  3:03 ` [ 18/37] mac80211: cancel mesh path timer Ben Hutchings
2012-08-17  3:03 ` [ 19/37] ath9k: Add PID/VID support for AR1111 Ben Hutchings
2012-08-17  3:03 ` [ 20/37] ARM: mxs: Remove MMAP_MIN_ADDR setting from mxs_defconfig Ben Hutchings
2012-08-17  3:03 ` [ 21/37] ALSA: hda - add dock support for Thinkpad T430s Ben Hutchings
2012-08-17  3:03 ` [ 22/37] cfg80211: process pending events when unregistering net device Ben Hutchings
2012-08-17  3:03 ` [ 23/37] rt61pci: fix NULL pointer dereference in config_lna_gain Ben Hutchings
2012-08-17  3:03 ` [ 24/37] iwlwifi: disable greenfield transmissions as a workaround Ben Hutchings
2012-08-17  3:03 ` [ 25/37] ALSA: hda - add dock support for Thinkpad X230 Ben Hutchings
2012-08-17  3:03 ` [ 26/37] e1000e: NIC goes up and immediately goes down Ben Hutchings
2012-08-17  3:03 ` [ 27/37] ALSA: hda - remove quirk for Dell Vostro 1015 Ben Hutchings
2012-08-17  3:03 ` [ 28/37] ALSA: hda - Fix double quirk for Quanta FL1 / Lenovo Ideapad Ben Hutchings
2012-08-17  3:03 ` [ 29/37] ARM: pxa: remove irq_to_gpio from ezx-pcap driver Ben Hutchings
2012-08-17  3:03 ` Ben Hutchings [this message]
2012-08-17  3:03 ` [ 31/37] tun: dont zeroize sock->file on detach Ben Hutchings
2012-08-19 17:13   ` Ben Hutchings
2012-08-17  3:03 ` [ 32/37] drm/i915: correctly order the ring init sequence Ben Hutchings
2012-08-17 23:29   ` Herton Ronaldo Krzesinski
2012-08-18 10:04     ` Daniel Vetter
2012-08-19 14:54       ` Ben Hutchings
2012-08-19 19:00         ` Herton Ronaldo Krzesinski
2012-08-17  3:03 ` [ 33/37] s390/compat: fix compat wrappers for process_vm system calls Ben Hutchings
2012-08-17  3:03 ` [ 34/37] s390/compat: fix mmap compat " Ben Hutchings
2012-08-17  3:03 ` [ 35/37] drm/radeon: fix bank tiling parameters on evergreen Ben Hutchings
2012-08-17  3:03 ` [ 36/37] drm/radeon: fix bank tiling parameters on cayman Ben Hutchings
2012-08-17  3:03 ` [ 37/37] drm/radeon: do not reenable crtc after moving vram start address Ben Hutchings

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=20120817030248.551809868@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.neumann@raumfeld.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=zonque@gmail.com \
    /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

Powered by JetHome