summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSanchayan Maity <maitysanchayan@gmail.com>2015-12-17 11:08:46 +0530
committerPhilippe Schenker <philippe.schenker@toradex.com>2020-08-13 16:04:32 +0200
commit8f49cdd7dc3a0e416fe37fe87915806314bebcd4 (patch)
treec6f1ad034f69e33990fdbc1ae0ee4b171f49effe /drivers/input
parent36e6ecb899d9058a349a08261c110fbba470ecc7 (diff)
touchscreen: fusion_F0710A: Reset controller if clear interrupt operation fails
Add support for resetting the controller using the gpio reset pin if interrupt could not be cleared. If clearing the interrupt fails, the interrupt line stays high and no further interrupts are generated resulting in a non functioning touchscreen until next reboot, when we reset the controller again in probe. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com> (cherry picked from commit 5b64e07bc32581ee7e8c12125a0d12209e42923c) (cherry picked from commit 967986fe0f8d685da5108868b60004e51eda89b2) (cherry picked from commit 941e1713315d9b05c630e72c5fdaa8fe74ae2d10)
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/fusion_F0710A.c27
-rw-r--r--drivers/input/touchscreen/fusion_F0710A.h1
2 files changed, 18 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/fusion_F0710A.c b/drivers/input/touchscreen/fusion_F0710A.c
index cf17759fdf04..7ee34f86dcd0 100644
--- a/drivers/input/touchscreen/fusion_F0710A.c
+++ b/drivers/input/touchscreen/fusion_F0710A.c
@@ -89,6 +89,16 @@ bail1:
return ret;
}
+static void fusion_F0710A_reset(void)
+{
+ /* Generate a 0 => 1 edge explicitly, and wait for startup... */
+ gpio_set_value(fusion_F0710A.gpio_reset, 0);
+ msleep(10);
+ gpio_set_value(fusion_F0710A.gpio_reset, 1);
+ /* Wait for startup (up to 125ms according to datasheet) */
+ msleep(125);
+}
+
#define WC_RETRY_COUNT 3
static int fusion_F0710A_write_complete(void)
{
@@ -99,8 +109,11 @@ static int fusion_F0710A_write_complete(void)
ret = fusion_F0710A_write_u8(fusion_F0710A_SCAN_COMPLETE, 0);
if(ret == 0)
break;
- else
- dev_err(&fusion_F0710A.client->dev, "Write complete failed(%d): %d\n", i, ret);
+ else {
+ dev_warn(&fusion_F0710A.client->dev,
+ "Write complete failed(%d): %d. Resetting controller...\n", i, ret);
+ fusion_F0710A_reset();
+ }
}
return ret;
@@ -285,14 +298,8 @@ static int fusion_F0710A_probe(struct i2c_client *i2c, const struct i2c_device_i
if ((gpio_request(pdata->gpio_reset, "Fusion reset") == 0) &&
(gpio_direction_output(pdata->gpio_reset, 1) == 0)) {
-
- /* Generate a 0 => 1 edge explicitly, and wait for startup... */
- gpio_set_value(pdata->gpio_reset, 0);
- msleep(10);
- gpio_set_value(pdata->gpio_reset, 1);
- /* Wait for startup (up to 125ms according to datasheet) */
- msleep(125);
-
+ fusion_F0710A.gpio_reset = pdata->gpio_reset;
+ fusion_F0710A_reset();
gpio_export(pdata->gpio_reset, 0);
} else {
dev_warn(&i2c->dev, "Could not obtain GPIO for Fusion reset\n");
diff --git a/drivers/input/touchscreen/fusion_F0710A.h b/drivers/input/touchscreen/fusion_F0710A.h
index 85f8210345a9..3e5af9e72b78 100644
--- a/drivers/input/touchscreen/fusion_F0710A.h
+++ b/drivers/input/touchscreen/fusion_F0710A.h
@@ -71,6 +71,7 @@ struct fusion_F0710A_data {
struct i2c_client *client;
struct workqueue_struct *workq;
struct input_dev *input;
+ int gpio_reset;
u16 x1;
u16 y1;
u8 z1;