2022-08-22 08:26:10

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH RESEND v2 0/2] clk: Fix CLK_OPS_PARENT_ENABLE and runtime PM

Hi Mike, Stephen,

Resending this series from last month. This is now based on
next-20220822, but should apply cleanly to v6.0-rc1.

Here are a couple fixes for the clk core. They are unrelated but overlap
in diff context, so I'm sending them together.

Patch 1 makes the clk core honor CLK_OPS_PARENT_ENABLE for clk gate ops.
Without this, dumping clk_summary on the MT8192 would cause the system
to hang.

Patch 2 reorders the runtime PM call in clk_core_unprepare() to match
the order described in its original commit, and the opposite of that
in clk_core_prepare().

Changes since v1
- Use clk_core_{enable,disable}_lock() instead of non-locking variant.
Reported by NĂ­colas
- Added coverage for clk_core_is_prepared()
- Correct sequencing in clk_core_is_enabled() so that runtime PM is
handled before parent clock is enabled, matching other functions.


Regards
ChenYu

Chen-Yu Tsai (2):
clk: core: Honor CLK_OPS_PARENT_ENABLE for clk gate ops
clk: core: Fix runtime PM sequence in clk_core_unprepare()

drivers/clk/clk.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)

--
2.37.1.595.g718a3a8f04-goog


2022-08-22 09:06:15

by Chen-Yu Tsai

[permalink] [raw]
Subject: [PATCH RESEND v2 2/2] clk: core: Fix runtime PM sequence in clk_core_unprepare()

In the original commit 9a34b45397e5 ("clk: Add support for runtime PM"),
the commit message mentioned that pm_runtime_put_sync() would be done
at the end of clk_core_unprepare(). This mirrors the operations in
clk_core_prepare() in the opposite order.

However, the actual code that was added wasn't in the order the commit
message described. Move clk_pm_runtime_put() to the end of
clk_core_unprepare() so that it is in the correct order.

Fixes: 9a34b45397e5 ("clk: Add support for runtime PM")
Signed-off-by: Chen-Yu Tsai <[email protected]>
Reviewed-by: NĂ­colas F. R. A. Prado <[email protected]>
---
drivers/clk/clk.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 9b365cd6d14b..2e29a72c68e1 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -859,13 +859,12 @@ static void clk_core_unprepare(struct clk_core *core)
if (core->ops->unprepare)
core->ops->unprepare(core->hw);

- clk_pm_runtime_put(core);
-
trace_clk_unprepare_complete(core);

if (core->flags & CLK_OPS_PARENT_ENABLE)
clk_core_disable_lock(core->parent);
clk_core_unprepare(core->parent);
+ clk_pm_runtime_put(core);
}

static void clk_core_unprepare_lock(struct clk_core *core)
--
2.37.1.595.g718a3a8f04-goog