LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Input: st1232 - increase "wait ready" timeout
@ 2021-09-29 15:26 John Keeping
  2021-09-29 17:40 ` Geert Uytterhoeven
  2021-10-06 18:08 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: John Keeping @ 2021-09-29 15:26 UTC (permalink / raw)
  To: linux-input
  Cc: John Keeping, Dmitry Torokhov, Geert Uytterhoeven, linux-kernel

I have a ST1633 touch controller which fails to probe due to a timeout
waiting for the controller to become ready.  Increasing the minimum
delay to 100ms ensures that the probe sequence completes successfully.

The ST1633 datasheet says nothing about the maximum delay here and the
ST1232 I2C protocol document says "wait until" with no notion of a
timeout.

Since this only runs once during probe, being generous with the timout
seems reasonable and most likely the device will become ready
eventually.

(It may be worth noting that I saw this issue with a PREEMPT_RT patched
kernel which probably has tighter wakeups from usleep_range() than other
preemption models.)

Fixes: f605be6a57b4 ("Input: st1232 - wait until device is ready before reading resolution")
Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/input/touchscreen/st1232.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 6abae665ca71..9d1dea6996a2 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -92,7 +92,7 @@ static int st1232_ts_wait_ready(struct st1232_ts_data *ts)
 	unsigned int retries;
 	int error;
 
-	for (retries = 10; retries; retries--) {
+	for (retries = 100; retries; retries--) {
 		error = st1232_ts_read_data(ts, REG_STATUS, 1);
 		if (!error) {
 			switch (ts->read_buf[0]) {
-- 
2.33.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: st1232 - increase "wait ready" timeout
  2021-09-29 15:26 [PATCH] Input: st1232 - increase "wait ready" timeout John Keeping
@ 2021-09-29 17:40 ` Geert Uytterhoeven
  2021-10-06 18:08 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-09-29 17:40 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-input, Dmitry Torokhov, Linux Kernel Mailing List

On Wed, Sep 29, 2021 at 5:26 PM John Keeping <john@metanate.com> wrote:
> I have a ST1633 touch controller which fails to probe due to a timeout
> waiting for the controller to become ready.  Increasing the minimum
> delay to 100ms ensures that the probe sequence completes successfully.
>
> The ST1633 datasheet says nothing about the maximum delay here and the
> ST1232 I2C protocol document says "wait until" with no notion of a
> timeout.
>
> Since this only runs once during probe, being generous with the timout
> seems reasonable and most likely the device will become ready
> eventually.
>
> (It may be worth noting that I saw this issue with a PREEMPT_RT patched
> kernel which probably has tighter wakeups from usleep_range() than other
> preemption models.)
>
> Fixes: f605be6a57b4 ("Input: st1232 - wait until device is ready before reading resolution")
> Signed-off-by: John Keeping <john@metanate.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: st1232 - increase "wait ready" timeout
  2021-09-29 15:26 [PATCH] Input: st1232 - increase "wait ready" timeout John Keeping
  2021-09-29 17:40 ` Geert Uytterhoeven
@ 2021-10-06 18:08 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2021-10-06 18:08 UTC (permalink / raw)
  To: John Keeping; +Cc: linux-input, Geert Uytterhoeven, linux-kernel

On Wed, Sep 29, 2021 at 04:26:08PM +0100, John Keeping wrote:
> I have a ST1633 touch controller which fails to probe due to a timeout
> waiting for the controller to become ready.  Increasing the minimum
> delay to 100ms ensures that the probe sequence completes successfully.
> 
> The ST1633 datasheet says nothing about the maximum delay here and the
> ST1232 I2C protocol document says "wait until" with no notion of a
> timeout.
> 
> Since this only runs once during probe, being generous with the timout
> seems reasonable and most likely the device will become ready
> eventually.

I'll apply this, but I wonder if it would not make sense to mark the
driver as preferring asynchronous probing, so we do not delay
initializing other devices while we are waiting for the touch controller
to reset? Could you send me a patch for that?

> 
> (It may be worth noting that I saw this issue with a PREEMPT_RT patched
> kernel which probably has tighter wakeups from usleep_range() than other
> preemption models.)
> 
> Fixes: f605be6a57b4 ("Input: st1232 - wait until device is ready before reading resolution")
> Signed-off-by: John Keeping <john@metanate.com>
> ---
>  drivers/input/touchscreen/st1232.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
> index 6abae665ca71..9d1dea6996a2 100644
> --- a/drivers/input/touchscreen/st1232.c
> +++ b/drivers/input/touchscreen/st1232.c
> @@ -92,7 +92,7 @@ static int st1232_ts_wait_ready(struct st1232_ts_data *ts)
>  	unsigned int retries;
>  	int error;
>  
> -	for (retries = 10; retries; retries--) {
> +	for (retries = 100; retries; retries--) {
>  		error = st1232_ts_read_data(ts, REG_STATUS, 1);
>  		if (!error) {
>  			switch (ts->read_buf[0]) {
> -- 
> 2.33.0
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-06 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 15:26 [PATCH] Input: st1232 - increase "wait ready" timeout John Keeping
2021-09-29 17:40 ` Geert Uytterhoeven
2021-10-06 18:08 ` Dmitry Torokhov

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).