diff options
author | Dong Aisheng <aisheng.dong@nxp.com> | 2020-07-29 10:00:13 +0200 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2020-10-26 03:53:54 +0100 |
commit | 78edeb080330ca2bc6c9b20d388c8ceb7a2ef8c0 (patch) | |
tree | 8b581d423dac8ad6439085627407e28c5afdde49 /drivers/clk/imx | |
parent | clk: imx: scu: allow scu clk to take device pointer (diff) | |
download | linux-78edeb080330ca2bc6c9b20d388c8ceb7a2ef8c0.tar.xz linux-78edeb080330ca2bc6c9b20d388c8ceb7a2ef8c0.zip |
clk: imx: scu: add runtime pm support
Add runtime pm support
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Diffstat (limited to 'drivers/clk/imx')
-rw-r--r-- | drivers/clk/imx/clk-scu.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index a67cca0a32ad..f5dc6731a217 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -11,6 +11,7 @@ #include <linux/of_platform.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> +#include <linux/pm_runtime.h> #include <linux/slab.h> #include "clk-scu.h" @@ -453,15 +454,32 @@ static int imx_clk_scu_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct imx_scu_clk_node *clk = dev_get_platdata(dev); struct clk_hw *hw; + int ret; + + pm_runtime_set_suspended(dev); + pm_runtime_set_autosuspend_delay(dev, 50); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(dev); + + ret = pm_runtime_get_sync(dev); + if (ret) { + pm_runtime_disable(dev); + return ret; + } - hw = __imx_clk_scu(NULL, clk->name, clk->parents, clk->num_parents, + hw = __imx_clk_scu(dev, clk->name, clk->parents, clk->num_parents, clk->rsrc, clk->clk_type); - if (IS_ERR(hw)) + if (IS_ERR(hw)) { + pm_runtime_disable(dev); return PTR_ERR(hw); + } clk->hw = hw; list_add_tail(&clk->node, &imx_scu_clks[clk->rsrc]); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_put_autosuspend(&pdev->dev); + dev_dbg(dev, "register SCU clock rsrc:%d type:%d\n", clk->rsrc, clk->clk_type); |