public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthias Fend <matthias.fend@emfend.at>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Hans Verkuil" <hverkuil@kernel.org>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ricardo Ribalda" <ribalda@chromium.org>,
	"André Apitzsch" <git@apitzsch.eu>,
	"Tarang Raval" <tarang.raval@siliconsignals.io>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
	"Dongcheng Yan" <dongcheng.yan@intel.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Jingjing Xiong" <jingjing.xiong@intel.com>,
	"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
	"Mehdi Djait" <mehdi.djait@linux.intel.com>,
	"Vladimir Zapolskiy" <vladimir.zapolskiy@linaro.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Hardevsinh Palaniya" <hardevsinh.palaniya@siliconsignals.io>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Hao Yao" <hao.yao@intel.com>,
	bsp-development.geo@leica-geosystems.com
Subject: Re: [PATCH v4 2/2] media: i2c: add Himax HM1246 image sensor driver
Date: Mon, 3 Nov 2025 17:19:47 +0100	[thread overview]
Message-ID: <a7c2b507-90e8-4b0b-92d6-5b232e7ba22f@emfend.at> (raw)
In-Reply-To: <aQiL111bKgKE6M22@kekkonen.localdomain>

Hi Sakari,

Am 03.11.2025 um 12:02 schrieb Sakari Ailus:
> Hi Matthias,
> 
> Thanks for the ping.
> 
> On Mon, Nov 03, 2025 at 07:54:52AM +0100, Matthias Fend wrote:
>> Hi Sakari,
>>
>> Am 23.10.2025 um 11:00 schrieb Matthias Fend:
>>> Hi Sakari,
>>>
>>> thanks a lot for your feedback.
>>
>> I had two follow-up questions regarding your feedback, but I suspect they
>> got lost in all the code. I've cleaned up this mail a bit to make the
>> questions more visible.
>>
>>>>> +
>>>>> +static int hm1246_update_controls(struct hm1246 *hm1246,
>>>>> +                  const struct hm1246_mode *mode)
>>>>> +{
>>>>> +    s64 pixel_rate, exposure_max, vblank, hblank;
>>>>> +    int ret;
>>>>> +
>>>>> +    ret = __v4l2_ctrl_s_ctrl(hm1246->link_freq_ctrl, mode-
>>>>>> link_freq_index);
>>>>
>>>> Does this do something? There's only a single link frequency value (and
>>>> index) supported.
>>>
>>> You're right. Even though hm1246_update_controls() isn't exactly wrong,
>>> I could currently remove this function completely. The sensor supports
>>> various modes (which result in different clock rates), and I've already
>>> started implementing more of them. With multiple modes the controls need
>>> to be updated. However, since there were still some internal sensor
>>> issues to be addressed and I haven't been able to fully test them, I've
>>> decided to use only the presumably most common RAW mode for now.
>>>
>>> Should I remove the function now and add it back once more modes are
>>> implemented?
> 
> I think it'd be better to postpone adding this. I think you'll need further
> logic to support this and it'd be better to review this in conjunction with
> the additional features.

Okay, then I will remove hm1246_update_controls() for now.

> 
>>>
>> ...
>>>>> +static int hm1246_parse_fwnode(struct hm1246 *hm1246)
>>>>> +{
>>>>> +    struct fwnode_handle *endpoint;
>>>>> +    struct v4l2_fwnode_endpoint bus_cfg = {
>>>>> +        .bus_type = V4L2_MBUS_PARALLEL,
>>>>> +    };
>>>>> +    int ret;
>>>>> +
>>>>> +    endpoint =
>>>>> fwnode_graph_get_endpoint_by_id(dev_fwnode(hm1246- >dev), 0,
>>>>> +                           0,
>>>>> +                           FWNODE_GRAPH_ENDPOINT_NEXT);
>>>>> +    if (!endpoint)
>>>>> +        return dev_err_probe(hm1246->dev, -EINVAL,
>>>>> +                     "missing endpoint node\n");
>>>>> +
>>>>> +    ret = v4l2_fwnode_endpoint_parse(endpoint, &bus_cfg);
>>>>
>>>> What about validating the link frequencies? You can use
>>>> v4l2_link_freq_to_bitmap(), too.
>>>
>>> I was under the impression that for sensors with a parallel interface,
>>> no frequency information is provided in the device tree (because there's
>>> no need for it). Since there are no frequency entries, they can't be
>>> verified.
>>>
>>> Am I wrong, or did you perhaps mean something else?
> 
> The current documentation
> <URL:https://hverkuil.home.xs4all.nl/spec/driver-api/camera-sensor.html>
> doesn't distinguish CSI-2 and parallel interfaces in this respect. It's a
> good idea to ensure a safe frequency is used as the driver works the same
> way in all cases, whether or not using one is mandatory.

If I understand correctly, this means that in the bindings, the port 
property 'link-frequencies' should be marked as 'required', and the port 
in the example node should be extended with the line 'link-frequencies = 
/bits/ 64 <42174000>;'.
Then, during probe, it can be checked with v4l2_link_freq_to_bitmap() 
whether the link frequency entered in the device tree is supported (this 
also requires switching to v4l2_fwnode_endpoint_alloc_parse).

Does this describe the desired change?

Thanks for your help!
  ~Matthias

> 


  reply	other threads:[~2025-11-03 16:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 10:49 [PATCH v4 0/2] media: add Himax HM1246 image sensor Matthias Fend
2025-10-17 10:49 ` [PATCH v4 1/2] media: dt-bindings: i2c: " Matthias Fend
2025-10-17 10:49 ` [PATCH v4 2/2] media: i2c: add Himax HM1246 image sensor driver Matthias Fend
2025-10-18 20:30   ` Andy Shevchenko
2025-10-20  7:21     ` Matthias Fend
2025-10-20  9:58       ` Andy Shevchenko
2025-10-21 14:46   ` Sakari Ailus
2025-10-23  9:00     ` Matthias Fend
2025-11-03  6:54       ` Matthias Fend
2025-11-03 11:02         ` Sakari Ailus
2025-11-03 16:19           ` Matthias Fend [this message]
2025-11-04  8:29             ` 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=a7c2b507-90e8-4b0b-92d6-5b232e7ba22f@emfend.at \
    --to=matthias.fend@emfend.at \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=bsp-development.geo@leica-geosystems.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dongcheng.yan@intel.com \
    --cc=git@apitzsch.eu \
    --cc=hansg@kernel.org \
    --cc=hao.yao@intel.com \
    --cc=hardevsinh.palaniya@siliconsignals.io \
    --cc=heimir.sverrisson@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=jingjing.xiong@intel.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=ribalda@chromium.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    --cc=sylvain.petinot@foss.st.com \
    --cc=tarang.raval@siliconsignals.io \
    --cc=vladimir.zapolskiy@linaro.org \
    /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