From: Yauhen Kharuzhy <jekhor@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Hans de Goede <hansg@kernel.org>
Subject: Re: [PATCH 4/5] input: drv260x: Stop waiting for GO bit clearing after timeout
Date: Fri, 13 Feb 2026 23:00:18 +0200 [thread overview]
Message-ID: <aY-P_VyXDfqbm83m@jekhomev> (raw)
In-Reply-To: <aY4OAw_IMeta1z9e@google.com>
On Thu, Feb 12, 2026 at 09:34:51AM -0800, Dmitry Torokhov wrote:
> On Thu, Feb 12, 2026 at 01:46:54AM +0200, Yauhen Kharuzhy wrote:
> > If something goes wrong during effect playing or calibration, the GO bit
> > may not be cleared after some time, and the driver will get stuck.
> > To prevent this, add a timeout to the waiting loop.
> >
> > Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
> > ---
> > drivers/input/misc/drv260x.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
> > index f08a3d6c3ed8..f7bfac6d3973 100644
> > --- a/drivers/input/misc/drv260x.c
> > +++ b/drivers/input/misc/drv260x.c
> > @@ -173,6 +173,12 @@
> > #define DRV260X_AUTOCAL_TIME_500MS (2 << 4)
> > #define DRV260X_AUTOCAL_TIME_1000MS (3 << 4)
> >
> > +/*
> > + * Timeout for waiting for the GO status bit, in seconds. Should be reasonably
> > + * large to allow long-duration effects and a calibration cycle
> > + */
> > +#define DRV260X_GO_TIMEOUT_S 5
> > +
> > /**
> > * struct drv260x_data -
> > * @input_dev: Pointer to the input device
> > @@ -339,6 +345,7 @@ static int drv260x_init(struct drv260x_data *haptics)
> > {
> > int error;
> > unsigned int cal_buf;
> > + unsigned long timeout;
> > u8 id;
> >
> > error = regmap_read(haptics->regmap, DRV260X_STATUS, &cal_buf);
> > @@ -442,6 +449,7 @@ static int drv260x_init(struct drv260x_data *haptics)
> > return error;
> > }
> >
> > + timeout = jiffies + DRV260X_GO_TIMEOUT_S * HZ;
> > do {
> > usleep_range(15000, 15500);
> > error = regmap_read(haptics->regmap, DRV260X_GO, &cal_buf);
> > @@ -451,6 +459,10 @@ static int drv260x_init(struct drv260x_data *haptics)
> > error);
> > return error;
> > }
> > + if (jiffies - timeout <= 0) {
>
> time_after()
>
> > + dev_err(&haptics->client->dev, "GO timeout\n");
>
> This should be a warning, not error, since we are continuing.
>
> But actually, shouldn't we signal an error? This is probe path and if
> the controller does not ever signal readiness I do not think we should
> pretend that it will work.
Sounds reasonable. I got such a hang when selecting invalid mode/library
properties, and yes, it doesn't look like we can expect correct
functioning afterward. Will change to error.
>
> > + break;
> > + }
> > } while (cal_buf == DRV260X_GO_BIT);
>
> Thanks.
>
> --
> Dmitry
--
Yauhen Kharuzhy
next prev parent reply other threads:[~2026-02-13 21:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 23:46 DRV260x: Support ACPI-enumerated devices Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 1/5] input: drv260x: Add I2C IDs for all device variants Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 2/5] input: drv260x: Add support for ACPI-enumerated devices Yauhen Kharuzhy
2026-02-12 17:26 ` Dmitry Torokhov
2026-02-13 20:48 ` Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 3/5] input: drv260x: Check the device ID at initialization Yauhen Kharuzhy
2026-02-12 17:28 ` Dmitry Torokhov
2026-02-13 20:53 ` Yauhen Kharuzhy
2026-02-11 23:46 ` [PATCH 4/5] input: drv260x: Stop waiting for GO bit clearing after timeout Yauhen Kharuzhy
2026-02-12 17:34 ` Dmitry Torokhov
2026-02-13 21:00 ` Yauhen Kharuzhy [this message]
2026-02-11 23:46 ` [PATCH 5/5] input: drv260x: Don't try to disable dummy regulator Yauhen Kharuzhy
2026-02-12 17:41 ` Dmitry Torokhov
2026-02-13 21:56 ` Yauhen Kharuzhy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aY-P_VyXDfqbm83m@jekhomev \
--to=jekhor@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox