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