From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>
Cc: Umang Jain <umang.jain@ideasonboard.com>,
linux-media@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
willl will <will@willwhang.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Hans de Goede <hdegoede@redhat.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Alain Volmat <alain.volmat@foss.st.com>,
Paul Elder <paul.elder@ideasonboard.com>,
Mehdi Djait <mehdi.djait@bootlin.com>,
Bingbu Cao <bingbu.cao@intel.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Sebastian Reichel <sre@kernel.org>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] media: i2c: Add imx283 camera sensor driver
Date: Mon, 11 Mar 2024 17:10:55 +0000 [thread overview]
Message-ID: <Ze87Hya-cqmkqjMC@kekkonen.localdomain> (raw)
In-Reply-To: <171017536692.2924028.6522729664515712567@ping.linuxembedded.co.uk>
Hi Kieran,
On Mon, Mar 11, 2024 at 04:42:46PM +0000, Kieran Bingham wrote:
> Quoting Sakari Ailus (2024-03-11 16:29:23)
> > Hi Kieran,
> >
> > On Mon, Mar 11, 2024 at 12:28:19PM +0000, Kieran Bingham wrote:
> > > Hi Sakari, Umang,
> > >
> > > I've replied inline below to a couple of points that I was responsible for.
> > >
> > > >
> > > > > +
> > > > > +struct imx283 {
> > > > > + struct device *dev;
> > > > > + struct regmap *cci;
> > > > > +
> > > > > + const struct imx283_input_frequency *freq;
> > > > > +
> > > > > + struct v4l2_subdev sd;
> > > > > + struct media_pad pad;
> > > > > +
> > > > > + struct clk *xclk;
> > > > > +
> > > > > + struct gpio_desc *reset_gpio;
> > > > > + struct regulator_bulk_data supplies[ARRAY_SIZE(imx283_supply_name)];
> > > > > +
> > > > > + /* V4L2 Controls */
> > > > > + struct v4l2_ctrl_handler ctrl_handler;
> > > > > + struct v4l2_ctrl *exposure;
> > > > > + struct v4l2_ctrl *vblank;
> > > > > + struct v4l2_ctrl *hblank;
> > > > > + struct v4l2_ctrl *vflip;
> > > > > +
> > > > > + unsigned long link_freq_bitmap;
> > > > > +
> > > > > + u16 hmax;
> > > > > + u32 vmax;
> > > > > +};
> > > > > +
> > > > > +static inline struct imx283 *to_imx283(struct v4l2_subdev *_sd)
> > > > > +{
> > > > > + return container_of(_sd, struct imx283, sd);
> > > >
> > > > It's a function, you can call _sd sd instead.
> > >
> > > Except then that could 'look' like it is passed as the first and third
> > > argument to container_of...
> >
> > It's really a non-issue: the third argument is a field name, not a
> > variable.
>
> That's not so easy to determine when the args are the same name.., but
> it's fine with me either way.
>
> > > But if it's fine / accepted otherwise then sure.
> >
> > And please use container_of_const(). :)
>
> Ack. Or rather ... I'll leave that to Umang to handle, as he's managing
> this driver now.
>
> > > > > +
> > > > > +/* Determine the exposure based on current hmax, vmax and a given SHR */
> > > > > +static u64 imx283_exposure(struct imx283 *imx283,
> > > > > + const struct imx283_mode *mode, u64 shr)
> > > > > +{
> > > > > + u32 svr = 0; /* SVR feature is not currently supported */
> > > >
> > > > What does this refer to? I guess you could just drop it as well if it's not
> > > > supported?
> > >
> > > Keeping this will keep the calculation matching the datasheet, and
> > > provide clear value for what to update when we/others return to enable
> > > long exposures.
> > >
> > > So it would be nice to keep as it sort of documents/tracks the
> > > datasheet.
> >
> > Ack.
> >
> > >
> > >
> > > > > + u32 hmax = imx283->hmax;
> > > > > + u64 vmax = imx283->vmax;
> > > >
> > > > You're not changing the values here. I wouldn't introduce temporary
> > > > variables just for that.
> > > >
> > > > > + u32 offset;
> > > > > + u64 numerator;
> > > > > +
> > > > > + /* Number of clocks per internal offset period */
> > > > > + offset = mode->mode == IMX283_MODE_0 ? 209 : 157;
> > > >
> > > > Shouldn't this be in the mode definition?
> > >
> > > It could be, but then there would be one copy of 209, and 9 copies of
> > > 157.
> >
> > That would still be specified explicitly. Someone adding a new mode would
> > easily miss this.
> >
> > Or, if you can, derive this from something else that is now a part of the
> > mode itself.
>
> I don't understand the above, other than ... That's exactly what we're
> doing here.
Index of the mode, not the mode itself. They're different.
>
> *Only* MODE_0 has an offset of 209 in the datasheet. All other modes are
> 157.
>
> This is the table being codified:
> https://pasteboard.co/OsKf4VX7rtrS.png
Ok, fine by me. Maybe a comment at the end of the mode list to check this
when adding new modes? There are other sources of modes than the datasheet.
--
Sakari Ailus
prev parent reply other threads:[~2024-03-11 17:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240307214048.858318-1-umang.jain@ideasonboard.com>
2024-03-07 21:40 ` [PATCH v2 1/2] media: dt-bindings: media: Add bindings for IMX283 Umang Jain
2024-03-07 22:27 ` Rob Herring
2024-03-07 21:40 ` [PATCH v2 2/2] media: i2c: Add imx283 camera sensor driver Umang Jain
2024-03-07 23:11 ` Andy Shevchenko
2024-03-07 23:13 ` Andy Shevchenko
2024-03-08 7:15 ` Sakari Ailus
2024-03-11 12:28 ` Kieran Bingham
2024-03-11 16:29 ` Sakari Ailus
2024-03-11 16:42 ` Kieran Bingham
2024-03-11 17:10 ` Sakari Ailus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ze87Hya-cqmkqjMC@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=alain.volmat@foss.st.com \
--cc=andy.shevchenko@gmail.com \
--cc=bingbu.cao@intel.com \
--cc=hdegoede@redhat.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@bootlin.com \
--cc=paul.elder@ideasonboard.com \
--cc=sre@kernel.org \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=umang.jain@ideasonboard.com \
--cc=will@willwhang.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®