Re: [PATCH v4 04/29] media: imx219: Scale the vblank limits according to rate_factor

Sakari Ailus
2026-04-20T21:08:10Z

Hi Jacopo,

On Fri, Apr 10, 2026 at 11:01:02AM +0200, Jacopo Mondi wrote:
> On Fri, Apr 10, 2026 at 11:41:45AM +0300, Sakari Ailus wrote:
> > Hi Jacopo,
> >
> > On Fri, Apr 10, 2026 at 10:28:27AM +0200, Jacopo Mondi wrote:
> > > Hi Sakari
> > >
> > > On Wed, Apr 08, 2026 at 06:39:13PM +0300, Sakari Ailus wrote:
> > > > The limits for vertical blanking (and frame length in pixels) is related
> > > > to the properties of the hardware, it's not in half-line units the driver
> > > > uses. Multiply the vertical blanking limits by the rate_factor to satisty
> > > > hardware requirements.
> > > >
> > > > Fixes: f513997119f4 ("media: i2c: imx219: Scale the pixel rate for analog binning")
> > > > Cc: stable@vger.kernel.org
> > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > >
> > > I'm not sure I understand this change.
> > >
> > > I think we have clarified the imx219 has a "special" binning mode
> > > where the ADC consumes two lines at a time, allowing an higher
> > > framerate.
> > >
> > > The driver accounts for that by doubling the PIXEL_RATE control value
> > > and halving the VBLANK and EXPOSURE controls values when writing them
> > > to registers.
> > >
> > > Userspace is not concerned with the special binning mode and is not
> > > required to halve the values it writes to the VBLANK and EXPOSURE controls.
> > >
> > > Doesn't the same apply to the limits ? Also, I presume but special
> > > binning mode is not well documented, the actual maximum register value
> > > for the frame length is still 0xfffe.
> > >
> > > What have I missed ?
> >
> > This patch indeed changes the limits of the VBLANK control. The maximum
> > frame length (in hardware) indeed is 0xfffe but the driver only allowed
> > frames up to 0x7fff lines before this patch.
> >
>
> Isn't userspace still allowed to write values up to 0xfffe ?
>
> What ends up in registers is halved because, again in my speculative
> understanding of the special binning mode, when using this special
> mode two lines at the time are sampled.

Two rows of pixels are indeed sampled at the same time, but after the
analogue binning, these are a single line of samples for the digital
processing steps of the sensor. The maximum value of the frame length in
lines registers is thus unaffected by analogue binning.

--
Kind regards,

Sakari Ailus