Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips
PATCH 1/3 Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips
The delay before the chip can be accessed after reset varies between different chips in maXTouch family. Waiting for 200ms and then monitoring the CHG (chip is ready when the line is low) is guaranteed to work with all chips.
--- drivers/input/touchscreen/atmel_mxt_ts.c | 4 +++- include/linux/i2c/atmel_mxt_ts.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-)
drivers/input/touchscreen/atmel_mxt_ts.c +3 -1
@@ -170,7 +170,7 @@#define MXT_BOOT_VALUE 0xa5#define MXT_BACKUP_VALUE 0x55#define MXT_BACKUP_TIME 25/* msec */ -#define MXT_RESET_TIME 65/* msec */ +#define MXT_RESET_TIME 200/* msec */ #define MXT_FWRESET_TIME 175/* msec */
@@ -828,6 +828,8 @@ static int mxt_initialize(struct mxt_data *data)mxt_write_object (data,MXT_GEN_COMMAND ,MXT_COMMAND_RESET ,1 );msleep (MXT_RESET_TIME ); +while (data->pdata->read_chg ()) +msleep (2 );/* Update matrix size at info struct */ error =mxt_read_reg (client,MXT_MATRIX_X_SIZE , &val);
include/linux/i2c/atmel_mxt_ts.h +1 -0
@@ -39,6 +39,7 @@ struct mxt_platform_data {unsigned int voltage;unsigned char orient;unsigned long irqflags; + u8(*read_chg) (void); };#endif /* __LINUX_ATMEL_MXT_TS_H */
Signature · 1 line
1.7.0.4
Dmitry Torokhov
maintainerQuoted 24 lines · Iiro Valkonen
The delay before the chip can be accessed after reset varies between different chips in maXTouch family. Waiting for 200ms and then monitoring the CHG (chip is ready when the line is low) is guaranteed to work with all chips.
Signed-off-by Iiro Valkonen <[email protected]>--- drivers/input/touchscreen/atmel_mxt_ts.c | 4 +++- include/linux/i2c/atmel_mxt_ts.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-)drivers/input/touchscreen/atmel_mxt_ts.c +1
-1@@ -170,7 +170,7 @@#define MXT_BOOT_VALUE 0xa5#define MXT_BACKUP_VALUE 0x55#define MXT_BACKUP_TIME 25/* msec */ -#define MXT_RESET_TIME 65/* msec */ +#define MXT_RESET_TIME 200/* msec */ #define MXT_FWRESET_TIME 175/* msec */
drivers/input/touchscreen/atmel_mxt_ts.c static int mxt_initialize(struct mxt_data *data) · line 832
Quoted 5 lines
drivers/input/touchscreen/atmel_mxt_ts.c +2
-0@@ -828,6 +828,8 @@ static int mxt_initialize(struct mxt_data *data)mxt_write_object (data,MXT_GEN_COMMAND ,MXT_COMMAND_RESET ,1 );msleep (MXT_RESET_TIME ); +while (data->pdata->read_chg ()) +msleep (2 );
I would prefer if we did not wait indefinitely but timed out after certain number of retries.
Thanks.
Signature · 1 line
Dmitry
Quoted 11 lines · Dmitry Torokhov
drivers/input/touchscreen/atmel_mxt_ts.c static int mxt_initialize(struct mxt_data *data) · line 832
Quoted 7 lines
drivers/input/touchscreen/atmel_mxt_ts.c +2
-0@@ -828,6 +828,8 @@ static int mxt_initialize(struct mxt_data *data)mxt_write_object (data,MXT_GEN_COMMAND ,MXT_COMMAND_RESET ,1 );msleep (MXT_RESET_TIME ); +while (data->pdata->read_chg ()) +msleep (2 );I would prefer if we did not wait indefinitely but timed out after certain number of retries.
Thanks, that does make sense. I'll send a new version.
BR,
Signature · 1 line
Iiro