mbox series

[00/10] media: ar0521: Add analog gain, rework clock tree

Message ID 20221005190613.394277-1-jacopo@jmondi.org
Headers show
Series media: ar0521: Add analog gain, rework clock tree | expand

Message

Jacopo Mondi Oct. 5, 2022, 7:06 p.m. UTC
Hello,
  this series adds a few features to the ar0521 driver to enable its usage
with libcamera.

In particular:
- enum_frame_sizes
- global analog gain control
- LINK_FREQ, 60FPS support and configurable PIXEL_RATE
- Rework blanking handligs

Thanks
   j

Jacopo Mondi (10):
  media: ar0521: Implement enum_frame_sizes
  media: ar0521: Add V4L2_CID_ANALOG_GAIN
  media: ar0521: Set maximum resolution to 2592x1944
  media: ar0521: Rework PLL computation
  media: ar0521: Add LINK_FREQ control
  media: ar0521: Configure pixel rate using LINK_FREQ
  media: ar0521: Adjust exposure and blankings limits
  media: ar0521: Setup controls at s_stream time
  media: ar0521: Rework startup sequence
  media: ar0521: Tab-align definitions

 drivers/media/i2c/ar0521.c | 396 +++++++++++++++++++++++++++----------
 1 file changed, 293 insertions(+), 103 deletions(-)

--
2.37.3

Comments

Laurent Pinchart Oct. 13, 2022, 9:31 a.m. UTC | #1
Hi Sakari,

On Wed, Oct 12, 2022 at 10:02:00PM +0300, Sakari Ailus wrote:
> On Fri, Oct 07, 2022 at 04:56:01PM +0300, Laurent Pinchart wrote:
> > On Wed, Oct 05, 2022 at 09:06:07PM +0200, Jacopo Mondi wrote:
> > > Rework the PLL computation procedure to take into account the currently
> > > configured format bpp and the number of data lanes.
> > > 
> > > Comment the PLL configuration procedure with information provided by the
> > > sensor chip manual and remove the hardcoded divider from the pixel clock
> > > calculation.
> > > 
> > > The PLL configuration procedure has been verified by forcing a pixel
> > > rate of 414 MHz and verify that the effective output pixel rate matches
> > > the expected 60 frames per second.
> > 
> > This is the kind of code that would benefit from testing with kunit.
> > 
> > > Do not modify the default pixel rate for the moment as it will be made
> > > configurable through V4L2_CID_LINK_FREQ in subsequent patches.
> > > 
> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > 
> > I think we should extract the PLL calculation code from the CCS driver
> > into a library. Sakari ? :-)
> 
> It already is a module. I think there is another driver using it, written
> by you. :-)

Oh indeed. I wonder how I missed that.

> Some PLLs are as in CCS but there are different ones, too, especially in
> Omnivision sensors. Sometimes CCS PLL calculator can be used on non-CCS sensors
> by fixing one of the multipliers or divisors to 1.

I think the AR0521 PLL could match, but I also think there are some
mistakes in the documentation, so this would need to be checked.