summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal Feng <hal.feng@starfivetech.com>2024-04-23 13:09:53 +0300
committerHal Feng <hal.feng@starfivetech.com>2024-04-24 05:20:50 +0300
commitaa98aa446a728628cf6d61c5b0958a5972d74d99 (patch)
tree5825e43bc1fd2baed60b46353fe3ab030c105c71
parentdf5359eb22ba0ce75147f916d4b409199abbafd0 (diff)
downloadlinux-aa98aa446a728628cf6d61c5b0958a5972d74d99.tar.xz
clk: starfive: jh7110-vout: Add sleep pm ops and enable runtime autosuspend
Add sleep pm ops and enable runtime autosuspend for vout clock driver. Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
-rw-r--r--drivers/clk/starfive/clk-starfive-jh7110-vout.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/clk/starfive/clk-starfive-jh7110-vout.c b/drivers/clk/starfive/clk-starfive-jh7110-vout.c
index dcba067c3ba6..80f9be979c30 100644
--- a/drivers/clk/starfive/clk-starfive-jh7110-vout.c
+++ b/drivers/clk/starfive/clk-starfive-jh7110-vout.c
@@ -91,6 +91,18 @@ static struct clk_hw *jh7110_voutclk_get(struct of_phandle_args *clkspec, void *
return ERR_PTR(-EINVAL);
}
+#ifdef CONFIG_PM_SLEEP
+static int jh7110_voutcrg_sleep_suspend(struct device *dev)
+{
+ return pm_runtime_force_suspend(dev);
+}
+
+static int jh7110_voutcrg_sleep_resume(struct device *dev)
+{
+ return pm_runtime_force_resume(dev);
+}
+#endif
+
#ifdef CONFIG_PM
static int jh7110_voutcrg_suspend(struct device *dev)
{
@@ -110,6 +122,7 @@ static int jh7110_voutcrg_resume(struct device *dev)
static const struct dev_pm_ops jh7110_voutcrg_pm_ops = {
RUNTIME_PM_OPS(jh7110_voutcrg_suspend, jh7110_voutcrg_resume, NULL)
+ LATE_SYSTEM_SLEEP_PM_OPS(jh7110_voutcrg_sleep_suspend, jh7110_voutcrg_sleep_resume)
};
#endif
@@ -143,6 +156,8 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev)
return dev_err_probe(priv->dev, ret, "failed to get top 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);
@@ -202,6 +217,8 @@ static int jh7110_voutcrg_probe(struct platform_device *pdev)
if (ret)
goto err_exit;
+ pm_runtime_put_sync(&pdev->dev);
+
return 0;
err_exit: