diff options
author | Arnaud Patard <arnaud.patard@rtp-net.org> | 2009-08-27 11:46:41 +0400 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2009-09-02 00:50:32 +0400 |
commit | 65329e6e3de2b2fd07e524a3c10958f2acb7bcb0 (patch) | |
tree | 5f1b1f519f97ef54b6a2200036f50474b2dfd56f /drivers | |
parent | 4616eea5f3b3a603a03f31721de3eeb42dbd7711 (diff) |
pcf50606: fix RTC alarm
This makes wake up on RTC alarm work properly, ported from rtc-pcf50633
commits 4caf79de95c26495e7cdc8204023d97598f887d2 and
c3e4e22fb0c3e1d82f66e67f6592949e48f3995a.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rtc/rtc-pcf50606.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-pcf50606.c b/drivers/rtc/rtc-pcf50606.c index 434cfc1dca4..6bd93b0b672 100644 --- a/drivers/rtc/rtc-pcf50606.c +++ b/drivers/rtc/rtc-pcf50606.c @@ -58,6 +58,7 @@ struct pcf50606_time { struct pcf50606_rtc { int alarm_enabled; int second_enabled; + int alarm_pending; struct pcf50606 *pcf; struct rtc_device *rtc_dev; @@ -198,6 +199,7 @@ static int pcf50606_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) rtc = dev_get_drvdata(dev); alrm->enabled = rtc->alarm_enabled; + alrm->pending = rtc->alarm_pending; ret = pcf50606_read_block(rtc->pcf, PCF50606_REG_RTCSCA, PCF50606_TI_EXTENT, &pcf_tm.time[0]); @@ -234,8 +236,12 @@ static int pcf50606_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) ret = pcf50606_write_block(rtc->pcf, PCF50606_REG_RTCSCA, PCF50606_TI_EXTENT, &pcf_tm.time[0]); - if (!alarm_masked) + if (!alrm->enabled) + rtc->alarm_pending = 0; + + if (!alarm_masked || alrm->enabled) pcf50606_irq_unmask(rtc->pcf, PCF50606_IRQ_ALARM); + rtc->alarm_enabled = alrm->enabled; return ret; } @@ -255,6 +261,7 @@ static void pcf50606_rtc_irq(int irq, void *data) switch (irq) { case PCF50606_IRQ_ALARM: rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF); + rtc->alarm_pending = 1; break; case PCF50606_IRQ_SECOND: rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF); |