[PATCH v3 2/2] media: i2c: vd55g1: stop streaming after an exposure read error

From: Jizhou Tong

Date: Mon Oct 12 2026 - 23:11:19 EST


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.

Signed-off-by: Jizhou Tong <fqwqf@xxxxxxxxx>
---
Changes in v3: reference the CCI error-accumulator API in the
stream-off comment. No functional changes from v2.

Fault-injection harness:
https://gist.github.com/fQwQf/60bd12627e06b10a2fc159e545f85dae/7b21a7d3a1b676a0e4cdaba06168ede09a2949e3

drivers/media/i2c/vd55g1.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 78e4aebfdd3b24b867ea4d077dc1b676c4a595da..e78835f014e65bfc2b3dcc2aaee7b054fb5da390 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -1190,6 +1190,14 @@ 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);
+
+ /*
+ * cci_write() skips writes when its error accumulator is set
+ * (see include/media/v4l2-cci.h). Start a separate stop sequence.
+ */
+ ret = 0;

vd55g1_write(sensor, VD55G1_REG_STREAMING, VD55G1_STREAMING_STOP_STREAM,
&ret);
--
2.53.0