From c3fccf1615be6548b50274851557f579b6320b5b Mon Sep 17 00:00:00 2001 From: Nikita Travkin Date: Mon, 11 Mar 2024 14:53:04 +0500 Subject: [PATCH] HACK: clk: Delay disabling unused clocks by 10s There is a forever-lasting problem with qcom clocks that causes display subsystem crash due to "disp_cc_mdss_mdp_clk status stuck at 'off'" if the clocks were cleaned up before msm claimed this one. Delay disabling unused clocks by 10 seconds to work around this. Signed-off-by: Nikita Travkin --- drivers/clk/clk.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 50228cb0c559..f0647ecca9ac 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1347,7 +1347,7 @@ static void clk_core_disable_unprepare(struct clk_core *core) clk_core_unprepare_lock(core); } -static void __init clk_unprepare_unused_subtree(struct clk_core *core) +static void clk_unprepare_unused_subtree(struct clk_core *core) { struct clk_core *child; @@ -1377,7 +1377,7 @@ static void __init clk_unprepare_unused_subtree(struct clk_core *core) clk_pm_runtime_put(core); } -static void __init clk_disable_unused_subtree(struct clk_core *core) +static void clk_disable_unused_subtree(struct clk_core *core) { struct clk_core *child; unsigned long flags; @@ -1431,15 +1431,10 @@ static int __init clk_ignore_unused_setup(char *__unused) } __setup("clk_ignore_unused", clk_ignore_unused_setup); -static int __init clk_disable_unused(void) +static void clk_disable_unused_work_function(struct work_struct *work) { struct clk_core *core; - if (clk_ignore_unused) { - pr_warn("clk: Not disabling unused clocks\n"); - return 0; - } - pr_info("clk: Disabling unused clocks\n"); clk_prepare_lock(); @@ -1457,6 +1452,19 @@ static int __init clk_disable_unused(void) clk_unprepare_unused_subtree(core); clk_prepare_unlock(); +} +static DECLARE_DELAYED_WORK(clk_disable_unused_work, + clk_disable_unused_work_function); + +static int __init clk_disable_unused(void) +{ + if (clk_ignore_unused) { + pr_warn("clk: Not disabling unused clocks\n"); + return 0; + } + + schedule_delayed_work(&clk_disable_unused_work, + msecs_to_jiffies(10000)); return 0; } -- 2.44.0