lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176474443195.1636185.14924967141075849275@freya>
Date: Wed, 03 Dec 2025 12:17:11 +0530
From: Jai Luthra <jai.luthra@...asonboard.com>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>, Dave Stevenson <dave.stevenson@...pberrypi.com>, Jacopo Mondi <jacopo@...ndi.org>, Mauro Carvalho Chehab <mchehab@...nel.org>, Naushir Patuck <naush@...pberrypi.com>, Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, devicetree@...r.kernel.org, Mauro Carvalho Chehab <mchehab+huawei@...nel.org>, Kieran Bingham <kieran.bingham@...asonboard.com>, David Plowman <david.plowman@...pberrypi.com>, Laurent Pinchart <laurent.pinchart@...asonboard.com>, Peter Robinson <pbrobinson@...il.com>, Stefan Wahren <wahrenst@....net>, Ivan T. Ivanov <iivanov@...e.de>, Jacopo Mondi <jacopo.mondi@...asonboard.com>
Subject: Re: [PATCH v2 16/16] media: i2c: ov5647: Add V4L2_CID_LINK_FREQUENCY control

Hi Jacopo

Quoting Jacopo Mondi (2025-12-01 21:20:39)
> Hi Jai
> 
> On Tue, Nov 18, 2025 at 05:33:09PM +0530, Jai Luthra wrote:
> > From: Dave Stevenson <dave.stevenson@...pberrypi.com>
> >
> > The link frequency can vary between modes, so add it as a
> > control.
> >
> > Signed-off-by: Dave Stevenson <dave.stevenson@...pberrypi.com>
> > Signed-off-by: Jai Luthra <jai.luthra@...asonboard.com>
> > ---
> >  drivers/media/i2c/ov5647.c | 24 +++++++++++++++++++++++-
> >  1 file changed, 23 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
> > index 71107d74f2900b39233a52b29a229282bd087963..de27e76b487957bfa0a072359f28194425950eaf 100644
> > --- a/drivers/media/i2c/ov5647.c
> > +++ b/drivers/media/i2c/ov5647.c
> > @@ -97,6 +97,13 @@ static const char * const ov5647_supply_names[] = {
> >
> >  #define OV5647_NUM_SUPPLIES ARRAY_SIZE(ov5647_supply_names)
> >
> > +#define FREQ_INDEX_FULL              0
> > +#define FREQ_INDEX_VGA               1
> > +static const s64 ov5647_link_freqs[] = {
> > +     [FREQ_INDEX_FULL]       = 218750000,
> > +     [FREQ_INDEX_VGA]        = 208333000,
> > +};
> > +
> >  struct regval_list {
> >       u16 addr;
> >       u8 data;
> > @@ -106,6 +113,7 @@ struct ov5647_mode {
> >       struct v4l2_mbus_framefmt       format;
> >       struct v4l2_rect                crop;
> >       u64                             pixel_rate;
> > +     unsigned int                    link_freq_index;
> >       int                             hts;
> >       int                             vts;
> >       const struct regval_list        *reg_list;
> > @@ -128,6 +136,7 @@ struct ov5647 {
> >       struct v4l2_ctrl                *exposure;
> >       struct v4l2_ctrl                *hflip;
> >       struct v4l2_ctrl                *vflip;
> > +     struct v4l2_ctrl                *link_freq;
> >  };
> >
> >  static inline struct ov5647 *to_sensor(struct v4l2_subdev *sd)
> > @@ -376,6 +385,7 @@ static const struct ov5647_mode ov5647_modes[] = {
> >                       .height         = 1944
> >               },
> >               .pixel_rate     = 87500000,
> > +             .link_freq_index = FREQ_INDEX_FULL,
> >               .hts            = 2844,
> >               .vts            = 0x7b0,
> >               .reg_list       = ov5647_2592x1944_10bpp,
> > @@ -397,6 +407,7 @@ static const struct ov5647_mode ov5647_modes[] = {
> >                       .height         = 1080,
> >               },
> >               .pixel_rate     = 87500000,
> > +             .link_freq_index = FREQ_INDEX_FULL,
> >               .hts            = 2416,
> >               .vts            = 0x450,
> >               .reg_list       = ov5647_1080p30_10bpp,
> > @@ -418,6 +429,7 @@ static const struct ov5647_mode ov5647_modes[] = {
> >                       .height         = 1944,
> >               },
> >               .pixel_rate     = 87500000,
> > +             .link_freq_index = FREQ_INDEX_FULL,
> >               .hts            = 1896,
> >               .vts            = 0x59b,
> >               .reg_list       = ov5647_2x2binned_10bpp,
> > @@ -439,6 +451,7 @@ static const struct ov5647_mode ov5647_modes[] = {
> >                       .height         = 1920,
> >               },
> >               .pixel_rate     = 55000000,
> 
> I now read again v1 13/13 and this mode seems to have a different pixel
> rate and a lower link freq ?
> 

Indeed, I had already sent a v2 before that discussion, and was waiting for
more comments (and 6.19-rc1 tag) before sending a v3:
https://lore.kernel.org/all/176347245796.268162.1039078457352251254@freya/

> > +             .link_freq_index = FREQ_INDEX_VGA,
> >               .hts            = 1852,
> >               .vts            = 0x1f8,
> >               .reg_list       = ov5647_640x480_10bpp,
> > @@ -927,6 +940,8 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,
> >                                        sensor->exposure->minimum,
> >                                        exposure_max, sensor->exposure->step,
> >                                        exposure_def);
> > +
> > +             __v4l2_ctrl_s_ctrl(sensor->link_freq, mode->link_freq_index);
> >       }
> >       *fmt = mode->format;
> >       /* The code we pass back must reflect the current h/vflips. */
> > @@ -1236,7 +1251,7 @@ static int ov5647_init_controls(struct ov5647 *sensor)
> >       int hblank, exposure_max, exposure_def;
> >       struct device *dev = &client->dev;
> >
> > -     v4l2_ctrl_handler_init(&sensor->ctrls, 13);
> > +     v4l2_ctrl_handler_init(&sensor->ctrls, 14);
> >
> >       v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
> >                         V4L2_CID_AUTOGAIN, 0, 1, 1, 0);
> > @@ -1292,6 +1307,13 @@ static int ov5647_init_controls(struct ov5647 *sensor)
> >       sensor->vflip = v4l2_ctrl_new_std(&sensor->ctrls, &ov5647_ctrl_ops,
> >                                         V4L2_CID_VFLIP, 0, 1, 1, 0);
> >
> > +     sensor->link_freq =
> > +             v4l2_ctrl_new_int_menu(&sensor->ctrls, NULL, V4L2_CID_LINK_FREQ,
> > +                                    ARRAY_SIZE(ov5647_link_freqs) - 1, 0,
> 
> The default control value should follow the default mode.
> You can use mode->link_req_index to retrieve it
> 

Will do.

> > +                                    ov5647_link_freqs);
> > +     if (sensor->link_freq)
> > +             sensor->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> > +
> >       v4l2_fwnode_device_parse(dev, &props);
> >
> >       v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops,
> >
> > --
> > 2.51.1
> >

Thanks,
    Jai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ