aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-sa1100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-sa1100.c')
-rw-r--r--drivers/rtc/rtc-sa1100.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 50a5c4adee48..5ec5036df0bc 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -108,9 +108,6 @@ static int sa1100_rtc_open(struct device *dev)
108 struct rtc_device *rtc = info->rtc; 108 struct rtc_device *rtc = info->rtc;
109 int ret; 109 int ret;
110 110
111 ret = clk_prepare_enable(info->clk);
112 if (ret)
113 goto fail_clk;
114 ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev); 111 ret = request_irq(info->irq_1hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev);
115 if (ret) { 112 if (ret) {
116 dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz); 113 dev_err(dev, "IRQ %d already in use.\n", info->irq_1hz);
@@ -130,7 +127,6 @@ static int sa1100_rtc_open(struct device *dev)
130 free_irq(info->irq_1hz, dev); 127 free_irq(info->irq_1hz, dev);
131 fail_ui: 128 fail_ui:
132 clk_disable_unprepare(info->clk); 129 clk_disable_unprepare(info->clk);
133 fail_clk:
134 return ret; 130 return ret;
135} 131}
136 132
@@ -144,7 +140,6 @@ static void sa1100_rtc_release(struct device *dev)
144 140
145 free_irq(info->irq_alarm, dev); 141 free_irq(info->irq_alarm, dev);
146 free_irq(info->irq_1hz, dev); 142 free_irq(info->irq_1hz, dev);
147 clk_disable_unprepare(info->clk);
148} 143}
149 144
150static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) 145static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
@@ -253,6 +248,9 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
253 spin_lock_init(&info->lock); 248 spin_lock_init(&info->lock);
254 platform_set_drvdata(pdev, info); 249 platform_set_drvdata(pdev, info);
255 250
251 ret = clk_prepare_enable(info->clk);
252 if (ret)
253 goto err_enable_clk;
256 /* 254 /*
257 * According to the manual we should be able to let RTTR be zero 255 * According to the manual we should be able to let RTTR be zero
258 * and then a default diviser for a 32.768KHz clock is used. 256 * and then a default diviser for a 32.768KHz clock is used.
@@ -305,6 +303,8 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
305 303
306 return 0; 304 return 0;
307err_dev: 305err_dev:
306 clk_disable_unprepare(info->clk);
307err_enable_clk:
308 platform_set_drvdata(pdev, NULL); 308 platform_set_drvdata(pdev, NULL);
309 clk_put(info->clk); 309 clk_put(info->clk);
310err_clk: 310err_clk:
@@ -318,6 +318,7 @@ static int sa1100_rtc_remove(struct platform_device *pdev)
318 318
319 if (info) { 319 if (info) {
320 rtc_device_unregister(info->rtc); 320 rtc_device_unregister(info->rtc);
321 clk_disable_unprepare(info->clk);
321 clk_put(info->clk); 322 clk_put(info->clk);
322 platform_set_drvdata(pdev, NULL); 323 platform_set_drvdata(pdev, NULL);
323 kfree(info); 324 kfree(info);
@@ -349,12 +350,14 @@ static const struct dev_pm_ops sa1100_rtc_pm_ops = {
349}; 350};
350#endif 351#endif
351 352
353#ifdef CONFIG_OF
352static struct of_device_id sa1100_rtc_dt_ids[] = { 354static struct of_device_id sa1100_rtc_dt_ids[] = {
353 { .compatible = "mrvl,sa1100-rtc", }, 355 { .compatible = "mrvl,sa1100-rtc", },
354 { .compatible = "mrvl,mmp-rtc", }, 356 { .compatible = "mrvl,mmp-rtc", },
355 {} 357 {}
356}; 358};
357MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids); 359MODULE_DEVICE_TABLE(of, sa1100_rtc_dt_ids);
360#endif
358 361
359static struct platform_driver sa1100_rtc_driver = { 362static struct platform_driver sa1100_rtc_driver = {
360 .probe = sa1100_rtc_probe, 363 .probe = sa1100_rtc_probe,
@@ -364,7 +367,7 @@ static struct platform_driver sa1100_rtc_driver = {
364#ifdef CONFIG_PM 367#ifdef CONFIG_PM
365 .pm = &sa1100_rtc_pm_ops, 368 .pm = &sa1100_rtc_pm_ops,
366#endif 369#endif
367 .of_match_table = sa1100_rtc_dt_ids, 370 .of_match_table = of_match_ptr(sa1100_rtc_dt_ids),
368 }, 371 },
369}; 372};
370 373