Re: [PATCH 11/13] media: i2c: os05b10: Update active format before adjusting framing controls
From: Tarang Raval
Date: Sat Mar 07 2026 - 00:22:35 EST
Hi Sakari,
> On Fri, Mar 06, 2026 at 06:03:01PM +0530, Tarang Raval wrote:
> > os05b10_set_pad_format() calls os05b10_set_framing_limits() before updating
> > the ACTIVE format. As a result, the VBLANK control handler uses the old
> > height when recalculating exposure limits, causing -ERANGE when switching
> > to a larger resolution.
> >
> > Update the ACTIVE format before adjusting framing controls so control
> > callbacks use the correct dimensions.
> >
> > Signed-off-by: Tarang Raval <tarang.raval@xxxxxxxxxxxxxxxxx>
> > ---
> > drivers/media/i2c/os05b10.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/i2c/os05b10.c b/drivers/media/i2c/os05b10.c
> > index 4601e33b7e8f..476dbcb49351 100644
> > --- a/drivers/media/i2c/os05b10.c
> > +++ b/drivers/media/i2c/os05b10.c
> > @@ -902,14 +902,14 @@ static int os05b10_set_pad_format(struct v4l2_subdev *sd,
> >
> > format = v4l2_subdev_state_get_format(sd_state, 0);
> >
> > + *format = fmt->format;
> > +
> > if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
> > ret = os05b10_set_framing_limits(os05b10, mode);
>
> Does it take a driver bug for this to happen? Presumably? I guess the
> result would be somewhat inconsistent state in any case.
In the current driver only a single mode is present, so the issue is not
observed because no resolution change occurs.
This issue became visible while adding a new mode. During a mode switch
(from a smaller resolution to a larger one) the limits are calculated
using the previous format, which results in -ERANGE and the new mode is
not applied.
Updating *format = fmt->format before adjusting the framing controls
ensures the control handlers see the correct dimensions.
Best Regards,
Tarang