[PATCH 2/2] clk: renesas: rzg2l: Register PM notifier to disable unused clocks

Claudiu claudiu.beznea at tuxon.dev
Thu Aug 21 01:03:32 PDT 2025


From: Claudiu Beznea <claudiu.beznea.uj at bp.renesas.com>

Register a PM notifier to disable unused clocks after system resume.
This is necessary when resuming from a low-power mode where the bootloader
re-enables certain module clocks for its own use.

To avoid keeping these clocks enabled after control is passed back to
Linux, call clk_disable_unused() from a PM_POST_SUSPEND notifier.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj at bp.renesas.com>
---
 drivers/clk/renesas/rzg2l-cpg.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 187233302818..2ca32d7acaf7 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -24,6 +24,7 @@
 #include <linux/iopoll.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_clock.h>
@@ -31,6 +32,7 @@
 #include <linux/reset-controller.h>
 #include <linux/slab.h>
 #include <linux/string_choices.h>
+#include <linux/suspend.h>
 #include <linux/units.h>
 
 #include <dt-bindings/clock/renesas-cpg-mssr.h>
@@ -150,6 +152,7 @@ struct rzg2l_pll5_mux_dsi_div_param {
  * @info: Pointer to platform data
  * @genpd: PM domain
  * @mux_dsi_div_params: pll5 mux and dsi div parameters
+ * @pm_notifier: PM notifier
  */
 struct rzg2l_cpg_priv {
 	struct reset_controller_dev rcdev;
@@ -168,6 +171,8 @@ struct rzg2l_cpg_priv {
 	struct generic_pm_domain genpd;
 
 	struct rzg2l_pll5_mux_dsi_div_param mux_dsi_div_params;
+
+	struct notifier_block pm_notifier;
 };
 
 static void rzg2l_cpg_del_clk_provider(void *data)
@@ -1879,6 +1884,21 @@ static int __init rzg2l_cpg_add_clk_domain(struct rzg2l_cpg_priv *priv)
 	return of_genpd_add_provider_simple(np, genpd);
 }
 
+static int rzg2l_pm_notifier(struct notifier_block *nb, unsigned long action,
+			     void *data)
+{
+	int ret;
+
+	if (action != PM_POST_SUSPEND)
+		return 0;
+
+	ret = clk_disable_unused();
+	if (ret)
+		return NOTIFY_BAD;
+
+	return NOTIFY_OK;
+}
+
 static int __init rzg2l_cpg_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1948,6 +1968,10 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev)
 		return error;
 
 	debugfs_create_file("mstop", 0444, NULL, priv, &rzg2l_mod_clock_mstop_fops);
+
+	priv->pm_notifier.notifier_call = rzg2l_pm_notifier;
+	register_pm_notifier(&priv->pm_notifier);
+
 	return 0;
 }
 
-- 
2.43.0




More information about the linux-arm-kernel mailing list