Re: [PATCH v2 2/2] media: i2c: ov02e10: add OV02E10 image sensor driver

From: Alan Stern
Date: Mon Mar 31 2025 - 22:36:30 EST


On Tue, Apr 01, 2025 at 01:34:29AM +0100, Bryan O'Donoghue wrote:
> On 27/03/2025 07:36, Sakari Ailus wrote:
> > > +static u64 to_pixel_rate(u32 f_index)
> > > +{
> > > + u64 pixel_rate = link_freq_menu_items[f_index] * 2 * OV02E10_DATA_LANES;
> > > +
> > > + do_div(pixel_rate, OV02E10_RGB_DEPTH);
> > The pixel rate control is for the pixel rate on the pixel array, not on the
> > CSI-2 interface. Without binning or sub-sampling these may the same still,
> > but this only works in special cases really.
>
> Hmm computer says no, I don't think I have understood this comment..
>
> Looking at other drivers, I'd say the above pattern is pretty common -
> taking ov8856 as an example that's pretty much equivalent logic to the
> above, ov08x40 does something similar.
>
> =>
>
> pixel_rate == link_freq * 2 * #oflanes / RGB_DEPTH
> => 360MHz * 2 * 2 / 10
> => 360000000 * 2 * 2 / 10
> => 144000000
>
> If I'm understanding you though you mean the pixel rate for the control
> V4L2_CID_PIXEL_RATE expressed here should be the resolution * the FPS /
> bits_per_pixel
>
> pixel_rate = wdith x height x fps / bpp
> => 1928 * 1088 * 30 / 10
> => 6292992
>
> i.e. the pixel rate not related to the CSI2 link frequency ?

I know practically nothing about this stuff, but even I can see that this
suggestion doesn't make sense:

width x height = pixels per frame;
pixels per frame x fps = pixels per second;
pixels per second / bits per pixel = pixels^2 / (bits x seconds)

which is meaningless. If the division were replaced with a
multiplication this would become:

pixels per second x bits per pixel = bits per second

which at least is reasonable.

Alan