[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0fc7f15c-66be-4ba0-9549-51ba87f48690@amlogic.com>
Date: Thu, 12 Dec 2024 17:08:27 +0800
From: Keke Li <keke.li@...ogic.com>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: 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,
kieran.bingham@...asonboard.com, dan.scally@...asonboard.com
Subject: Re: [PATCH v4 02/10] media: platform: Add c3 mipi csi2 driver
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@...ogic.com>
>>
>> This driver is used to receive mipi data from image sensor.
>>
>> Reviewed-by: Daniel Scally <dan.scally@...asonboard.com>
>> Signed-off-by: Keke Li <keke.li@...ogic.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?
Powered by blists - more mailing lists