mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuan Liu <chuan.liu@amlogic.com>
To: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] opp: Allow multiple clocks for primary clock operations
Date: Fri, 4 Dec 2026 15:17:28 +0800	[thread overview]
Message-ID: <c8b54344-cf8a-45e2-bb9c-c450ecf20af0@amlogic.com> (raw)
In-Reply-To: <0085e298-fe27-4e10-8e8b-0bde027df5e2@oss.qualcomm.com>

Hi Zhongqiu,

On 12/1/2026 9:50 PM, Zhongqiu Han wrote:
> [你通常不会收到来自 zhongqiu.han@oss.qualcomm.com 的电子邮件。请访问 
> https://aka.ms/LearnAboutSenderIdentification,以了解这一点为什么很重要]
> 
> [ EXTERNAL EMAIL ]
> 
> On 12/1/2026 9:01 PM, Chuan Liu wrote:
>> Hi Viresh,
>>
>> Thanks for your review.
>>
>> On 12/1/2026 6:12 PM, Viresh Kumar wrote:
>>> [ EXTERNAL EMAIL ]
>>>
>>> On 01-12-26, 17:34, Chuan Liu via B4 Relay wrote:
>>>> @@ -2376,24 +2376,24 @@ static int _opp_set_clknames(struct opp_table
>>>> *opp_table, struct device *dev,
>>>>        opp_table->clk_count = count;
>>>>        opp_table->config_clks = config_clks;
>>>>
>>>> +     /*
>>>> +      * We could have just dropped the "clk" field and used "clks"
>>>> +      * everywhere. Instead we kept the "clk" field around for
>>>> +      * following reasons:
>>>> +      *
>>>> +      * - avoiding clks[0] everywhere else.
>>>> +      * - not running single clk helpers for multiple clk usecase by
>>>> +      *   mistake.
>>>> +      *
>>>> +      * Since some OPP helpers still rely on the primary clock, update
>>>> +      * the "clk" pointer to the first clock.
>>>> +      */
>>>> +     opp_table->clk = opp_table->clks[0];
>>>> +
>>>>        /* Set generic single clk set here */
>>>>        if (count == 1) {
>>>>                if (!opp_table->config_clks)
>>>>                        opp_table->config_clks = _opp_config_clk_single;
>>>> -
>>>> -             /*
>>>> -              * We could have just dropped the "clk" field and used
>>>> "clks"
>>>> -              * everywhere. Instead we kept the "clk" field around for
>>>> -              * following reasons:
>>>> -              *
>>>> -              * - avoiding clks[0] everywhere else.
>>>> -              * - not running single clk helpers for multiple clk
>>>> usecase by
>>>> -              *   mistake.
>>>> -              *
>>>> -              * Since this is single-clk case, just update the clk
>>>> pointer
>>>> -              * too.
>>>> -              */
>>>> -             opp_table->clk = opp_table->clks[0];
>>>
>>> Why is this change required ?
>>
>> OPP core uses opp_table->clk as the primary clock in several paths, e.g.:
>>
>>    dev_pm_opp_set_rate()
>>      -> clk_round_rate(opp_table->clk, target_freq) [1]
>>      -> _set_opp()
>>         -> _find_current_opp()
>>            -> IS_ERR(opp_table->clk) / clk_get_rate(opp_table->clk) [2]
>>
>> Without this hunk, ->clk stays at ERR_PTR(-ENODEV) for multi-clk tables.
>>
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
>> tree/drivers/opp/core.c?h=v7.4-rc5#n1439
>> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
>> tree/drivers/opp/core.c?h=v7.4-rc5#n1245
>>
> 
> If making ->clk the primary clock for multi-clk tables is acceptable,
> the "not running single clk helpers for multiple clk usecase
> by mistake" bullet in the comment above would be stale, and the @clk
> kerneldoc in opp.h ("for single clock") would need an update too.

Thanks for pointing this out, this approach does seem inappropriate and 
I will discard it.

> 
> 
> 
> -- 
> Thx and BRs,
> Zhongqiu Han

-- 
Best regards,
Chuan


  reply	other threads:[~2026-12-04  7:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  9:34 Chuan Liu via B4 Relay
2026-12-01 10:12 ` Viresh Kumar
2026-12-01 13:01   ` Chuan Liu
2026-12-01 13:50     ` Zhongqiu Han
2026-12-04  7:17       ` Chuan Liu [this message]
2026-12-03 10:31     ` Viresh Kumar
2026-12-04  7:14       ` Chuan Liu

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=c8b54344-cf8a-45e2-bb9c-c450ecf20af0@amlogic.com \
    --to=chuan.liu@amlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@kernel.org \
    --cc=zhongqiu.han@oss.qualcomm.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

all inboxes | Powered by JetHome®