diff options
-rw-r--r-- | drivers/clocksource/sh_tmu.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 808135768617..17296288a205 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/clk.h> | 27 | #include <linux/clk.h> |
28 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
29 | #include <linux/err.h> | 30 | #include <linux/err.h> |
30 | #include <linux/clocksource.h> | 31 | #include <linux/clocksource.h> |
@@ -109,10 +110,12 @@ static int sh_tmu_enable(struct sh_tmu_priv *p) | |||
109 | { | 110 | { |
110 | int ret; | 111 | int ret; |
111 | 112 | ||
112 | /* enable clock */ | 113 | /* wake up device and enable clock */ |
114 | pm_runtime_get_sync(&p->pdev->dev); | ||
113 | ret = clk_enable(p->clk); | 115 | ret = clk_enable(p->clk); |
114 | if (ret) { | 116 | if (ret) { |
115 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 117 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
118 | pm_runtime_put_sync(&p->pdev->dev); | ||
116 | return ret; | 119 | return ret; |
117 | } | 120 | } |
118 | 121 | ||
@@ -141,8 +144,9 @@ static void sh_tmu_disable(struct sh_tmu_priv *p) | |||
141 | /* disable interrupts in TMU block */ | 144 | /* disable interrupts in TMU block */ |
142 | sh_tmu_write(p, TCR, 0x0000); | 145 | sh_tmu_write(p, TCR, 0x0000); |
143 | 146 | ||
144 | /* stop clock */ | 147 | /* stop clock and mark device as idle */ |
145 | clk_disable(p->clk); | 148 | clk_disable(p->clk); |
149 | pm_runtime_put_sync(&p->pdev->dev); | ||
146 | } | 150 | } |
147 | 151 | ||
148 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, | 152 | static void sh_tmu_set_next(struct sh_tmu_priv *p, unsigned long delta, |
@@ -411,6 +415,7 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
411 | 415 | ||
412 | if (p) { | 416 | if (p) { |
413 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 417 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
418 | pm_runtime_enable(&pdev->dev); | ||
414 | return 0; | 419 | return 0; |
415 | } | 420 | } |
416 | 421 | ||
@@ -425,6 +430,9 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev) | |||
425 | kfree(p); | 430 | kfree(p); |
426 | platform_set_drvdata(pdev, NULL); | 431 | platform_set_drvdata(pdev, NULL); |
427 | } | 432 | } |
433 | |||
434 | if (!is_early_platform_device(pdev)) | ||
435 | pm_runtime_enable(&pdev->dev); | ||
428 | return ret; | 436 | return ret; |
429 | } | 437 | } |
430 | 438 | ||