|
11 | 11 | #include <linux/of_platform.h>
|
12 | 12 | #include <linux/platform_device.h>
|
13 | 13 | #include <linux/pm_domain.h>
|
| 14 | +#include <linux/pm_runtime.h> |
14 | 15 | #include <linux/slab.h>
|
15 | 16 |
|
16 | 17 | #include "clk-scu.h"
|
@@ -453,15 +454,32 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
|
453 | 454 | struct device *dev = &pdev->dev;
|
454 | 455 | struct imx_scu_clk_node *clk = dev_get_platdata(dev);
|
455 | 456 | 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 | + } |
456 | 469 |
|
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, |
458 | 471 | clk->rsrc, clk->clk_type);
|
459 |
| - if (IS_ERR(hw)) |
| 472 | + if (IS_ERR(hw)) { |
| 473 | + pm_runtime_disable(dev); |
460 | 474 | return PTR_ERR(hw);
|
| 475 | + } |
461 | 476 |
|
462 | 477 | clk->hw = hw;
|
463 | 478 | list_add_tail(&clk->node, &imx_scu_clks[clk->rsrc]);
|
464 | 479 |
|
| 480 | + pm_runtime_mark_last_busy(&pdev->dev); |
| 481 | + pm_runtime_put_autosuspend(&pdev->dev); |
| 482 | + |
465 | 483 | dev_dbg(dev, "register SCU clock rsrc:%d type:%d\n", clk->rsrc,
|
466 | 484 | clk->clk_type);
|
467 | 485 |
|
|
0 commit comments