diff options
author | Sanchayan Maity <maitysanchayan@gmail.com> | 2016-03-03 09:41:43 +0530 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2016-03-03 11:10:51 -0800 |
commit | d99a7d46fbd1eb3145a81f45bf2dbda7a82189e8 (patch) | |
tree | b10d1533d711ebe55a10894c89a2654249bf5fa1 /drivers/input/touchscreen/fusion_F0710A.c | |
parent | f05c492847ae9ea0810e495078470e4615f339bb (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>
Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Diffstat (limited to 'drivers/input/touchscreen/fusion_F0710A.c')
-rw-r--r-- | drivers/input/touchscreen/fusion_F0710A.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/fusion_F0710A.c b/drivers/input/touchscreen/fusion_F0710A.c index 11e46c3c2977..862725b1332c 100644 --- a/drivers/input/touchscreen/fusion_F0710A.c +++ b/drivers/input/touchscreen/fusion_F0710A.c @@ -89,18 +89,30 @@ 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) { int ret, i; - for(i=0; i<WC_RETRY_COUNT; i++) + for (i = 0; i < WC_RETRY_COUNT; i++) { ret = fusion_F0710A_write_u8(fusion_F0710A_SCAN_COMPLETE, 0); - if(ret == 0) + if (!ret) break; - else - dev_err(&fusion_F0710A.client->dev, "Write complete failed(%d): %d\n", i, ret); + + dev_warn(&fusion_F0710A.client->dev, + "Write complete failed(%d): %d. Resetting controller...\n", i, ret); + fusion_F0710A_reset(); } return ret; @@ -284,14 +296,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"); |