openwrt/target/linux/bcm27xx/patches-6.1/950-0613-media-i2c-imx290-Print-error-code-when-I2C-transfer-.patch

41 lines
1.3 KiB
Diff
Raw Normal View History

From 25b4bd6894bf79b5d6150d66222d63afea32f24f Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Sun, 16 Oct 2022 09:15:06 +0300
Subject: [PATCH] media: i2c: imx290: Print error code when I2C
transfer fails
Upstream commit fbe0a89dc7e3.
Knowing why I2C transfers fail is useful for debugging. Extend the error
message to print the error code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/i2c/imx290.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/media/i2c/imx290.c
+++ b/drivers/media/i2c/imx290.c
@@ -370,7 +370,8 @@ static inline int __always_unused imx290
ret = regmap_read(imx290->regmap, addr, &regval);
if (ret) {
- dev_err(imx290->dev, "I2C read failed for addr: %x\n", addr);
+ dev_err(imx290->dev, "Failed to read register 0x%04x: %d\n",
+ addr, ret);
return ret;
}
@@ -385,7 +386,8 @@ static int imx290_write_reg(struct imx29
ret = regmap_write(imx290->regmap, addr, value);
if (ret) {
- dev_err(imx290->dev, "I2C write failed for addr: %x\n", addr);
+ dev_err(imx290->dev, "Failed to write register 0x%04x: %d\n",
+ addr, ret);
return ret;
}