aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-08-12 03:50:09 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-08-12 04:09:50 -0400
commit25a70e38cd57952b09a013bf070e03705ee4f2ff (patch)
treec82d3c61ccd60b022dd9df7ded927f4591a85f9e /drivers/input/touchscreen
parent09113aea553cfaf074fd669cd0465daac4cea6e8 (diff)
Input: eeti_ts - allow active high irq lines
This adds a struct eeti_ts_platform_data which currently holds only one value to specify the interrupt polarity. The driver has a fallback if no platform data is passed in via the i2c_board_info, so no regression is caused. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/eeti_ts.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 3ab92222a525..9029bd3f34e5 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -32,6 +32,7 @@
32#include <linux/i2c.h> 32#include <linux/i2c.h>
33#include <linux/timer.h> 33#include <linux/timer.h>
34#include <linux/gpio.h> 34#include <linux/gpio.h>
35#include <linux/input/eeti_ts.h>
35 36
36static int flip_x; 37static int flip_x;
37module_param(flip_x, bool, 0644); 38module_param(flip_x, bool, 0644);
@@ -46,7 +47,7 @@ struct eeti_ts_priv {
46 struct input_dev *input; 47 struct input_dev *input;
47 struct work_struct work; 48 struct work_struct work;
48 struct mutex mutex; 49 struct mutex mutex;
49 int irq; 50 int irq, irq_active_high;
50}; 51};
51 52
52#define EETI_TS_BITDEPTH (11) 53#define EETI_TS_BITDEPTH (11)
@@ -58,6 +59,11 @@ struct eeti_ts_priv {
58#define REPORT_BIT_HAS_PRESSURE (1 << 6) 59#define REPORT_BIT_HAS_PRESSURE (1 << 6)
59#define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH) 60#define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH)
60 61
62static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv)
63{
64 return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high;
65}
66
61static void eeti_ts_read(struct work_struct *work) 67static void eeti_ts_read(struct work_struct *work)
62{ 68{
63 char buf[6]; 69 char buf[6];
@@ -67,7 +73,7 @@ static void eeti_ts_read(struct work_struct *work)
67 73
68 mutex_lock(&priv->mutex); 74 mutex_lock(&priv->mutex);
69 75
70 while (!gpio_get_value(irq_to_gpio(priv->irq)) && --to) 76 while (eeti_ts_irq_active(priv) && --to)
71 i2c_master_recv(priv->client, buf, sizeof(buf)); 77 i2c_master_recv(priv->client, buf, sizeof(buf));
72 78
73 if (!to) { 79 if (!to) {
@@ -140,8 +146,10 @@ static void eeti_ts_close(struct input_dev *dev)
140static int __devinit eeti_ts_probe(struct i2c_client *client, 146static int __devinit eeti_ts_probe(struct i2c_client *client,
141 const struct i2c_device_id *idp) 147 const struct i2c_device_id *idp)
142{ 148{
149 struct eeti_ts_platform_data *pdata;
143 struct eeti_ts_priv *priv; 150 struct eeti_ts_priv *priv;
144 struct input_dev *input; 151 struct input_dev *input;
152 unsigned int irq_flags;
145 int err = -ENOMEM; 153 int err = -ENOMEM;
146 154
147 /* In contrast to what's described in the datasheet, there seems 155 /* In contrast to what's described in the datasheet, there seems
@@ -180,6 +188,14 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
180 priv->input = input; 188 priv->input = input;
181 priv->irq = client->irq; 189 priv->irq = client->irq;
182 190
191 pdata = client->dev.platform_data;
192
193 if (pdata)
194 priv->irq_active_high = pdata->irq_active_high;
195
196 irq_flags = priv->irq_active_high ?
197 IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING;
198
183 INIT_WORK(&priv->work, eeti_ts_read); 199 INIT_WORK(&priv->work, eeti_ts_read);
184 i2c_set_clientdata(client, priv); 200 i2c_set_clientdata(client, priv);
185 input_set_drvdata(input, priv); 201 input_set_drvdata(input, priv);
@@ -188,7 +204,7 @@ static int __devinit eeti_ts_probe(struct i2c_client *client,
188 if (err) 204 if (err)
189 goto err1; 205 goto err1;
190 206
191 err = request_irq(priv->irq, eeti_ts_isr, IRQF_TRIGGER_FALLING, 207 err = request_irq(priv->irq, eeti_ts_isr, irq_flags,
192 client->name, priv); 208 client->name, priv);
193 if (err) { 209 if (err) {
194 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); 210 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");