* [PATCH v1 1/2] media: i2c: vd55g1: preserve the stream-start error
[not found] <20260930070802.102127-1-fqwqf@fqwqf.xyz>
@ 2026-09-30 7:08 ` Jizhou Tong
2026-09-30 11:27 ` Benjamin Mugnier
2026-09-30 7:08 ` [PATCH v1 2/2] media: i2c: vd55g1: stop streaming after an exposure read error Jizhou Tong
1 sibling, 1 reply; 3+ messages in thread
From: Jizhou Tong @ 2026-09-30 7:08 UTC (permalink / raw)
To: sakari.ailus, benjamin.mugnier, sylvain.petinot
Cc: mchehab, hverkuil, linux-media, linux-kernel
The stream-start error path replaces failures from register accesses and
sensor configuration with -EINVAL. This hides the cause of failures such
as an I2C error or a timeout.
Return the saved error after dropping the runtime PM reference. All
paths reaching this label already set ret to the error that triggered
cleanup.
Fixes: 5931eed35cb6 ("media: i2c: vd55g1: Fix return code in vd55g1_enable_streams error path")
Signed-off-by: Jizhou Tong <fqwqf@fqwqf.xyz>
---
Fault-injection harness:
https://gist.github.com/fQwQf/60bd12627e06b10a2fc159e545f85dae/7b21a7d3a1b676a0e4cdaba06168ede09a2949e3
drivers/media/i2c/vd55g1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 6f458f611f63451c97c708e187a313cf7b2aab4c..78e4aebfdd3b24b867ea4d077dc1b676c4a595da 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1178,7 +1178,7 @@ static int vd55g1_enable_streams(struct v4l2_subdev *sd,
err_rpm_put:
pm_runtime_put(sensor->dev);
- return -EINVAL;
+ return ret;
}
static int vd55g1_disable_streams(struct v4l2_subdev *sd,
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v1 2/2] media: i2c: vd55g1: stop streaming after an exposure read error
[not found] <20260930070802.102127-1-fqwqf@fqwqf.xyz>
2026-09-30 7:08 ` [PATCH v1 1/2] media: i2c: vd55g1: preserve the stream-start error Jizhou Tong
@ 2026-09-30 7:08 ` Jizhou Tong
1 sibling, 0 replies; 3+ messages in thread
From: Jizhou Tong @ 2026-09-30 7:08 UTC (permalink / raw)
To: sakari.ailus, benjamin.mugnier, sylvain.petinot
Cc: mchehab, hverkuil, linux-media, linux-kernel
Stream-off saves exposure settings for the next automatic-exposure cold
start. If that read fails, its error is passed to the subsequent CCI
operations, which skip accesses when the error accumulator is nonzero.
The sensor stop command is therefore never issued, although the runtime
PM reference is released.
Log the exposure snapshot failure separately and clear the accumulator
before stopping the sensor. Treat the optional snapshot failure as a
warning: a successful stop returns success, while a stop failure is
returned to the caller. Completing stream shutdown takes precedence
over saving exposure settings for the next start.
Fixes: e56616d7b23c ("media: i2c: Add driver for ST VD55G1 camera sensor")
Signed-off-by: Jizhou Tong <fqwqf@fqwqf.xyz>
---
Fault-injection harness:
https://gist.github.com/fQwQf/60bd12627e06b10a2fc159e545f85dae/7b21a7d3a1b676a0e4cdaba06168ede09a2949e3
drivers/media/i2c/vd55g1.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 78e4aebfdd3b24b867ea4d077dc1b676c4a595da..c0839593460a55d4ef91dfc85e0b9b476fbb34d7 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1190,6 +1190,11 @@ static int vd55g1_disable_streams(struct v4l2_subdev *sd,
/* Retrieve Expo cluster to enable coldstart of AE */
ret = vd55g1_read_expo_cluster(sensor);
+ if (ret)
+ dev_warn(sensor->dev, "Failed to save exposure: %d\n", ret);
+
+ /* A failed exposure read must not prevent the stop command. */
+ ret = 0;
vd55g1_write(sensor, VD55G1_REG_STREAMING, VD55G1_STREAMING_STOP_STREAM,
&ret);
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread