Commit 8384dfeb authored by Linus Walleij's avatar Linus Walleij Committed by Linus Torvalds

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 261eba73
...@@ -157,6 +157,7 @@ static int __exit coh901331_remove(struct platform_device *pdev) ...@@ -157,6 +157,7 @@ static int __exit coh901331_remove(struct platform_device *pdev)
if (rtap) { if (rtap) {
free_irq(rtap->irq, rtap); free_irq(rtap->irq, rtap);
rtc_device_unregister(rtap->rtc); rtc_device_unregister(rtap->rtc);
clk_unprepare(rtap->clk);
clk_put(rtap->clk); clk_put(rtap->clk);
iounmap(rtap->virtbase); iounmap(rtap->virtbase);
release_mem_region(rtap->phybase, rtap->physize); release_mem_region(rtap->phybase, rtap->physize);
...@@ -213,10 +214,10 @@ static int __init coh901331_probe(struct platform_device *pdev) ...@@ -213,10 +214,10 @@ static int __init coh901331_probe(struct platform_device *pdev)
} }
/* We enable/disable the clock only to assure it works */ /* We enable/disable the clock only to assure it works */
ret = clk_enable(rtap->clk); ret = clk_prepare_enable(rtap->clk);
if (ret) { if (ret) {
dev_err(&pdev->dev, "could not enable clock\n"); dev_err(&pdev->dev, "could not enable clock\n");
goto out_no_clk_enable; goto out_no_clk_prepenable;
} }
clk_disable(rtap->clk); clk_disable(rtap->clk);
...@@ -232,7 +233,8 @@ static int __init coh901331_probe(struct platform_device *pdev) ...@@ -232,7 +233,8 @@ static int __init coh901331_probe(struct platform_device *pdev)
out_no_rtc: out_no_rtc:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
out_no_clk_enable: clk_unprepare(rtap->clk);
out_no_clk_prepenable:
clk_put(rtap->clk); clk_put(rtap->clk);
out_no_clk: out_no_clk:
free_irq(rtap->irq, rtap); free_irq(rtap->irq, rtap);
...@@ -265,6 +267,7 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -265,6 +267,7 @@ static int coh901331_suspend(struct platform_device *pdev, pm_message_t state)
writel(0, rtap->virtbase + COH901331_IRQ_MASK); writel(0, rtap->virtbase + COH901331_IRQ_MASK);
clk_disable(rtap->clk); clk_disable(rtap->clk);
} }
clk_unprepare(rtap->clk);
return 0; return 0;
} }
...@@ -272,6 +275,7 @@ static int coh901331_resume(struct platform_device *pdev) ...@@ -272,6 +275,7 @@ static int coh901331_resume(struct platform_device *pdev)
{ {
struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev); struct coh901331_port *rtap = dev_get_drvdata(&pdev->dev);
clk_prepare(rtap->clk);
if (device_may_wakeup(&pdev->dev)) { if (device_may_wakeup(&pdev->dev)) {
disable_irq_wake(rtap->irq); disable_irq_wake(rtap->irq);
} else { } else {
...@@ -293,6 +297,7 @@ static void coh901331_shutdown(struct platform_device *pdev) ...@@ -293,6 +297,7 @@ static void coh901331_shutdown(struct platform_device *pdev)
clk_enable(rtap->clk); clk_enable(rtap->clk);
writel(0, rtap->virtbase + COH901331_IRQ_MASK); writel(0, rtap->virtbase + COH901331_IRQ_MASK);
clk_disable(rtap->clk); clk_disable(rtap->clk);
clk_unprepare(rtap->clk);
} }
static struct platform_driver coh901331_driver = { static struct platform_driver coh901331_driver = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment