Re: [PATCH 04/10] media: i2c: ov9282: update flash_duration range even when powered down
From: Richard Leitner
Date: Mon Sep 28 2026 - 04:01:14 EST
Hi Dave,
thanks for your feedback!
On Thu, Sep 17, 2026 at 11:38:22AM +0100, Dave Stevenson wrote:
> Hi Richard
>
> On Mon, 14 Sept 2026 at 20:21, Richard Leitner
> <richard.leitner@xxxxxxxxx> wrote:
> >
> > 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;
>
> This hasn't removed the __v4l2_ctrl_modify_range call from
> ov9282_update_exp_gain(), so the range gets updated twice if the
> sensor is powered on.
I will take a look at it and adapt it for v2 accordingly.
regards;rl
>
> Dave
>
> > }
> >
> > /* Set controls only if sensor is in power on state */
> >
> > --
> > 2.53.0
> >
> >