* [PATCH] Input: cyttsp - Verbose error on soft reset
@ 2021-03-22 22:13 Linus Walleij
2021-03-23 3:57 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2021-03-22 22:13 UTC (permalink / raw)
To: Ferruh Yigit, Dmitry Torokhov, linux-input; +Cc: Henrik Rydberg, Linus Walleij
The first thing the Cypress driver does when starting
up is to try a soft reset. This is the first point where
the driver SPI/I2C communication can fail, so put out some
nice debug text:
cyttsp-spi spi2.0: failed to send soft reset
Instead of just:
cyttsp-spi: probe of spi2.0 failed with error -5
This is more helpful.
Cc: Ferruh Yigit <fery@cypress.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/input/touchscreen/cyttsp_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 73c854f35f33..b9772192b5ea 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -248,12 +248,16 @@ static int cyttsp_soft_reset(struct cyttsp *ts)
enable_irq(ts->irq);
retval = ttsp_send_command(ts, CY_SOFT_RESET_MODE);
- if (retval)
+ if (retval) {
+ dev_err(ts->dev, "failed to send soft reset\n");
goto out;
+ }
timeout = wait_for_completion_timeout(&ts->bl_ready,
msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX));
retval = timeout ? 0 : -EIO;
+ if (retval)
+ dev_err(ts->dev, "timeout waiting for soft reset\n");
out:
ts->state = CY_IDLE_STATE;
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: cyttsp - Verbose error on soft reset
2021-03-22 22:13 [PATCH] Input: cyttsp - Verbose error on soft reset Linus Walleij
@ 2021-03-23 3:57 ` Dmitry Torokhov
2021-03-24 8:26 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2021-03-23 3:57 UTC (permalink / raw)
To: Linus Walleij; +Cc: Ferruh Yigit, linux-input, Henrik Rydberg
Hi Linus,
On Mon, Mar 22, 2021 at 11:13:49PM +0100, Linus Walleij wrote:
> The first thing the Cypress driver does when starting
> up is to try a soft reset. This is the first point where
> the driver SPI/I2C communication can fail, so put out some
> nice debug text:
>
> cyttsp-spi spi2.0: failed to send soft reset
>
> Instead of just:
>
> cyttsp-spi: probe of spi2.0 failed with error -5
>
> This is more helpful.
>
> Cc: Ferruh Yigit <fery@cypress.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/input/touchscreen/cyttsp_core.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
> index 73c854f35f33..b9772192b5ea 100644
> --- a/drivers/input/touchscreen/cyttsp_core.c
> +++ b/drivers/input/touchscreen/cyttsp_core.c
> @@ -248,12 +248,16 @@ static int cyttsp_soft_reset(struct cyttsp *ts)
> enable_irq(ts->irq);
>
> retval = ttsp_send_command(ts, CY_SOFT_RESET_MODE);
> - if (retval)
> + if (retval) {
> + dev_err(ts->dev, "failed to send soft reset\n");
> goto out;
> + }
>
> timeout = wait_for_completion_timeout(&ts->bl_ready,
> msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX));
> retval = timeout ? 0 : -EIO;
> + if (retval)
> + dev_err(ts->dev, "timeout waiting for soft reset\n");
I think if we have conditional for the error message then having ternary
above does not make sense. I changed this to:
if (!wait_for_completion_timeout(&ts->bl_ready,
msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX))) {
dev_err(ts->dev, "timeout waiting for soft reset\n");
retval = -EIO;
}
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: cyttsp - Verbose error on soft reset
2021-03-23 3:57 ` Dmitry Torokhov
@ 2021-03-24 8:26 ` Linus Walleij
0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-03-24 8:26 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Ferruh Yigit, Linux Input, Henrik Rydberg
On Tue, Mar 23, 2021 at 4:57 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Mon, Mar 22, 2021 at 11:13:49PM +0100, Linus Walleij wrote:
> > retval = timeout ? 0 : -EIO;
> > + if (retval)
> > + dev_err(ts->dev, "timeout waiting for soft reset\n");
>
> I think if we have conditional for the error message then having ternary
> above does not make sense. I changed this to:
Ah nice.
I'm starting to get this driver to work on a machine, so I hope I
will be able to make a few more serious improvements.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-24 8:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-22 22:13 [PATCH] Input: cyttsp - Verbose error on soft reset Linus Walleij
2021-03-23 3:57 ` Dmitry Torokhov
2021-03-24 8:26 ` Linus Walleij
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).