From: Robert Foss <robert.foss@linaro.org>
To: bjorn.andersson@linaro.org, agross@kernel.org,
mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org,
krzk+dt@kernel.org, jonathan@marek.ca, tdas@codeaurora.org,
anischal@codeaurora.org, linux-arm-msm@vger.kernel.org,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Vinod Koul <vkoul@kernel.org>
Subject: [PATCH v1 2/9] clk: Introduce CLK_ASSUME_ENABLED_WHEN_UNUSED
Date: Fri, 29 Apr 2022 17:12:40 +0200 [thread overview]
Message-ID: <20220429151247.388837-2-robert.foss@linaro.org> (raw)
In-Reply-To: <20220429151247.388837-1-robert.foss@linaro.org>
From: Bjorn Andersson <bjorn.andersson@linaro.org>
Some clock implementations doesn't provide means of implementing
is_enabled(), but still requires to be explicitly disabled when found
unused as part of clk_disable_unused().
One such set of clocks are Qualcomm's display RCGs. These can be enabled
and disabled automatically by the hardware, so it's not possible to
reliably query their configuration. Further more, these clocks need to
be disabled when unused, to allow them to be "parked" onto a safe
parent. Failure to disable the RCG results in the hardware locking up as
clk_disable_unused() traverses up the tree and turns off its source
clocks.
Add a new flag, CLK_ASSUME_ENABLED_BOOT, which clock drivers can use to
signal that these clocks should be disabled even if they don't implement
the is_enabled() ops.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
---
drivers/clk/clk.c | 2 +-
include/linux/clk-provider.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ed119182aa1b..9789ec137219 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1284,7 +1284,7 @@ static void __init clk_disable_unused_subtree(struct clk_core *core)
* sequence. call .disable_unused if available, otherwise fall
* back to .disable
*/
- if (clk_core_is_enabled(core)) {
+ if (clk_core_is_enabled(core) || core->flags & CLK_ASSUME_ENABLED_WHEN_UNUSED) {
trace_clk_disable(core);
if (core->ops->disable_unused)
core->ops->disable_unused(core->hw);
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index c10dc4c659e2..9038022ffebd 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -32,6 +32,8 @@
#define CLK_OPS_PARENT_ENABLE BIT(12)
/* duty cycle call may be forwarded to the parent clock */
#define CLK_DUTY_CYCLE_PARENT BIT(13)
+/* assume clock is enabled if found unused in late init */
+#define CLK_ASSUME_ENABLED_WHEN_UNUSED BIT(14)
struct clk;
struct clk_hw;
--
2.32.0
next prev parent reply other threads:[~2022-04-29 15:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 15:12 [PATCH v1 1/9] clk: qcom: rcg2: Cache rate changes for parked RCGs Robert Foss
2022-04-29 15:12 ` Robert Foss [this message]
2022-04-29 15:26 ` [PATCH v1 2/9] clk: Introduce CLK_ASSUME_ENABLED_WHEN_UNUSED Dmitry Baryshkov
2022-04-29 15:12 ` [PATCH v1 3/9] clk: qcom: sm8250-dispcc: Flag shared RCGs as assumed enable Robert Foss
2022-04-29 15:12 ` [PATCH v1 4/9] clk: qcom: add support for SM8350 GPUCC Robert Foss
2022-04-29 15:31 ` Dmitry Baryshkov
2022-05-02 13:50 ` Robert Foss
2022-05-02 14:52 ` Dmitry Baryshkov
2022-05-03 12:47 ` Robert Foss
2022-04-29 15:12 ` [PATCH v1 5/9] dt-bindings: clock: Add Qcom SM8350 GPUCC bindings Robert Foss
2022-04-29 15:32 ` Dmitry Baryshkov
2022-04-29 15:12 ` [PATCH v1 6/9] clk: qcom: add support for SM8350 DISPCC Robert Foss
2022-04-29 15:35 ` Dmitry Baryshkov
2022-04-29 15:12 ` [PATCH v1 7/9] dt-bindings: clock: Add Qcom SM8350 DISPCC bindings Robert Foss
2022-04-29 15:36 ` Dmitry Baryshkov
2022-04-29 15:12 ` [PATCH v1 8/9] arm64: dts: qcom: sm8350: Power up dispcc using MMCX regulator Robert Foss
2022-04-29 15:37 ` Dmitry Baryshkov
2022-04-29 15:12 ` [PATCH v1 9/9] arm64: dts: qcom: sm8350: Add DISPCC node Robert Foss
2022-04-29 15:37 ` Dmitry Baryshkov
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=20220429151247.388837-2-robert.foss@linaro.org \
--to=robert.foss@linaro.org \
--cc=agross@kernel.org \
--cc=anischal@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=jonathan@marek.ca \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=tdas@codeaurora.org \
--cc=vkoul@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).