mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
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>
This commit is contained in:
parent
df5359eb22
commit
aa98aa446a
1 changed files with 17 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue