summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal Feng <hal.feng@starfivetech.com>2024-04-23 13:08:06 +0300
committerHal Feng <hal.feng@starfivetech.com>2024-04-24 05:20:30 +0300
commitdf5359eb22ba0ce75147f916d4b409199abbafd0 (patch)
treec3d4db66509be88af3407e9d13d02b5f6ca66559
parent9a1b3afddb72d2afafcf60a430a767c77ed82f02 (diff)
downloadlinux-df5359eb22ba0ce75147f916d4b409199abbafd0.tar.xz
clk: starfive: jh7110-isp: Add sleep pm ops and enable runtime autosuspend
Add sleep pm ops and enable runtime autosuspend for isp clock driver. Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
-rw-r--r--drivers/clk/starfive/clk-starfive-jh7110-isp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-isp.c b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
index 046a975aeac3..5fe8260b4de2 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-isp.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-isp.c
@@ -86,6 +86,18 @@ static struct clk_hw *jh7110_ispclk_get(struct of_phandle_args *clkspec, void *d
return ERR_PTR(-EINVAL);
}
+#ifdef CONFIG_PM_SLEEP
+static int jh7110_ispcrg_sleep_suspend(struct device *dev)
+{
+ return pm_runtime_force_suspend(dev);
+}
+
+static int jh7110_ispcrg_sleep_resume(struct device *dev)
+{
+ return pm_runtime_force_resume(dev);
+}
+#endif
+
#ifdef CONFIG_PM
static int jh7110_ispcrg_suspend(struct device *dev)
{
@@ -105,6 +117,7 @@ static int jh7110_ispcrg_resume(struct device *dev)
static const struct dev_pm_ops jh7110_ispcrg_pm_ops = {
RUNTIME_PM_OPS(jh7110_ispcrg_suspend, jh7110_ispcrg_resume, NULL)
+ LATE_SYSTEM_SLEEP_PM_OPS(jh7110_ispcrg_sleep_suspend, jh7110_ispcrg_sleep_resume)
};
#endif
@@ -138,6 +151,8 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev)
return dev_err_probe(priv->dev, ret, "failed to get main clocks\n");
dev_set_drvdata(priv->dev, top);
+ pm_runtime_use_autosuspend(priv->dev);
+ pm_runtime_set_autosuspend_delay(priv->dev, 50);
/* enable power domain and clocks */
pm_runtime_enable(priv->dev);
ret = pm_runtime_get_sync(priv->dev);
@@ -195,6 +210,8 @@ static int jh7110_ispcrg_probe(struct platform_device *pdev)
if (ret)
goto err_exit;
+ pm_runtime_put_sync(&pdev->dev);
+
return 0;
err_exit: