* [PATCH 1/3] Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips
@ 2011-07-04 9:05 Iiro Valkonen
2011-07-04 10:04 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Iiro Valkonen @ 2011-07-04 9:05 UTC (permalink / raw)
To: Dmitry Torokhov, Joonyoung Shim; +Cc: linux-input
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 <iiro.valkonen@atmel.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 4 +++-
include/linux/i2c/atmel_mxt_ts.h | 1 +
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 1e61387..8870e7b 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -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);
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index f027f7a..ef59c22 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -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 */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips
2011-07-04 9:05 [PATCH 1/3] Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips Iiro Valkonen
@ 2011-07-04 10:04 ` Dmitry Torokhov
2011-07-04 12:42 ` Iiro Valkonen
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2011-07-04 10:04 UTC (permalink / raw)
To: Iiro Valkonen; +Cc: Joonyoung Shim, linux-input
On Mon, Jul 04, 2011 at 12:05:31PM +0300, Iiro Valkonen wrote:
> 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 <iiro.valkonen@atmel.com>
> ---
> drivers/input/touchscreen/atmel_mxt_ts.c | 4 +++-
> include/linux/i2c/atmel_mxt_ts.h | 1 +
> 2 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 1e61387..8870e7b 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -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);
I would prefer if we did not wait indefinitely but timed out after
certain number of retries.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips
2011-07-04 10:04 ` Dmitry Torokhov
@ 2011-07-04 12:42 ` Iiro Valkonen
0 siblings, 0 replies; 3+ messages in thread
From: Iiro Valkonen @ 2011-07-04 12:42 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Joonyoung Shim, linux-input
On 07/04/2011 01:04 PM, Dmitry Torokhov wrote:
>>
>> @@ -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,
--
Iiro
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-04 12:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-04 9:05 [PATCH 1/3] Input: atmel_mxt_ts - Make wait-after-reset period compatible with all chips Iiro Valkonen
2011-07-04 10:04 ` Dmitry Torokhov
2011-07-04 12:42 ` Iiro Valkonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).