mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Conor Dooley <conor+dt@kernel.org>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Philippe Baetens <philippebaetens@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Subject: Re: [PATCH v8 2/2] media: i2c: Add driver for AMS-OSRAM Mira220
Date: Sat, 25 Jul 2026 00:27:25 +0530	[thread overview]
Message-ID: <178491944579.3026322.17711300671190246368@freya> (raw)
In-Reply-To: <20260724-mira220-v8-2-d1899ab64709@ideasonboard.com>

Hi Jacopo,

Thank you for the fixes!

Quoting Jacopo Mondi (2026-07-24 21:07:01)
> From: Philippe Baetens <philippebaetens@gmail.com>
> 
> Add a V4L2 subdev driver for driver for the AMS-OSRAM Mira220 image
> sensor.
> 
> Mira220 is a global shutter image sensor with a resolution of 1600x1400
> pixels.
> 
> The driver implements support for mono and RGB 12, 10 and 8 bits
> formats. The output data-rate per lane is 1500Mbit/s, with a maximum
> frame rate up to 90 fps.
> 
> Signed-off-by: Philippe Baetens <philippebaetens@gmail.com>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> 

[...]

> +static int mira220_parse_endpoint(struct device *dev, struct mira220 *mira220)
> +{
> +       struct fwnode_handle *endpoint;
> +       struct v4l2_fwnode_endpoint ep_cfg = {
> +               .bus_type = V4L2_MBUS_CSI2_DPHY
> +       };
> +       int ret = 0;
> +
> +       endpoint = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 0, 0, 0);
> +       if (!endpoint) {
> +               dev_err(dev, "Endpoint node not found\n");
> +               return -EINVAL;
> +       }
> +
> +       if (v4l2_fwnode_endpoint_alloc_parse(endpoint, &ep_cfg)) {
> +               ret = -EINVAL;
> +               dev_err(dev, "Failed to parse endpoint\n");
> +               goto error_out;
> +       }
> +
> +       /* Non-continuous mode not implemented. */
> +       if (ep_cfg.bus.mipi_csi2.flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK) {
> +               dev_warn(dev, "clock non-continuous mode not supported\n");
> +               ret = -EINVAL;
> +               goto error_out;
> +       }
> +
> +       if (ep_cfg.nr_of_link_frequencies > ARRAY_SIZE(mira220_link_freqs)) {
> +               ret = -EINVAL;
> +               dev_err(dev, "Unsupported number of link_frequencies: %u\n",
> +                       ep_cfg.nr_of_link_frequencies);
> +               goto error_out;
> +       }
> +
> +       if (ep_cfg.link_frequencies[0] != MIRA220_LINK_FREQ_750M) {

The LLM-bot says link_frequencies[0] might be invalid if DT omitted the
link-frequencies property, and I think that's a valid concern.

Any particular reason for not using the v4l2_link_freq_to_bitmap() helper I
had suggested? It can handles all of these cases and error msgs too.

With the edge case fixed (with or without the helper):

Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>

Thanks,
    Jai
> +               ret = -EINVAL;
> +               dev_err(dev, "Unsupported link_frequency: %llu\n",
> +                       ep_cfg.link_frequencies[0]);
> +               goto error_out;
> +       }
> +
> +       /* Check the number of MIPI CSI2 data lanes */
> +       if (ep_cfg.bus.mipi_csi2.num_data_lanes != 1 &&
> +           ep_cfg.bus.mipi_csi2.num_data_lanes != 2) {
> +               ret = -EINVAL;
> +               dev_err(dev, "%u data lanes are not supported\n",
> +                       ep_cfg.bus.mipi_csi2.num_data_lanes);
> +               goto error_out;
> +       }
> +
> +       mira220->lanes = ep_cfg.bus.mipi_csi2.num_data_lanes;
> +       mira220->row_length = MIRA220_ROW_LENGTH_MIN * (2 / mira220->lanes);
> +
> +error_out:
> +       v4l2_fwnode_endpoint_free(&ep_cfg);
> +       fwnode_handle_put(endpoint);
> +
> +       return ret;
> +}
> +

  reply	other threads:[~2026-07-24 18:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-24 15:36 [PATCH v8 0/2] media: i2c: Add driver for Mira220 Jacopo Mondi
2026-07-24 15:37 ` [PATCH v8 1/2] dt-bindings: media: i2c: Add mira220 image sensor Jacopo Mondi
2026-07-24 15:37 ` [PATCH v8 2/2] media: i2c: Add driver for AMS-OSRAM Mira220 Jacopo Mondi
2026-07-24 18:57   ` Jai Luthra [this message]
2026-07-27  6:46     ` Jacopo Mondi
2026-07-27  7:43       ` Jai Luthra
2026-07-27  7:47         ` Jacopo Mondi

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=178491944579.3026322.17711300671190246368@freya \
    --to=jai.luthra@ideasonboard.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=philippebaetens@gmail.com \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.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

all inboxes | Powered by JetHome®