From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] OPP: Allow multiple clocks for a device
Date: Thu, 30 Jun 2022 14:39:43 +0200 [thread overview]
Message-ID: <4cac6c79-ea9a-1f48-c6f1-2e04b54590a4@linaro.org> (raw)
In-Reply-To: <de13cca4-3a33-6482-7b02-f89796f45325@linaro.org>
On 30/06/2022 14:32, Krzysztof Kozlowski wrote:
> On 10/06/2022 10:20, Viresh Kumar wrote:
>> This patch adds support to allow multiple clocks for a device.
>>
>> The design is pretty much similar to how this is done for regulators,
>> and platforms can supply their own version of the config_clks() callback
>> if they have multiple clocks for their device. The core manages the
>> calls via opp_table->config_clks() eventually.
>>
>> We have kept both "clk" and "clks" fields in the OPP table structure and
>> the reason is provided as a comment in _opp_set_clknames(). The same
>> isn't done for "rates" though and we use rates[0] at most of the places
>> now.
>>
>> Co-developed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> (...)
>
>> + rates = kmalloc_array(count, sizeof(*rates), GFP_KERNEL);
>> + if (!rates)
>> + return -ENOMEM;
>> +
>> + ret = of_property_read_u64_array(np, "opp-hz", rates, count);
>> + if (ret) {
>> + pr_err("%s: Error parsing opp-hz: %d\n", __func__, ret);
>> + } else {
>> + /*
>> + * Rate is defined as an unsigned long in clk API, and so
>> + * casting explicitly to its type. Must be fixed once rate is 64
>> + * bit guaranteed in clk API.
>> + */
>> + for (i = 0; i < count; i++) {
>> + new_opp->rates[i] = (unsigned long)rates[i];
>> +
>> + /* This will happen for frequencies > 4.29 GHz */
>> + WARN_ON(new_opp->rates[i] != rates[i]);
>> + }
>> + }
>> +
>> + kfree(rates);
>> +
>> + return ret;
>> +}
>> +
>> static int _read_bw(struct dev_pm_opp *new_opp, struct opp_table *opp_table,
>> struct device_node *np, bool peak)
>> {
>> @@ -812,19 +859,13 @@ static int _read_opp_key(struct dev_pm_opp *new_opp,
>> struct opp_table *opp_table, struct device_node *np)
>> {
>> bool found = false;
>> - u64 rate;
>> int ret;
>>
>> - ret = of_property_read_u64(np, "opp-hz", &rate);
>> - if (!ret) {
>> - /*
>> - * Rate is defined as an unsigned long in clk API, and so
>> - * casting explicitly to its type. Must be fixed once rate is 64
>> - * bit guaranteed in clk API.
>> - */
>> - new_opp->rate = (unsigned long)rate;
>> + ret = _read_rate(new_opp, opp_table, np);
>> + if (ret)
>> + return ret;
>> + else if (opp_table->clk_count == 1)
>
> Shouldn't this be >=1? I got several clocks and this one fails.
Actually this might be correct, but you need to update the bindings. Now
you require opp-level for case with multiple clocks.
Best regards,
Krzysztof
next prev parent reply other threads:[~2022-06-30 12:39 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 8:20 [PATCH 0/8] OPP: Add support for multiple clocks Viresh Kumar
2022-06-10 8:20 ` [PATCH 1/8] OPP: Use consistent names for OPP table instances Viresh Kumar
2022-06-10 8:20 ` [PATCH 2/8] OPP: Remove rate_not_available parameter to _opp_add() Viresh Kumar
2022-06-10 8:20 ` [PATCH 3/8] OPP: Reuse _opp_compare_key() in _opp_add_static_v2() Viresh Kumar
2022-06-22 13:58 ` Jon Hunter
2022-06-22 14:07 ` Viresh Kumar
2022-06-10 8:20 ` [PATCH 4/8] OPP: Make dev_pm_opp_set_opp() independent of frequency Viresh Kumar
2022-06-10 8:20 ` [PATCH 5/8] OPP: Allow multiple clocks for a device Viresh Kumar
2022-06-13 8:07 ` Viresh Kumar
2022-06-22 13:47 ` Jon Hunter
2022-06-22 14:15 ` Viresh Kumar
2022-06-22 15:27 ` Jon Hunter
2022-06-29 18:33 ` Dmitry Osipenko
2022-06-30 0:50 ` Viresh Kumar
2022-06-30 9:13 ` Dmitry Osipenko
2022-06-30 9:52 ` Viresh Kumar
2022-06-30 9:57 ` Dmitry Osipenko
2022-06-30 10:15 ` Viresh Kumar
2022-07-04 12:09 ` Viresh Kumar
2022-07-04 13:17 ` Dmitry Osipenko
2022-07-04 15:52 ` Viresh Kumar
2022-07-04 18:04 ` Dmitry Osipenko
2022-07-05 4:08 ` Viresh Kumar
2022-06-30 8:38 ` Krzysztof Kozlowski
2022-06-30 9:39 ` Viresh Kumar
2022-06-30 12:32 ` Krzysztof Kozlowski
2022-06-30 12:39 ` Krzysztof Kozlowski [this message]
2022-07-01 6:47 ` Viresh Kumar
2022-07-05 6:59 ` Viresh Kumar
2022-07-05 8:18 ` Krzysztof Kozlowski
2022-07-05 8:40 ` Viresh Kumar
2022-06-10 8:20 ` [PATCH 6/8] OPP: Add key specific assert() method to key finding helpers Viresh Kumar
2022-06-10 8:20 ` [PATCH 7/8] OPP: Assert clk_count == 1 for single clk helpers Viresh Kumar
2022-06-10 8:20 ` [PATCH 8/8] OPP: Provide a simple implementation to configure multiple clocks Viresh Kumar
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=4cac6c79-ea9a-1f48-c6f1-2e04b54590a4@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rafael@kernel.org \
--cc=sboyd@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vireshk@kernel.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;
as well as URLs for NNTP newsgroup(s).