aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2011-02-11 21:15:23 -0500
committerJohn Stultz <john.stultz@linaro.org>2011-02-17 17:59:42 -0500
commit456d66ecd09e3bc326b93174745faafb6ac378d6 (patch)
tree24e0fb6f1c861204e2bf25abc2e27a1e3c3941ae /drivers/rtc
parent6e57b1d6a8d8ed1998229b71c102be1997e397c6 (diff)
RTC: Re-enable UIE timer/polling emulation
This patch re-enables UIE timer/polling emulation for rtc devices that do not support alarm irqs. CC: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> CC: Thomas Gleixner <tglx@linutronix.de> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/interface.c18
-rw-r--r--drivers/rtc/rtc-dev.c2
2 files changed, 18 insertions, 2 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 413ae0537915..cb2f0728fd70 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -228,6 +228,12 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
228 if (err) 228 if (err)
229 return err; 229 return err;
230 230
231#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
232 if (enabled == 0 && rtc->uie_irq_active) {
233 mutex_unlock(&rtc->ops_lock);
234 return rtc_dev_update_irq_enable_emul(rtc, 0);
235 }
236#endif
231 /* make sure we're changing state */ 237 /* make sure we're changing state */
232 if (rtc->uie_rtctimer.enabled == enabled) 238 if (rtc->uie_rtctimer.enabled == enabled)
233 goto out; 239 goto out;
@@ -247,6 +253,16 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
247 253
248out: 254out:
249 mutex_unlock(&rtc->ops_lock); 255 mutex_unlock(&rtc->ops_lock);
256#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
257 /*
258 * Enable emulation if the driver did not provide
259 * the update_irq_enable function pointer or if returned
260 * -EINVAL to signal that it has been configured without
261 * interrupts or that are not available at the moment.
262 */
263 if (err == -EINVAL)
264 err = rtc_dev_update_irq_enable_emul(rtc, enabled);
265#endif
250 return err; 266 return err;
251 267
252} 268}
@@ -262,7 +278,7 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
262 * 278 *
263 * Triggers the registered irq_task function callback. 279 * Triggers the registered irq_task function callback.
264 */ 280 */
265static void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode) 281void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode)
266{ 282{
267 unsigned long flags; 283 unsigned long flags;
268 284
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index dfa72c9c2687..d0e06edb14c5 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -76,7 +76,7 @@ static void rtc_uie_task(struct work_struct *work)
76 } 76 }
77 spin_unlock_irq(&rtc->irq_lock); 77 spin_unlock_irq(&rtc->irq_lock);
78 if (num) 78 if (num)
79 rtc_update_irq(rtc, num, RTC_UF | RTC_IRQF); 79 rtc_handle_legacy_irq(rtc, num, RTC_UF);
80} 80}
81static void rtc_uie_timer(unsigned long data) 81static void rtc_uie_timer(unsigned long data)
82{ 82{