aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/pixcir_i2c_ts.c
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2015-07-06 13:27:43 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-07-11 17:28:27 -0700
commit40929167e6e8450a06501d292c5e5c81455d1c47 (patch)
tree56e123cf07f30e09a2756ead74cf9c9797e7064e /drivers/input/touchscreen/pixcir_i2c_ts.c
parentInput: pixcir_i2c_ts - allow using with GPIO expanders (diff)
downloadlinux-dev-40929167e6e8450a06501d292c5e5c81455d1c47.tar.xz
linux-dev-40929167e6e8450a06501d292c5e5c81455d1c47.zip
Input: pixcir_i2c_ts - add RESET gpio
The controller has a RESET pin which is usually controlled over a GPIO line. If such a GPIO is provided, perform a RESET during probe. Signed-off-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/pixcir_i2c_ts.c')
-rw-r--r--drivers/input/touchscreen/pixcir_i2c_ts.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 5330c0446540..a5a83139aad0 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -36,6 +36,7 @@ struct pixcir_i2c_ts_data {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *gpio_attb;
+ struct gpio_desc *gpio_reset;
const struct pixcir_ts_platform_data *pdata;
bool running;
int max_fingers; /* Max fingers supported in this instance */
@@ -189,6 +190,17 @@ static irqreturn_t pixcir_ts_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void pixcir_reset(struct pixcir_i2c_ts_data *tsdata)
+{
+ if (!IS_ERR_OR_NULL(tsdata->gpio_reset)) {
+ gpiod_set_value_cansleep(tsdata->gpio_reset, 1);
+ ndelay(100); /* datasheet section 1.2.3 says 80ns min. */
+ gpiod_set_value_cansleep(tsdata->gpio_reset, 0);
+ /* wait for controller ready. 100ms guess. */
+ msleep(100);
+ }
+}
+
static int pixcir_set_power_mode(struct pixcir_i2c_ts_data *ts,
enum pixcir_power_mode mode)
{
@@ -529,6 +541,14 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return error;
}
+ tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(tsdata->gpio_reset)) {
+ error = PTR_ERR(tsdata->gpio_reset);
+ dev_err(dev, "Failed to request RESET gpio: %d\n", error);
+ return error;
+ }
+
error = devm_request_threaded_irq(dev, client->irq, NULL, pixcir_ts_isr,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
client->name, tsdata);
@@ -537,6 +557,8 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,
return error;
}
+ pixcir_reset(tsdata);
+
/* Always be in IDLE mode to save power, device supports auto wake */
error = pixcir_set_power_mode(tsdata, PIXCIR_POWER_IDLE);
if (error) {