diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-07-25 17:11:34 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-08-21 16:10:19 -0400 |
commit | f657b00df22e231da217ca0162a75db452475e8f (patch) | |
tree | 7db500cba8cc756e8b4f6bb8929e36e0c84dd314 /drivers/input | |
parent | 8cc8446b9b62ef954b630ed30e53bd1553e916a6 (diff) |
Input: atmel_mxt_ts - add support for reset line
Provide support for controlling reset pin. If this is not driven
correctly the device will be held in reset and will not respond.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index aeb46522073a..7659bc48f1db 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
29 | #include <linux/of.h> | 29 | #include <linux/of.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/gpio/consumer.h> | ||
31 | #include <asm/unaligned.h> | 32 | #include <asm/unaligned.h> |
32 | #include <media/v4l2-device.h> | 33 | #include <media/v4l2-device.h> |
33 | #include <media/v4l2-ioctl.h> | 34 | #include <media/v4l2-ioctl.h> |
@@ -300,6 +301,7 @@ struct mxt_data { | |||
300 | u8 multitouch; | 301 | u8 multitouch; |
301 | struct t7_config t7_cfg; | 302 | struct t7_config t7_cfg; |
302 | struct mxt_dbg dbg; | 303 | struct mxt_dbg dbg; |
304 | struct gpio_desc *reset_gpio; | ||
303 | 305 | ||
304 | /* Cached parameters from object table */ | 306 | /* Cached parameters from object table */ |
305 | u16 T5_address; | 307 | u16 T5_address; |
@@ -3133,6 +3135,14 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
3133 | init_completion(&data->reset_completion); | 3135 | init_completion(&data->reset_completion); |
3134 | init_completion(&data->crc_completion); | 3136 | init_completion(&data->crc_completion); |
3135 | 3137 | ||
3138 | data->reset_gpio = devm_gpiod_get_optional(&client->dev, | ||
3139 | "reset", GPIOD_OUT_LOW); | ||
3140 | if (IS_ERR(data->reset_gpio)) { | ||
3141 | error = PTR_ERR(data->reset_gpio); | ||
3142 | dev_err(&client->dev, "Failed to get reset gpio: %d\n", error); | ||
3143 | return error; | ||
3144 | } | ||
3145 | |||
3136 | error = devm_request_threaded_irq(&client->dev, client->irq, | 3146 | error = devm_request_threaded_irq(&client->dev, client->irq, |
3137 | NULL, mxt_interrupt, | 3147 | NULL, mxt_interrupt, |
3138 | pdata->irqflags | IRQF_ONESHOT, | 3148 | pdata->irqflags | IRQF_ONESHOT, |
@@ -3142,6 +3152,18 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
3142 | return error; | 3152 | return error; |
3143 | } | 3153 | } |
3144 | 3154 | ||
3155 | if (data->reset_gpio) { | ||
3156 | data->in_bootloader = true; | ||
3157 | msleep(MXT_RESET_TIME); | ||
3158 | reinit_completion(&data->bl_completion); | ||
3159 | gpiod_set_value(data->reset_gpio, 1); | ||
3160 | error = mxt_wait_for_completion(data, &data->bl_completion, | ||
3161 | MXT_RESET_TIMEOUT); | ||
3162 | if (error) | ||
3163 | return error; | ||
3164 | data->in_bootloader = false; | ||
3165 | } | ||
3166 | |||
3145 | disable_irq(client->irq); | 3167 | disable_irq(client->irq); |
3146 | 3168 | ||
3147 | error = mxt_initialize(data); | 3169 | error = mxt_initialize(data); |