[PATCH v2 1/3] media: i2c: ov5693: Program the mode registers on stream start
From: Marco Ziliani
Date: Thu Oct 29 2026 - 05:28:32 EST
ov5693_mode_configure() is only called from the runtime PM resume path,
through ov5693_sensor_init(). If the sensor stays powered between two
streams with different modes, the settings for the second mode are never
written to the hardware.
Move the call from ov5693_sensor_init() to ov5693_s_stream(), before the
controls are applied, so that the mode is written on every stream start.
Fixes: 89aef879cb53 ("media: i2c: Add support for ov5693 sensor")
Link: https://github.com/linux-surface/kernel/pull/181
Signed-off-by: Marco Ziliani <rylos78@xxxxxxxxx>
---
drivers/media/i2c/ov5693.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c
index 56599f9ca..d09095c3e 100644
--- a/drivers/media/i2c/ov5693.c
+++ b/drivers/media/i2c/ov5693.c
@@ -663,11 +663,6 @@ static int ov5693_sensor_init(struct ov5693_device *ov5693)
return dev_err_probe(ov5693->dev, ret,
"global settings error\n");
- ret = ov5693_mode_configure(ov5693);
- if (ret)
- return dev_err_probe(ov5693->dev, ret,
- "mode configure error\n");
-
ret = ov5693_enable_streaming(ov5693, false);
if (ret)
dev_err(ov5693->dev, "stop streaming error\n");
@@ -1000,6 +995,19 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable)
return ret;
mutex_lock(&ov5693->lock);
+
+ /*
+ * Program the mode on every stream start, so that a format
+ * change also reaches a sensor that stayed powered since the
+ * previous stream, and before the controls so that the mode
+ * registers don't clobber them.
+ */
+ ret = ov5693_mode_configure(ov5693);
+ if (ret) {
+ mutex_unlock(&ov5693->lock);
+ goto err_power_down;
+ }
+
ret = __v4l2_ctrl_handler_setup(&ov5693->ctrls.handler);
if (ret) {
mutex_unlock(&ov5693->lock);
--
2.56.0