Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel Mack and committed by
Dmitry Torokhov
25a70e38 09113aea

+28 -3
+19 -3
drivers/input/touchscreen/eeti_ts.c
··· 32 32 #include <linux/i2c.h> 33 33 #include <linux/timer.h> 34 34 #include <linux/gpio.h> 35 + #include <linux/input/eeti_ts.h> 35 36 36 37 static int flip_x; 37 38 module_param(flip_x, bool, 0644); ··· 47 46 struct input_dev *input; 48 47 struct work_struct work; 49 48 struct mutex mutex; 50 - int irq; 49 + int irq, irq_active_high; 51 50 }; 52 51 53 52 #define EETI_TS_BITDEPTH (11) ··· 59 58 #define REPORT_BIT_HAS_PRESSURE (1 << 6) 60 59 #define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH) 61 60 61 + static inline int eeti_ts_irq_active(struct eeti_ts_priv *priv) 62 + { 63 + return gpio_get_value(irq_to_gpio(priv->irq)) == priv->irq_active_high; 64 + } 65 + 62 66 static void eeti_ts_read(struct work_struct *work) 63 67 { 64 68 char buf[6]; ··· 73 67 74 68 mutex_lock(&priv->mutex); 75 69 76 - while (!gpio_get_value(irq_to_gpio(priv->irq)) && --to) 70 + while (eeti_ts_irq_active(priv) && --to) 77 71 i2c_master_recv(priv->client, buf, sizeof(buf)); 78 72 79 73 if (!to) { ··· 146 140 static int __devinit eeti_ts_probe(struct i2c_client *client, 147 141 const struct i2c_device_id *idp) 148 142 { 143 + struct eeti_ts_platform_data *pdata; 149 144 struct eeti_ts_priv *priv; 150 145 struct input_dev *input; 146 + unsigned int irq_flags; 151 147 int err = -ENOMEM; 152 148 153 149 /* In contrast to what's described in the datasheet, there seems ··· 188 180 priv->input = input; 189 181 priv->irq = client->irq; 190 182 183 + pdata = client->dev.platform_data; 184 + 185 + if (pdata) 186 + priv->irq_active_high = pdata->irq_active_high; 187 + 188 + irq_flags = priv->irq_active_high ? 189 + IRQF_TRIGGER_RISING : IRQF_TRIGGER_FALLING; 190 + 191 191 INIT_WORK(&priv->work, eeti_ts_read); 192 192 i2c_set_clientdata(client, priv); 193 193 input_set_drvdata(input, priv); ··· 204 188 if (err) 205 189 goto err1; 206 190 207 - err = request_irq(priv->irq, eeti_ts_isr, IRQF_TRIGGER_FALLING, 191 + err = request_irq(priv->irq, eeti_ts_isr, irq_flags, 208 192 client->name, priv); 209 193 if (err) { 210 194 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
+9
include/linux/input/eeti_ts.h
··· 1 + #ifndef LINUX_INPUT_EETI_TS_H 2 + #define LINUX_INPUT_EETI_TS_H 3 + 4 + struct eeti_ts_platform_data { 5 + unsigned int irq_active_high; 6 + }; 7 + 8 + #endif /* LINUX_INPUT_EETI_TS_H */ 9 +