aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-pcf50633.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@openmoko.org>2009-12-15 19:46:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:19:59 -0500
commita766ae3ebd3575cf8c6b9a39fd5aa66856a578b4 (patch)
treebdff8135e005413cd674c9e09279b0b854b15d6e /drivers/rtc/rtc-pcf50633.c
parentf29627c2a3df5732af84bc217df26d1c311f5112 (diff)
rtc: pcf50633: manage RTC alarm "pending" flag
Add setting and clearing of the "pending" flag of the RTC alarm. The semantics follow the UEFI specification 2.2 available at http://www.uefi.org/specs/, i.e., the "pending" flag is cleared by disabling the alarm, but not by any other condition (such as the passing of time, a successful wakeup, or setting of a new alarm.) Signed-off-by: Werner Almesberger <werner@openmoko.org> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Paul Gortmaker <p_gortmaker@yahoo.com> Cc: Balaji Rao <balajirrao@openmoko.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-pcf50633.c')
-rw-r--r--drivers/rtc/rtc-pcf50633.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index 9b74e9c9151c..854c3cb365a1 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -58,6 +58,7 @@ struct pcf50633_time {
58struct pcf50633_rtc { 58struct pcf50633_rtc {
59 int alarm_enabled; 59 int alarm_enabled;
60 int second_enabled; 60 int second_enabled;
61 int alarm_pending;
61 62
62 struct pcf50633 *pcf; 63 struct pcf50633 *pcf;
63 struct rtc_device *rtc_dev; 64 struct rtc_device *rtc_dev;
@@ -209,6 +210,7 @@ static int pcf50633_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
209 rtc = dev_get_drvdata(dev); 210 rtc = dev_get_drvdata(dev);
210 211
211 alrm->enabled = rtc->alarm_enabled; 212 alrm->enabled = rtc->alarm_enabled;
213 alrm->pending = rtc->alarm_pending;
212 214
213 ret = pcf50633_read_block(rtc->pcf, PCF50633_REG_RTCSCA, 215 ret = pcf50633_read_block(rtc->pcf, PCF50633_REG_RTCSCA,
214 PCF50633_TI_EXTENT, &pcf_tm.time[0]); 216 PCF50633_TI_EXTENT, &pcf_tm.time[0]);
@@ -244,6 +246,8 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
244 /* Returns 0 on success */ 246 /* Returns 0 on success */
245 ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, 247 ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA,
246 PCF50633_TI_EXTENT, &pcf_tm.time[0]); 248 PCF50633_TI_EXTENT, &pcf_tm.time[0]);
249 if (!alrm->enabled)
250 rtc->alarm_pending = 0;
247 251
248 if (!alarm_masked || alrm->enabled) 252 if (!alarm_masked || alrm->enabled)
249 pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); 253 pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM);
@@ -268,6 +272,7 @@ static void pcf50633_rtc_irq(int irq, void *data)
268 switch (irq) { 272 switch (irq) {
269 case PCF50633_IRQ_ALARM: 273 case PCF50633_IRQ_ALARM:
270 rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF); 274 rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF);
275 rtc->alarm_pending = 1;
271 break; 276 break;
272 case PCF50633_IRQ_SECOND: 277 case PCF50633_IRQ_SECOND:
273 rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF); 278 rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF);