Skip to content

Commit

Permalink
Input: cyttsp - verbose error on soft reset
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210322221349.1116666-1-linus.walleij@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Linus Walleij authored and Dmitry Torokhov committed Mar 25, 2021
1 parent 55f2645 commit 84c36ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/input/touchscreen/cyttsp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ static void cyttsp_hard_reset(struct cyttsp *ts)

static int cyttsp_soft_reset(struct cyttsp *ts)
{
unsigned long timeout;
int retval;

/* wait for interrupt to set ready completion */
Expand All @@ -248,12 +247,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 (!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;
}

out:
ts->state = CY_IDLE_STATE;
Expand Down

0 comments on commit 84c36ab

Please sign in to comment.