devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Cc: Sylvain Petinot <sylvain.petinot@foss.st.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/2] media: i2c: Add driver for ST VD55G1 camera sensor
Date: Tue, 29 Apr 2025 12:01:07 +0000	[thread overview]
Message-ID: <aBC_gx8vFNWLacgB@kekkonen.localdomain> (raw)
In-Reply-To: <70f7bc9b-4533-4c8e-a792-aad9a0b7a6d4@foss.st.com>

Hi Benjamin,

On Tue, Apr 29, 2025 at 01:29:39PM +0200, Benjamin Mugnier wrote:
> >> +static int vd55g1_check_csi_conf(struct vd55g1 *sensor,
> >> +				 struct fwnode_handle *endpoint)
> >> +{
> >> +	struct i2c_client *client = sensor->i2c_client;
> >> +	struct v4l2_fwnode_endpoint ep = { .bus_type = V4L2_MBUS_CSI2_DPHY };
> >> +	u8 n_lanes;
> >> +	int ret;
> >> +
> >> +	ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &ep);
> >> +	if (ret)
> >> +		return -EINVAL;
> >> +
> >> +	/* Check lanes number */
> >> +	n_lanes = ep.bus.mipi_csi2.num_data_lanes;
> >> +	if (n_lanes != 1) {
> >> +		dev_err(&client->dev, "Sensor only supports 1 lane, found %d\n",
> >> +			n_lanes);
> >> +		ret = -EINVAL;
> >> +		goto done;
> >> +	}
> >> +
> >> +	/* Clock lane must be first */
> >> +	if (ep.bus.mipi_csi2.clock_lane != 0) {
> >> +		dev_err(&client->dev, "Clock lane must be mapped to lane 0\n");
> >> +		ret = -EINVAL;
> >> +		goto done;
> >> +	}
> >> +
> >> +	/* Handle polarities in sensor configuration */
> >> +	sensor->oif_ctrl = (ep.bus.mipi_csi2.lane_polarities[0] << 3) |
> >> +			   (ep.bus.mipi_csi2.lane_polarities[1] << 6);
> >> +
> >> +	/* Check the link frequency set in device tree */
> >> +	if (!ep.nr_of_link_frequencies) {
> >> +		dev_err(&client->dev, "link-frequency property not found in DT\n");
> >> +		ret = -EINVAL;
> >> +		goto done;
> >> +	}
> >> +	if (ep.nr_of_link_frequencies != 1) {
> >> +		dev_err(&client->dev, "Multiple link frequencies not supported\n");
> >> +		ret = -EINVAL;
> >> +		goto done;
> > 
> > Please check the link frequency matches with what the driver supports,
> > using e.g. v4l2_link_freq_to_bitmap().
> > 
> 
> Are you referring to checks performed in in vd55g1_prepare_clock_tree()
> ? Keep in mind it will change a bit with Laurent's comments though.
> The sensor supports a range of frequencies therefore I chose to check it
> manually instead of v4l2_link_freq_to_bitmap().

Ok, that's fine then. But please check this results to the frequency that
was requested, currently it may be off AFAIR.

> >> +	ret = v4l2_async_register_subdev(&sensor->sd);
> >> +	if (ret) {
> >> +		dev_err(dev, "async subdev register failed %d\n", ret);
> >> +		goto err_subdev;
> >> +	}
> > 
> > Aren't you missing:
> > 
> > 	pm_runtime_put_autosuspend(dev);
> > 
> > here?
> > 
> 
> Thank you. I'll add it to the pm_runtime block above.
> I also noticed I miss the pm_runtime_dont_use_autosuspend() call in
> err_power_off. I'll add that too.

Ack, sounds good.

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2025-04-29 12:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  9:17 [PATCH v6 0/2] media: Add support for ST VD55G1 camera sensor Benjamin Mugnier
2025-04-07  9:17 ` [PATCH v6 1/2] media: dt-bindings: Add " Benjamin Mugnier
2025-04-07  9:17 ` [PATCH v6 2/2] media: i2c: Add driver for " Benjamin Mugnier
2025-04-29 11:01   ` Sakari Ailus
2025-04-29 11:29     ` Benjamin Mugnier
2025-04-29 12:01       ` Sakari Ailus [this message]
2025-04-30  8:23         ` Benjamin Mugnier
2025-04-30  8:35           ` Sakari Ailus

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=aBC_gx8vFNWLacgB@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sylvain.petinot@foss.st.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;
as well as URLs for NNTP newsgroup(s).