aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-05-24 12:33:36 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-05-24 12:56:47 -0400
commitca1cd36cef00260db6b35b32d863e0c580c0488d (patch)
treeed70919d1e1ee7cdb724462c3ff851baec82e63f
parent7cf432bf0586d6b44eea5d39bb173ce0dab3d1ab (diff)
Input: atmel_mxt_ts - fix reset-gpio for level based irqs
The current reset-gpio support triggers an interrupt storm on platforms using the maxtouch with level based interrupt. The Motorola Droid 4, which I used for some of the tests is not affected, since it uses a edge based interrupt. This change avoids the interrupt storm by enabling the device while its interrupt is disabled. Afterwards we wait 100ms. This is important for two reasons: The device is unresponsive for some time (~22ms for mxt224E) and the CHG (interrupt) line is not working properly for 100ms. We don't need to wait for any following interrupts, since the following mxt_initialize() checks for bootloader mode anyways. This fixes a boot issue on GE PPD (watchdog kills device due to interrupt storm) and does not cause regression on Motorola Droid 4. Fixes: f657b00df22e ("Input: atmel_mxt_ts - add support for reset line") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Reviewed-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 4ac49c6c0006..54fe190fd4bc 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -194,6 +194,8 @@ enum t100_type {
194 194
195/* Delay times */ 195/* Delay times */
196#define MXT_BACKUP_TIME 50 /* msec */ 196#define MXT_BACKUP_TIME 50 /* msec */
197#define MXT_RESET_GPIO_TIME 20 /* msec */
198#define MXT_RESET_INVALID_CHG 100 /* msec */
197#define MXT_RESET_TIME 200 /* msec */ 199#define MXT_RESET_TIME 200 /* msec */
198#define MXT_RESET_TIMEOUT 3000 /* msec */ 200#define MXT_RESET_TIMEOUT 3000 /* msec */
199#define MXT_CRC_TIMEOUT 1000 /* msec */ 201#define MXT_CRC_TIMEOUT 1000 /* msec */
@@ -1208,7 +1210,7 @@ static int mxt_soft_reset(struct mxt_data *data)
1208 return ret; 1210 return ret;
1209 1211
1210 /* Ignore CHG line for 100ms after reset */ 1212 /* Ignore CHG line for 100ms after reset */
1211 msleep(100); 1213 msleep(MXT_RESET_INVALID_CHG);
1212 1214
1213 mxt_acquire_irq(data); 1215 mxt_acquire_irq(data);
1214 1216
@@ -3082,20 +3084,14 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
3082 return error; 3084 return error;
3083 } 3085 }
3084 3086
3087 disable_irq(client->irq);
3088
3085 if (data->reset_gpio) { 3089 if (data->reset_gpio) {
3086 data->in_bootloader = true; 3090 msleep(MXT_RESET_GPIO_TIME);
3087 msleep(MXT_RESET_TIME);
3088 reinit_completion(&data->bl_completion);
3089 gpiod_set_value(data->reset_gpio, 1); 3091 gpiod_set_value(data->reset_gpio, 1);
3090 error = mxt_wait_for_completion(data, &data->bl_completion, 3092 msleep(MXT_RESET_INVALID_CHG);
3091 MXT_RESET_TIMEOUT);
3092 if (error)
3093 return error;
3094 data->in_bootloader = false;
3095 } 3093 }
3096 3094
3097 disable_irq(client->irq);
3098
3099 error = mxt_initialize(data); 3095 error = mxt_initialize(data);
3100 if (error) 3096 if (error)
3101 return error; 3097 return error;