summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/tsc2007_core.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2021-03-15 16:49:53 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2021-03-15 17:12:02 -0700
commitcee451c9d57ee170f123adacd70391dfb7a0b1a6 (patch)
tree3d4d1d318e37cf3b3716b0ac12927c37b52265f0 /drivers/input/touchscreen/tsc2007_core.c
parentea16ef967ec88bd67466d564d461c3fdf7f85bd9 (diff)
downloadlinux-cee451c9d57ee170f123adacd70391dfb7a0b1a6.tar.bz2
Input: tsc2007 - convert to GPIO descriptors
This converts the driver to use GPIO descriptors. Note that it now uses logical polarity and thus nagation has been dropped. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210314210951.645783-1-andy.shevchenko@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/tsc2007_core.c')
-rw-r--r--drivers/input/touchscreen/tsc2007_core.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/tsc2007_core.c b/drivers/input/touchscreen/tsc2007_core.c
index 3b80abfc1eca..d19c623a73f5 100644
--- a/drivers/input/touchscreen/tsc2007_core.c
+++ b/drivers/input/touchscreen/tsc2007_core.c
@@ -19,11 +19,11 @@
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/gpio/consumer.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/of_device.h>
-#include <linux/of_gpio.h>
#include <linux/platform_data/tsc2007.h>
#include "tsc2007.h"
@@ -226,7 +226,7 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct tsc2007 *ts = i2c_get_clientdata(client);
- return !gpio_get_value(ts->gpio);
+ return gpiod_get_value(ts->gpiod);
}
static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts)
@@ -266,13 +266,14 @@ static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts)
return -EINVAL;
}
- ts->gpio = of_get_gpio(np, 0);
- if (gpio_is_valid(ts->gpio))
+ ts->gpiod = devm_gpiod_get_optional(&client->dev, NULL, GPIOD_IN);
+ if (IS_ERR(ts->gpiod))
+ return PTR_ERR(ts->gpiod);
+
+ if (ts->gpiod)
ts->get_pendown_state = tsc2007_get_pendown_state_gpio;
else
- dev_warn(&client->dev,
- "GPIO not specified in DT (of_get_gpio returned %d)\n",
- ts->gpio);
+ dev_warn(&client->dev, "Pen down GPIO not specified in DT\n");
return 0;
}