From: Paul Cercueil <paul@crapouillou.net>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Russell King <linux@armlinux.org.uk>,
Ulf Hansson <ulf.hansson@linaro.org>,
od@zcrc.me, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
linux-mmc@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: Add clk_get_first_to_set_rate
Date: Sat, 13 Mar 2021 23:09:23 +0000 [thread overview]
Message-ID: <NBKXPQ.SZZ17JHCOG5G@crapouillou.net> (raw)
In-Reply-To: <161567452539.1478170.2985873696192051312@swboyd.mtv.corp.google.com>
Hi Stephen,
Le sam. 13 mars 2021 à 14:28, Stephen Boyd <sboyd@kernel.org> a écrit
:
> Quoting Paul Cercueil (2021-03-07 09:07:41)
>> The purpose of this function is to be used along with the notifier
>> mechanism.
>>
>> When a parent clock can see its rate externally changed at any
>> moment,
>> and a driver needs a specific clock rate to function, it can
>> register a
>> notifier on the parent clock, and call clk_set_rate() on the base
>> clock
>> to adjust its frequency according to the new parent clock.
>
> Can the driver use the rate locking mechanism to get a certain rate
> instead of registering for notifiers and trying to react to changes?
You mean with clk_rate_exclusive_get()? That sounds like a good idea,
but what would happen when a different driver calls the non-exclusive
clk_set_rate() on this clock (or the parent), would it return -EBUSY,
lock on a mutex? ...
Cheers,
-Paul
>
>>
>> This works fine, until the base clock has the CLK_SET_RATE_PARENT
>> flag
>> set. In that case, calling clk_set_rate() on the base clock will
>> call
>> clk_set_rate() on the parent clock, which will trigger the notifier
>> again, and we're in a loop.
>>
>> For that reason, we need to register the notifier on the parent
>> clock of
>> the first ancestor of the base clock that will effectively modify
>> its
>> rate when clk_set_rate() is called, which we can now obtain with
>> clk_get_first_to_set_rate().
>>
>> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
next prev parent reply other threads:[~2021-03-13 23:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-07 17:07 [PATCH 0/2] mmc: jz4740: Support PLL frequency changes Paul Cercueil
2021-03-07 17:07 ` [PATCH 1/2] clk: Add clk_get_first_to_set_rate Paul Cercueil
2021-03-13 22:28 ` Stephen Boyd
2021-03-13 23:09 ` Paul Cercueil [this message]
2021-03-07 17:07 ` [PATCH 2/2] mmc: jz4740: Add support for monitoring PLL clock rate changes Paul Cercueil
2021-03-08 3:58 ` kernel test robot
2021-03-08 14:46 ` Paul Cercueil
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=NBKXPQ.SZZ17JHCOG5G@crapouillou.net \
--to=paul@crapouillou.net \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mturquette@baylibre.com \
--cc=od@zcrc.me \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.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