Commit 866a5c7e authored by Andrei Lalaev's avatar Andrei Lalaev Committed by Dmitry Torokhov

Input: qt1050 - handle CHIP_ID reading error

If the device is missing, we get the following error:

  qt1050 3-0041: ID -1340767592 not supported

Let's handle this situation and print more informative error
when reading of CHIP_ID fails:

  qt1050 3-0041: Failed to read chip ID: -6

Fixes: cbebf5ad ("Input: qt1050 - add Microchip AT42QT1050 support")
Signed-off-by: default avatarAndrei Lalaev <andrei.lalaev@anton-paar.com>
Reviewed-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20240617183018.916234-1-andrey.lalaev@gmail.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 0ca1323c
......@@ -226,7 +226,12 @@ static bool qt1050_identify(struct qt1050_priv *ts)
int err;
/* Read Chip ID */
regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
err = regmap_read(ts->regmap, QT1050_CHIP_ID, &val);
if (err) {
dev_err(&ts->client->dev, "Failed to read chip ID: %d\n", err);
return false;
}
if (val != QT1050_CHIP_ID_VER) {
dev_err(&ts->client->dev, "ID %d not supported\n", val);
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment