Skip to content

Commit 4eef6cb

Browse files
committed
Input: eeti_ts: pass gpio value instead of IRQ
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: stable@vger.kernel.org (v3.2+) 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>
1 parent 59ee93a commit 4eef6cb

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎arch/arm/mach-pxa/raumfeld.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,12 @@ static struct i2c_board_info raumfeld_connector_i2c_board_info __initdata = {
953953

954954
static struct eeti_ts_platform_data eeti_ts_pdata = {
955955
.irq_active_high = 1,
956+
.irq_gpio = GPIO_TOUCH_IRQ,
956957
};
957958

958959
static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
959960
.type = "eeti_ts",
960961
.addr = 0x0a,
961-
.irq = PXA_GPIO_TO_IRQ(GPIO_TOUCH_IRQ),
962962
.platform_data = &eeti_ts_pdata,
963963
};
964964

‎drivers/input/touchscreen/eeti_ts.c‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct eeti_ts_priv {
4848
struct input_dev *input;
4949
struct work_struct work;
5050
struct mutex mutex;
51-
int irq, irq_active_high;
51+
int irq_gpio, irq, irq_active_high;
5252
};
5353

5454
#define EETI_TS_BITDEPTH (11)
@@ -62,7 +62,7 @@ struct eeti_ts_priv {
6262

6363
static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
6464
{
65-
return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;
65+
return gpio_get_value(priv->irq_gpio) == priv->irq_active_high;
6666
}
6767

6868
static void eeti_ts_read(struct work_struct *work)
@@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
157157
static int __devinit eeti_ts_probe(struct i2c_client *client,
158158
const struct i2c_device_id *idp)
159159
{
160-
struct eeti_ts_platform_data *pdata;
160+
struct eeti_ts_platform_data *pdata = client->dev.platform_data;
161161
struct eeti_ts_priv *priv;
162162
struct input_dev *input;
163163
unsigned int irq_flags;
@@ -199,9 +199,12 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
199199

200200
priv->client = client;
201201
priv->input = input;
202-
priv->irq = client->irq;
202+
priv->irq_gpio = pdata->irq_gpio;
203+
priv->irq = gpio_to_irq(pdata->irq_gpio);
203204

204-
pdata = client->dev.platform_data;
205+
err = gpio_request_one(pdata->irq_gpio, GPIOF_IN, client->name);
206+
if (err < 0)
207+
goto err1;
205208

206209
if (pdata)
207210
priv->irq_active_high = pdata->irq_active_high;
@@ -215,13 +218,13 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
215218

216219
err = input_register_device(input);
217220
if (err)
218-
goto err1;
221+
goto err2;
219222

220223
err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
221224
client->name, priv);
222225
if (err) {
223226
dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
224-
goto err2;
227+
goto err3;
225228
}
226229

227230
/*
@@ -233,9 +236,11 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
233236
device_init_wakeup(&client->dev, 0);
234237
return 0;
235238

236-
err2:
239+
err3:
237240
input_unregister_device(input);
238241
input = NULL; /* so we dont try to free it below */
242+
err2:
243+
gpio_free(pdata->irq_gpio);
239244
err1:
240245
input_free_device(input);
241246
kfree(priv);

‎include/linux/input/eeti_ts.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define LINUX_INPUT_EETI_TS_H
33

44
struct eeti_ts_platform_data {
5+
int irq_gpio;
56
unsigned int irq_active_high;
67
};
78

0 commit comments

Comments
 (0)