mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: Chuan Liu <chuan.liu@amlogic.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,
	Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Subject: Re: [PATCH] opp: Allow multiple clocks for primary clock operations
Date: Tue, 1 Dec 2026 21:50:12 +0800	[thread overview]
Message-ID: <0085e298-fe27-4e10-8e8b-0bde027df5e2@oss.qualcomm.com> (raw)
In-Reply-To: <142270f1-f22c-4264-b141-6b67c3d3fc61@amlogic.com>

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.



-- 
Thx and BRs,
Zhongqiu Han

      reply	other threads:[~2026-12-01 13:50 UTC|newest]

Thread overview: 4+ 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 [this message]

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=0085e298-fe27-4e10-8e8b-0bde027df5e2@oss.qualcomm.com \
    --to=zhongqiu.han@oss.qualcomm.com \
    --cc=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 \
    /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®