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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 9c8ead43a59c..677bae820dc3 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -263,8 +263,12 @@ static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
263 263
264static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) 264static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
265{ 265{
266 u32 rtsr;
267
266 memcpy(&alrm->time, &rtc_alarm, sizeof(struct rtc_time)); 268 memcpy(&alrm->time, &rtc_alarm, sizeof(struct rtc_time));
267 alrm->pending = RTSR & RTSR_AL ? 1 : 0; 269 rtsr = RTSR;
270 alrm->enabled = (rtsr & RTSR_ALE) ? 1 : 0;
271 alrm->pending = (rtsr & RTSR_AL) ? 1 : 0;
268 return 0; 272 return 0;
269} 273}
270 274
@@ -275,12 +279,10 @@ static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
275 spin_lock_irq(&sa1100_rtc_lock); 279 spin_lock_irq(&sa1100_rtc_lock);
276 ret = rtc_update_alarm(&alrm->time); 280 ret = rtc_update_alarm(&alrm->time);
277 if (ret == 0) { 281 if (ret == 0) {
278 memcpy(&rtc_alarm, &alrm->time, sizeof(struct rtc_time));
279
280 if (alrm->enabled) 282 if (alrm->enabled)
281 enable_irq_wake(IRQ_RTCAlrm); 283 RTSR |= RTSR_ALE;
282 else 284 else
283 disable_irq_wake(IRQ_RTCAlrm); 285 RTSR &= ~RTSR_ALE;
284 } 286 }
285 spin_unlock_irq(&sa1100_rtc_lock); 287 spin_unlock_irq(&sa1100_rtc_lock);
286 288