diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2012-07-30 17:41:31 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:17 -0400 |
| commit | 8384dfeb759acac48ea24b81f134cac3cbb3e6fc (patch) | |
| tree | ef92b0e32ee3af97196ab3245623fbe5f0dc8c9e /drivers/rtc | |
| parent | 261eba73353edd48b0c0cb7aad59553dfc712ebc (diff) | |
drivers/rtc/rtc-coh901331.c: use clk_prepare/unprepare
Make sure we prepare/unprepare the clock for the COH901331 RTC driver as
is required by the clk API especially if you use common clock.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-coh901331.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c index a5b8a0c4ea84..58665029d6f3 100644 --- a/drivers/rtc/rtc-coh901331.c +++ b/drivers/rtc/rtc-coh901331.c | |||
| @@ -157,6 +157,7 @@ static int __exit coh901331_remove(struct platform_device *pdev) | |||
| 157 | if (rtap) { | 157 | if (rtap) { |
| 158 | free_irq(rtap->irq, rtap); | 158 | free_irq(rtap->irq, rtap); |
| 159 | rtc_device_unregister(rtap->rtc); | 159 | rtc_device_unregister(rtap->rtc); |
| 160 | clk_unprepare(rtap->clk); | ||
| 160 | clk_put(rtap->clk); | 161 | clk_put(rtap->clk); |
| 161 | iounmap(rtap->virtbase); | 162 | iounmap(rtap->virtbase); |
| 162 | release_mem_region(rtap->phybase, rtap->physize); | 163 | release_mem_region(rtap->phybase, rtap->physize); |
| @@ -213,10 +214,10 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
| 213 | } | 214 | } |
| 214 | 215 | ||
| 215 | /* We enable/disable the clock only to assure it works */ | 216 | /* We enable/disable the clock only to assure it works */ |
| 216 | ret = clk_enable(rtap->clk); | 217 | ret = clk_prepare_enable(rtap->clk); |
| 217 | if (ret) { | 218 | if (ret) { |
| 218 | dev_err(&pdev->dev, "could not enable clock\n"); | 219 | dev_err(&pdev->dev, "could not enable clock\n"); |
| 219 | goto out_no_clk_enable; | 220 | goto out_no_clk_prepenable; |
| 220 | } | 221 | } |
| 221 | clk_disable(rtap->clk); | 222 | clk_disable(rtap->clk); |
| 222 | 223 | ||
| @@ -232,7 +233,8 @@ static int __init coh901331_probe(struct platform_device *pdev) | |||
| 232 | 233 | ||
| 233 | out_no_rtc: | 234 | out_no_rtc: |
| 234 | platform_set_drvdata(pdev, NULL); | 235 | platform_set_drvdata(pdev, NULL); |
| 235 | out_no_clk_enable: | 236 | clk_unprepare(rtap->clk); |
| 237 | out_no_clk_prepenable: | ||
| 236 | clk_put(rtap->clk); | 238 | clk_put(rtap->clk); |
| 237 | out_no_clk: | 239 | out_no_clk: |
| 238 | free_irq(rtap->irq, rtap); | 240 | free_irq(rtap->irq, rtap); |
| @@ -265,6 +267,7 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 265 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | 267 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); |
| 266 | clk_disable(rtap->clk); | 268 | clk_disable(rtap->clk); |
| 267 | } | 269 | } |
| 270 | clk_unprepare(rtap->clk); | ||
| 268 | return 0; | 271 | return 0; |
| 269 | } | 272 | } |
| 270 | 273 | ||
| @@ -272,6 +275,7 @@ static int coh901331_resume(struct platform_device *pdev) | |||
| 272 | { | 275 | { |
| 273 | struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); | 276 | struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); |
| 274 | 277 | ||
| 278 | clk_prepare(rtap->clk); | ||
| 275 | if (device_may_wakeup(&pdev->dev)) { | 279 | if (device_may_wakeup(&pdev->dev)) { |
| 276 | disable_irq_wake(rtap->irq); | 280 | disable_irq_wake(rtap->irq); |
| 277 | } else { | 281 | } else { |
| @@ -293,6 +297,7 @@ static void coh901331_shutdown(struct platform_device *pdev) | |||
| 293 | clk_enable(rtap->clk); | 297 | clk_enable(rtap->clk); |
| 294 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); | 298 | writel(0, rtap->virtbase + COH901331_IRQ_MASK); |
| 295 | clk_disable(rtap->clk); | 299 | clk_disable(rtap->clk); |
| 300 | clk_unprepare(rtap->clk); | ||
| 296 | } | 301 | } |
| 297 | 302 | ||
| 298 | static struct platform_driver coh901331_driver = { | 303 | static struct platform_driver coh901331_driver = { |
