Commit a766ae3e authored by Werner Almesberger's avatar Werner Almesberger Committed by Linus Torvalds

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: default avatarWerner Almesberger <werner@openmoko.org>
Signed-off-by: default avatarPaul 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f29627c2
...@@ -58,6 +58,7 @@ struct pcf50633_time { ...@@ -58,6 +58,7 @@ struct pcf50633_time {
struct pcf50633_rtc { struct pcf50633_rtc {
int alarm_enabled; int alarm_enabled;
int second_enabled; int second_enabled;
int alarm_pending;
struct pcf50633 *pcf; struct pcf50633 *pcf;
struct rtc_device *rtc_dev; struct rtc_device *rtc_dev;
...@@ -209,6 +210,7 @@ static int pcf50633_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -209,6 +210,7 @@ static int pcf50633_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
rtc = dev_get_drvdata(dev); rtc = dev_get_drvdata(dev);
alrm->enabled = rtc->alarm_enabled; alrm->enabled = rtc->alarm_enabled;
alrm->pending = rtc->alarm_pending;
ret = pcf50633_read_block(rtc->pcf, PCF50633_REG_RTCSCA, ret = pcf50633_read_block(rtc->pcf, PCF50633_REG_RTCSCA,
PCF50633_TI_EXTENT, &pcf_tm.time[0]); 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,6 +246,8 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
/* Returns 0 on success */ /* Returns 0 on success */
ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA,
PCF50633_TI_EXTENT, &pcf_tm.time[0]); PCF50633_TI_EXTENT, &pcf_tm.time[0]);
if (!alrm->enabled)
rtc->alarm_pending = 0;
if (!alarm_masked || alrm->enabled) if (!alarm_masked || alrm->enabled)
pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM);
...@@ -268,6 +272,7 @@ static void pcf50633_rtc_irq(int irq, void *data) ...@@ -268,6 +272,7 @@ static void pcf50633_rtc_irq(int irq, void *data)
switch (irq) { switch (irq) {
case PCF50633_IRQ_ALARM: case PCF50633_IRQ_ALARM:
rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF); rtc_update_irq(rtc->rtc_dev, 1, RTC_AF | RTC_IRQF);
rtc->alarm_pending = 1;
break; break;
case PCF50633_IRQ_SECOND: case PCF50633_IRQ_SECOND:
rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF); rtc_update_irq(rtc->rtc_dev, 1, RTC_UF | RTC_IRQF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment