From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: Mikhail Rudenko <mike.rudenko@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Shawn Tu <shawnx.tu@intel.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
Mike Pagano <mpagano@gentoo.org>,
Randy Dunlap <rdunlap@infradead.org>, Marek Vasut <marex@denx.de>,
Jimmy Su <jimmy.su@intel.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] media: i2c: add support for OV4689
Date: Tue, 25 Oct 2022 18:07:16 +0000 [thread overview]
Message-ID: <Y1gl1FMAjhXCfCmk@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20221025130958.bnedjlkm6kmiluoe@uno.localdomain>
Hi Jacopo,
On Tue, Oct 25, 2022 at 03:09:58PM +0200, Jacopo Mondi wrote:
> > +static int ov4689_configure_regulators(struct ov4689 *ov4689)
> > +{
> > + unsigned int supplies_count = ARRAY_SIZE(ov4689_supply_names);
No need for a temporary variable.
> > + unsigned int i;
> > +
> > + for (i = 0; i < supplies_count; i++)
> > + ov4689->supplies[i].supply = ov4689_supply_names[i];
> > +
> > + return devm_regulator_bulk_get(&ov4689->client->dev, supplies_count,
> > + ov4689->supplies);
> > +}
> > +
> > +static u64 ov4689_check_link_frequency(struct v4l2_fwnode_endpoint *ep)
> > +{
> > + unsigned int freqs_count = ARRAY_SIZE(link_freq_menu_items);
> > + const u64 *freqs = link_freq_menu_items;
> > + unsigned int i, j;
> > +
> > + for (i = 0; i < freqs_count; i++) {
Ditto.
> > + for (j = 0; j < ep->nr_of_link_frequencies; j++)
> > + if (freqs[i] == ep->link_frequencies[j])
> > + return freqs[i];
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int ov4689_check_hwcfg(struct device *dev)
> > +{
> > + struct fwnode_handle *fwnode = dev_fwnode(dev);
> > + struct v4l2_fwnode_endpoint bus_cfg = {
> > + .bus_type = V4L2_MBUS_CSI2_DPHY,
> > + };
> > + struct fwnode_handle *endpoint;
> > + int ret;
> > +
> > + endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
> > + if (!endpoint)
> > + return -EINVAL;
> > +
> > + ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &bus_cfg);
> > + fwnode_handle_put(endpoint);
> > + if (ret)
> > + return ret;
> > +
> > + if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV4689_LANES) {
> > + dev_err(dev, "Only a 4-lane CSI2 config is supported");
> > + ret = -EINVAL;
> > + goto out_free_bus_cfg;
> > + }
> > +
> > + if (!bus_cfg.nr_of_link_frequencies) {
> > + dev_err(dev, "No link frequencies defined\n");
> > + ret = -EINVAL;
> > + goto out_free_bus_cfg;
> > + }
>
> As the driver has a single supported freq I wonder if it is required
> to have it mandatory. I got contradictory feedbacks in the past, so
> whatever you have here I guess it's fine (same reasoning goes for dts,
> if there's only one accepted item, does it need to be made mandatory
> ?)
This check could indeed be removed, the one below already handles the case.
The driver can be amended in the future to support additional frequencies.
It probably requires more code here, too...
I've got this in my tree, feel free to send a follow-up patch.
>
> Nits apart, the driver looks sane
>
> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Thanks!
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2022-10-25 18:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-22 16:20 [PATCH v4 0/2] Add Omnivision OV4689 image sensor driver Mikhail Rudenko
2022-10-22 16:20 ` [PATCH v4 1/2] media: dt-bindings: i2c: document OV4689 Mikhail Rudenko
2022-10-22 16:20 ` [PATCH v4 2/2] media: i2c: add support for OV4689 Mikhail Rudenko
2022-10-25 13:09 ` Jacopo Mondi
2022-10-25 13:51 ` Mikhail Rudenko
2022-10-27 7:07 ` Jacopo Mondi
2022-10-25 18:07 ` Sakari Ailus [this message]
2022-10-26 12:45 ` [PATCH] media: i2c: ov4689: code cleanup Mikhail Rudenko
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=Y1gl1FMAjhXCfCmk@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=jacopo@jmondi.org \
--cc=jimmy.su@intel.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=marex@denx.de \
--cc=mchehab@kernel.org \
--cc=mike.rudenko@gmail.com \
--cc=mpagano@gentoo.org \
--cc=rdunlap@infradead.org \
--cc=robh+dt@kernel.org \
--cc=shawnx.tu@intel.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