aboutsummaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov2017-02-19 17:21:56 -0800
committerDmitry Torokhov2017-04-05 08:52:33 -0700
commitd99caa472c0a28dc95dd9b98c30ee46f9755181f (patch)
treef4c559efc86cc8d93168714105e9ef8f408eaaa3 /drivers/input
parentd422be5f62ef7986d00afa4cd31eda5534ab7991 (diff)
Input: eeti_ts - switch to gpiod API
gpiod API allows standard way of specifying GPIO polarity and takes it into account when reading or setting GPIO state. It also allows us to switch to common way of obtaining GPIO descriptor and away form legacy platform data. Reviewed-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/eeti_ts.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c
index 3627c7b5f5ec..2facad75eb6d 100644
--- a/drivers/input/touchscreen/eeti_ts.c
+++ b/drivers/input/touchscreen/eeti_ts.c
@@ -31,8 +31,7 @@
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/timer.h>
-#include <linux/gpio.h>
-#include <linux/input/eeti_ts.h>
+#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <asm/unaligned.h>
@@ -47,7 +46,7 @@ MODULE_PARM_DESC(flip_y, "flip y coordinate");
struct eeti_ts {
struct i2c_client *client;
struct input_dev *input;
- int irq_gpio, irq_active_high;
+ struct gpio_desc *attn_gpio;
bool running;
};
@@ -60,11 +59,6 @@ struct eeti_ts {
#define REPORT_BIT_HAS_PRESSURE BIT(6)
#define REPORT_RES_BITS(v) (((v) >> 1) + EETI_TS_BITDEPTH)
-static inline int eeti_ts_irq_active(struct eeti_ts *eeti)
-{
- return gpio_get_value_cansleep(eeti->irq_gpio) == eeti->irq_active_high;
-}
-
static void eeti_ts_report_event(struct eeti_ts *eeti, u8 *buf)
{
unsigned int res;
@@ -115,7 +109,8 @@ static irqreturn_t eeti_ts_isr(int irq, void *dev_id)
/* Motion packet */
eeti_ts_report_event(eeti, buf);
}
- } while (eeti->running && eeti_ts_irq_active(eeti));
+ } while (eeti->running &&
+ eeti->attn_gpio && gpiod_get_value_cansleep(eeti->attn_gpio));
return IRQ_HANDLED;
}
@@ -154,7 +149,6 @@ static int eeti_ts_probe(struct i2c_client *client,
const struct i2c_device_id *idp)
{
struct device *dev = &client->dev;
- struct eeti_ts_platform_data *pdata = dev_get_platdata(dev);
struct eeti_ts *eeti;
struct input_dev *input;
int error;
@@ -191,14 +185,10 @@ static int eeti_ts_probe(struct i2c_client *client,
eeti->client = client;
eeti->input = input;
- eeti->irq_gpio = pdata->irq_gpio;
-
- error = devm_gpio_request_one(dev, pdata->irq_gpio, GPIOF_IN,
- client->name);
- if (error)
- return error;
- eeti->irq_active_high = pdata->irq_active_high;
+ eeti->attn_gpio = devm_gpiod_get_optional(dev, "attn", GPIOD_IN);
+ if (IS_ERR(eeti->attn_gpio))
+ return PTR_ERR(eeti->attn_gpio);
i2c_set_clientdata(client, eeti);
input_set_drvdata(input, eeti);