[PATCH 04/10] media: i2c: ov9282: update flash_duration range even when powered down

From: Richard Leitner

Date: Mon Sep 14 2026 - 15:30:03 EST


The flash_duration range update sat inside ov9282_update_exp_gain(), which
ov9282_set_ctrl() only reaches after the pm_runtime_get_if_in_use() early
return. So with the sensor idle the ceiling kept whatever value it had
when it last streamed. Therefore setting exposure before flash_duration
while the sensor is powered down may clamp flash_duration against an
outdated exposure.

Fix this by moving the range update before the power check.

Signed-off-by: Richard Leitner <richard.leitner@xxxxxxxxx>
---
drivers/media/i2c/ov9282.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
index 90a0fe542ce4a..4c88de1965171 100644
--- a/drivers/media/i2c/ov9282.c
+++ b/drivers/media/i2c/ov9282.c
@@ -645,6 +645,19 @@ static int ov9282_set_ctrl(struct v4l2_ctrl *ctrl)
if (ret)
return ret;
break;
+ case V4L2_CID_EXPOSURE:
+ /*
+ * Ensure the flash duration range is also updated on powered
+ * down sensors.
+ */
+ ret = __v4l2_ctrl_modify_range(ov9282->flash_duration, 0,
+ ov9282_exposure_to_us(ov9282,
+ ctrl->val),
+ 1,
+ OV9282_STROBE_FRAME_SPAN_DEFAULT);
+ if (ret)
+ return ret;
+ break;
}

/* Set controls only if sensor is in power on state */

--
2.53.0