The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Keke Li <keke.li@amlogic.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.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, kieran.bingham@ideasonboard.com,
	dan.scally@ideasonboard.com
Subject: Re: [PATCH v4 02/10] media: platform: Add c3 mipi csi2 driver
Date: Thu, 12 Dec 2024 18:52:03 +0800	[thread overview]
Message-ID: <ada3520f-157d-4ba3-a344-7db018241ca0@amlogic.com> (raw)
In-Reply-To: <2jc3sqihnj7sd7vjj7542nntc45eratyxi7diuaewlbqqbixbp@vlgkpv6vm6wr>


On 2024/12/12 17:41, Jacopo Mondi wrote:
> [ EXTERNAL EMAIL ]
>
> Hi Keke
>
> On Thu, Dec 12, 2024 at 05:08:27PM +0800, Keke Li wrote:
>> On 2024/12/12 16:41, Jacopo Mondi wrote:
>>> [ EXTERNAL EMAIL ]
>>>
>>> Hi Keke,
>>>     a question for Laurent and Sakari
>>>
>>> On Thu, Dec 05, 2024 at 05:04:28PM +0800, Keke Li via B4 Relay wrote:
>>>> From: Keke Li <keke.li@amlogic.com>
>>>>
>>>> This driver is used to receive mipi data from image sensor.
>>>>
>>>> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>>>> Signed-off-by: Keke Li <keke.li@amlogic.com>
>>> [snip]
>>>
>>>> +
>>>> +static int c3_mipi_csi_configure_clocks(struct csi_device *csi)
>>>> +{
>>>> +     const struct csi_info *info = csi->info;
>>>> +     int ret;
>>>> +     u32 i;
>>>> +
>>>> +     for (i = 0; i < info->clock_num; i++)
>>>> +             csi->clks[i].id = info->clocks[i];
>>>> +
>>>> +     ret = devm_clk_bulk_get(csi->dev, info->clock_num, csi->clks);
>>>> +     if (ret)
>>>> +             return ret;
>>>> +
>>>> +     for (i = 0; i < info->clock_num; i++) {
>>>> +             if (!info->clock_rates[i])
>>>> +                     continue;
>>>> +             ret = clk_set_rate(csi->clks[i].clk, info->clock_rates[i]);
>>>> +             if (ret) {
>>>> +                     dev_err(csi->dev, "Failed to set %s rate %u\n", info->clocks[i],
>>>> +                             info->clock_rates[i]);
>>>> +                     return ret;
>>>> +             }
>>>> +     }
>>>> +
>>>> +     return 0;
>>>> +}
>>>> +
>>> [snip]
>>>
>>>> +
>>>> +static const struct csi_info c3_mipi_csi_info = {
>>>> +     .clocks = {"vapb", "phy0"},
>>>> +     .clock_rates = {0, 200000000},
>>>> +     .clock_num = 2
>>>> +};
>>>> +
>>>> +static const struct of_device_id c3_mipi_csi_of_match[] = {
>>>> +     { .compatible = "amlogic,c3-mipi-csi2",
>>>> +       .data = &c3_mipi_csi_info,
>>>> +     },
>>>> +     { },
>>>> +};
>>> All the drivers in this patch series implement the same pattern when
>>> it comes to handling clock. There's a list of clock providers in the
>>> driver associated with a clock frequency. The driver bulk_get the
>>> clocks and set_rate() using the per-compatible info table.
>>>
>>> Do you think this should rather come from dts using the
>>> assigned-clocks and assigned-clock-rates properties ?
>> Yes,  I think your suggestion is OK.
>>
>> Will test it.
>>
>> If apply your suggestion, do I need to modify the relevant yaml file?
>>
> Do you mean the binding files ?
>
> You could add to the example
>
> --- a/Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml
> +++ b/Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml
> @@ -73,6 +73,8 @@ examples:
>               clocks = <&clkc_periphs CLKID_VAPB>,
>                        <&clkc_periphs CLKID_ISP0>;
>               clock-names = "vapb", "isp0";
> +            assigned-clocks = <&clkc_periphs CLKID_ISP0>;
> +            assigned-clock-rates = <400000000>;
>               interrupts = <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>;
>
>               port {
>
>
> As your binding document has "additionalProperties: false" I thought
> you had to add:
>
>    assigned-clocks: true
>    assigned-clock-rates: true
>
> As in my understanding "additionalProperties: false" means "whatever
> is not explicitly allowed is forbidden". However I might be wrong as
> validating the binding even without the two above entries work well
> (and I see other bindings doing the same)
>
> DT maintainers are in cc


OK, will add 'assigned-clocks' and 'assigned-clock-rates' in dt-binding. 
Thanks very much.


  reply	other threads:[~2024-12-12 10:52 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-05  9:04 [PATCH v4 00/10] Amlogic C3 ISP support Keke Li via B4 Relay
2024-12-05  9:04 ` [PATCH v4 01/10] dt-bindings: media: Add amlogic,c3-mipi-csi2.yaml Keke Li via B4 Relay
2024-12-05  9:04 ` [PATCH v4 02/10] media: platform: Add c3 mipi csi2 driver Keke Li via B4 Relay
2024-12-10 16:29   ` Jacopo Mondi
2024-12-12  6:09     ` Keke Li
2024-12-12  8:41   ` Jacopo Mondi
2024-12-12  9:08     ` Keke Li
2024-12-12  9:41       ` Jacopo Mondi
2024-12-12 10:52         ` Keke Li [this message]
2024-12-05  9:04 ` [PATCH v4 03/10] dt-bindings: media: Add amlogic,c3-mipi-adapter.yaml Keke Li via B4 Relay
2024-12-05  9:04 ` [PATCH v4 04/10] media: platform: Add c3 mipi adapter driver Keke Li via B4 Relay
2024-12-11 15:42   ` Jacopo Mondi
2024-12-12  6:30     ` Keke Li
2024-12-12  7:50       ` Jacopo Mondi
2024-12-05  9:04 ` [PATCH v4 05/10] dt-bindings: media: Add amlogic,c3-isp.yaml Keke Li via B4 Relay
2024-12-05  9:04 ` [PATCH v4 06/10] media: Add C3ISP_PARAMS and C3ISP_STATS meta formats Keke Li via B4 Relay
2024-12-11 16:04   ` Jacopo Mondi
2024-12-12  6:42     ` Keke Li
2024-12-05  9:04 ` [PATCH v4 07/10] media: uapi: Add stats buffer and parameters buffer for c3 ISP Keke Li via B4 Relay
2024-12-11 17:21   ` Jacopo Mondi
2024-12-12  8:44     ` Keke Li
2024-12-05  9:04 ` [PATCH v4 08/10] media: platform: Add c3 ISP driver Keke Li via B4 Relay
2024-12-12 15:39   ` Jacopo Mondi
2024-12-13 11:14     ` Keke Li
2024-12-13 11:34       ` Jacopo Mondi
2024-12-13 11:51         ` Keke Li
2024-12-05  9:04 ` [PATCH v4 09/10] Documentation: media: add documentation file metafmt-c3-isp.rst Keke Li via B4 Relay
2024-12-05  9:04 ` [PATCH v4 10/10] Documentation: media: add documentation file c3-isp.rst Keke Li via B4 Relay

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=ada3520f-157d-4ba3-a344-7db018241ca0@amlogic.com \
    --to=keke.li@amlogic.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kieran.bingham@ideasonboard.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=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