[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZZ0snE1r0BnFHWUh@kekkonen.localdomain>
Date: Tue, 9 Jan 2024 11:23:08 +0000
From: "sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>
To: Zhi Mao (毛智) <zhi.mao@...iatek.com>
Cc: "heiko@...ech.de" <heiko@...ech.de>,
"gerald.loacker@...fvision.net" <gerald.loacker@...fvision.net>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"yunkec@...omium.org" <yunkec@...omium.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dan.scally@...asonboard.com" <dan.scally@...asonboard.com>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
Shengnan Wang (王圣男) <shengnan.wang@...iatek.com>,
"hdegoede@...hat.com" <hdegoede@...hat.com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
Yaya Chang (張雅清) <Yaya.Chang@...iatek.com>,
"mchehab@...nel.org" <mchehab@...nel.org>,
"jacopo.mondi@...asonboard.com" <jacopo.mondi@...asonboard.com>,
"jernej.skrabec@...il.com" <jernej.skrabec@...il.com>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"bingbu.cao@...el.com" <bingbu.cao@...el.com>,
Project_Global_Chrome_Upstream_Group <Project_Global_Chrome_Upstream_Group@...iatek.com>,
"conor+dt@...nel.org" <conor+dt@...nel.org>,
"10572168@...com" <10572168@...com>,
"hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>,
"tomi.valkeinen@...asonboard.com" <tomi.valkeinen@...asonboard.com>,
"krzysztof.kozlowski+dt@...aro.org" <krzysztof.kozlowski+dt@...aro.org>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>,
"laurent.pinchart@...asonboard.com" <laurent.pinchart@...asonboard.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"angelogioacchino.delregno@...labora.com" <angelogioacchino.delregno@...labora.com>,
"macromorgan@...mail.com" <macromorgan@...mail.com>
Subject: Re: [PATCH 1/2] media: i2c: Add GC08A3 image sensor driver
Hi Zhi,
On Tue, Jan 09, 2024 at 10:41:15AM +0000, Zhi Mao (毛智) wrote:
> > > +static const char *const gc08a3_supply_name[] = {
> > > +"avdd",
> > > +"dvdd",
> > > +"dovdd",
> > > +};
> > > +
> > > +#define GC08A3_NUM_SUPPLIES ARRAY_SIZE(gc08a3_supply_name)
> >
> > Please use ARRAY_SIZE(...) directly.
> >
> [mtk]: About "ARRAY_SIZE", creating a macro with a descriptive name can
> improve readability of code, especially when it is used in multiple
> locations in codes. and it seems a common usage in sensor drivers. Can
> we keep this usage in gc08a3 driver?
It improves readability even more if you use ARRAY_SIZE() directly as then
it's easy to see you're dealing with a single array. GC08A3_NUM_SUPPLIES is
thus a useless definition.
..
> > > +static int gc08a3_g_mbus_config(struct v4l2_subdev *sd, unsigned
> > int pad,
> > > +struct v4l2_mbus_config *config)
> > > +{
> > > +config->type = V4L2_MBUS_CSI2_DPHY;
> > > +config->bus.mipi_csi2.num_data_lanes = 4;
> > > +config->bus.mipi_csi2.flags = 0;
> > > +return 0;
> > > +}
> >
> > As you return a static configuration, there's no need to implement
> > g_mbus_config().
> >
> [mtk]: we can not remove this function, because meidatek ISP driver
> will use this interface to get some information.
Please fix the Mediatek ISP driver in that case.
I'm also open to adding a V4L2 framework function to obtain the number of
lanes (and other configuration) for an upstream sub-device, either using
the local endpoint or g_mbus_config if the sub-device driver implements
that.
--
Regards,
Sakari Ailus
Powered by blists - more mailing lists