[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <622301ae-0973-4cdb-936c-3152afdbfb46@foss.st.com>
Date: Wed, 30 Apr 2025 10:23:22 +0200
From: Benjamin Mugnier <benjamin.mugnier@...s.st.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
CC: Sylvain Petinot <sylvain.petinot@...s.st.com>,
Mauro Carvalho Chehab
<mchehab@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski
<krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, <linux-media@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 2/2] media: i2c: Add driver for ST VD55G1 camera sensor
Hi Sakari,
On 4/29/25 14:01, Sakari Ailus wrote:
> 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.
>
As far as I understand it should be fine in v7, could you have a look
once sent ?
>>>> + 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,
Benjamin
Powered by blists - more mailing lists