Skip to contentSkip to conversation

Input: qt1050 - handle CHIP_ID reading error

PATCH Applied Andrei Lalaev 3 participants 4 messages Jun 17, 2024 – Jun 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: qt1050 - handle CHIP_ID reading error

From: Andrei Lalaev <[email protected]>

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 cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")
---
 drivers/input/keyboard/qt1050.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/input/keyboard/qt1050.c +6 -1
index b51dfcd76038..056e9bc26026 100644
@@ -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;
Signature · 1 line
2.35.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Andrei Lalaev

From: Andrei Lalaev <[email protected]>

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

qt1050 3-0041: ID -1340767592 not supported

Quoted 7 lines

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 cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")
maintainer Applied
#2 lore raw
In reply to Andrei Lalaev
Quoted 6 lines · Andrei Lalaev

From: Andrei Lalaev <[email protected]>

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

qt1050 3-0041: ID -1340767592 not supported

Quoted 7 lines

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 cbebf5addec1 ("Input: qt1050 - add Microchip AT42QT1050 support")

Applied, thank you.

But how did we get into the situation with the chip being missing? Incorrect DTB for the board?

Thanks.

Signature · 1 line
Dmitry
#3 lore raw
Quoted 1 line

But how did we get into the situation with the chip being missing?

In my case, this chip is a part of an external board.
So, for example, I see this message in the case of a bad cable connection.

Also, I prefer to see messages with error codes instead of random values from a stack :)

P.S. sorry for the previous email, I made a typo in git-send-email args.

Best regards,
Andrei Lalaev