diff options
Diffstat (limited to 'drivers/clocksource/sh_cmt.c')
-rw-r--r-- | drivers/clocksource/sh_cmt.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index dc7c033ef587..036e5865eb40 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ioport.h> | 24 | #include <linux/ioport.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/pm_runtime.h> | ||
27 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
29 | #include <linux/clocksource.h> | 30 | #include <linux/clocksource.h> |
@@ -152,10 +153,12 @@ static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | |||
152 | { | 153 | { |
153 | int ret; | 154 | int ret; |
154 | 155 | ||
155 | /* enable clock */ | 156 | /* wake up device and enable clock */ |
157 | pm_runtime_get_sync(&p->pdev->dev); | ||
156 | ret = clk_enable(p->clk); | 158 | ret = clk_enable(p->clk); |
157 | if (ret) { | 159 | if (ret) { |
158 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | 160 | dev_err(&p->pdev->dev, "cannot enable clock\n"); |
161 | pm_runtime_put_sync(&p->pdev->dev); | ||
159 | return ret; | 162 | return ret; |
160 | } | 163 | } |
161 | 164 | ||
@@ -187,8 +190,9 @@ static void sh_cmt_disable(struct sh_cmt_priv *p) | |||
187 | /* disable interrupts in CMT block */ | 190 | /* disable interrupts in CMT block */ |
188 | sh_cmt_write(p, CMCSR, 0); | 191 | sh_cmt_write(p, CMCSR, 0); |
189 | 192 | ||
190 | /* stop clock */ | 193 | /* stop clock and mark device as idle */ |
191 | clk_disable(p->clk); | 194 | clk_disable(p->clk); |
195 | pm_runtime_put_sync(&p->pdev->dev); | ||
192 | } | 196 | } |
193 | 197 | ||
194 | /* private flags */ | 198 | /* private flags */ |
@@ -660,6 +664,7 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
660 | 664 | ||
661 | if (p) { | 665 | if (p) { |
662 | dev_info(&pdev->dev, "kept as earlytimer\n"); | 666 | dev_info(&pdev->dev, "kept as earlytimer\n"); |
667 | pm_runtime_enable(&pdev->dev); | ||
663 | return 0; | 668 | return 0; |
664 | } | 669 | } |
665 | 670 | ||
@@ -674,6 +679,9 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev) | |||
674 | kfree(p); | 679 | kfree(p); |
675 | platform_set_drvdata(pdev, NULL); | 680 | platform_set_drvdata(pdev, NULL); |
676 | } | 681 | } |
682 | |||
683 | if (!is_early_platform_device(pdev)) | ||
684 | pm_runtime_enable(&pdev->dev); | ||
677 | return ret; | 685 | return ret; |
678 | } | 686 | } |
679 | 687 | ||