Skip to content

Commit 78edeb0

Browse files
Dong AishengShawn Guo
authored andcommitted
clk: imx: scu: add runtime pm support
Add runtime pm support Cc: Shawn Guo <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: Michael Turquette <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Signed-off-by: Dong Aisheng <[email protected]> Signed-off-by: Shawn Guo <[email protected]>
1 parent 2f1a2c1 commit 78edeb0

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

drivers/clk/imx/clk-scu.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/of_platform.h>
1212
#include <linux/platform_device.h>
1313
#include <linux/pm_domain.h>
14+
#include <linux/pm_runtime.h>
1415
#include <linux/slab.h>
1516

1617
#include "clk-scu.h"
@@ -453,15 +454,32 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
453454
struct device *dev = &pdev->dev;
454455
struct imx_scu_clk_node *clk = dev_get_platdata(dev);
455456
struct clk_hw *hw;
457+
int ret;
458+
459+
pm_runtime_set_suspended(dev);
460+
pm_runtime_set_autosuspend_delay(dev, 50);
461+
pm_runtime_use_autosuspend(&pdev->dev);
462+
pm_runtime_enable(dev);
463+
464+
ret = pm_runtime_get_sync(dev);
465+
if (ret) {
466+
pm_runtime_disable(dev);
467+
return ret;
468+
}
456469

457-
hw = __imx_clk_scu(NULL, clk->name, clk->parents, clk->num_parents,
470+
hw = __imx_clk_scu(dev, clk->name, clk->parents, clk->num_parents,
458471
clk->rsrc, clk->clk_type);
459-
if (IS_ERR(hw))
472+
if (IS_ERR(hw)) {
473+
pm_runtime_disable(dev);
460474
return PTR_ERR(hw);
475+
}
461476

462477
clk->hw = hw;
463478
list_add_tail(&clk->node, &imx_scu_clks[clk->rsrc]);
464479

480+
pm_runtime_mark_last_busy(&pdev->dev);
481+
pm_runtime_put_autosuspend(&pdev->dev);
482+
465483
dev_dbg(dev, "register SCU clock rsrc:%d type:%d\n", clk->rsrc,
466484
clk->clk_type);
467485

0 commit comments

Comments
 (0)