Re: [PATCH 06/10] media: i2c: ov9282: refresh flash_duration range on an HBLANK write

From: Richard Leitner

Date: Mon Sep 28 2026 - 04:21:16 EST


Hi Dave,

thanks for your feedback!

On Wed, Sep 23, 2026 at 04:09:25PM +0100, Dave Stevenson wrote:
> Hi Richard
>
> On Mon, 14 Sept 2026 at 20:21, Richard Leitner
> <richard.leitner@xxxxxxxxx> wrote:
> >
> > The strobe ceiling is the exposure time in microseconds, so it follows
> > the line time, and the line length sets the line time. Writing HBLANK moves
> > it and nothing recomputes the flash_duration ceiling.
> >
> > Therefore add the missing flash_duration range update when HBLANK is set.
> >
> > The exposure range is counted in lines, so it is unaffected and does not
> > need refreshing here.
> >
> > 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 e64d8343c18e9..632184e76b9bd 100644
> > --- a/drivers/media/i2c/ov9282.c
> > +++ b/drivers/media/i2c/ov9282.c
> > @@ -674,6 +674,19 @@ static int ov9282_set_ctrl(struct v4l2_ctrl *ctrl)
> > if (ret)
> > return ret;
> > break;
> > + case V4L2_CID_HBLANK:
> > + /*
> > + * HBLANK affects the line time, which then affects the flash
> > + * duration. Therefore recalculate the flash duration range
> > + * here.
> > + */
>
> Except for the comment, this clause is identical to that for
> V4L2_CID_EXPOSURE that you added in patch 4. No need for the
> duplication.

That's true. I will merge the two switch arms to get rid of the
duplicated code. Thanks!

regards;rl

>
> Dave
>
> > + exposure = ov9282_exposure_to_us(ov9282, ov9282->exp_ctrl->val);
> > + ret = __v4l2_ctrl_modify_range(ov9282->flash_duration, 0,
> > + exposure, 1,
> > + OV9282_STROBE_FRAME_SPAN_DEFAULT);
> > + if (ret)
> > + return ret;
> > + break;
> > }
> >
> > /* Set controls only if sensor is in power on state */
> >
> > --
> > 2.53.0
> >
> >