aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at91rm9200.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2011-02-02 20:02:41 -0500
committerJohn Stultz <john.stultz@linaro.org>2011-02-03 16:02:35 -0500
commit16380c153a69c3784d2afaddfe0a22f353046cf6 (patch)
treee923f26334d999a1e456ca80c446fbf8b1c2eedd /drivers/rtc/rtc-at91rm9200.c
parentac54cd2bd5b4db4f1c03392d63daf355627ea180 (diff)
RTC: Convert rtc drivers to use the alarm_irq_enable method
Some rtc drivers use the ioctl method instead of the alarm_irq_enable method for enabling alarm interupts. With the new virtualized RTC rework, its important for drivers to use the alarm_irq_enable instead. This patch converts the drivers that use the AIE ioctl method to use the alarm_irq_enable method. Other ioctl cmds are left untouched. I have not been able to test or even compile most of these drivers. Any help to make sure this change is correct would be appreciated! CC: Alessandro Zummo <a.zummo@towertech.it> CC: Thomas Gleixner <tglx@linutronix.de> CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Reported-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Tested-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/rtc/rtc-at91rm9200.c')
-rw-r--r--drivers/rtc/rtc-at91rm9200.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index bc8bbca9a2e2..26d1cf5d19ae 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -195,13 +195,6 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd,
195 195
196 /* important: scrub old status before enabling IRQs */ 196 /* important: scrub old status before enabling IRQs */
197 switch (cmd) { 197 switch (cmd) {
198 case RTC_AIE_OFF: /* alarm off */
199 at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM);
200 break;
201 case RTC_AIE_ON: /* alarm on */
202 at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
203 at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM);
204 break;
205 case RTC_UIE_OFF: /* update off */ 198 case RTC_UIE_OFF: /* update off */
206 at91_sys_write(AT91_RTC_IDR, AT91_RTC_SECEV); 199 at91_sys_write(AT91_RTC_IDR, AT91_RTC_SECEV);
207 break; 200 break;
@@ -217,6 +210,18 @@ static int at91_rtc_ioctl(struct device *dev, unsigned int cmd,
217 return ret; 210 return ret;
218} 211}
219 212
213static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
214{
215 pr_debug("%s(): cmd=%08x\n", __func__, enabled);
216
217 if (enabled) {
218 at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
219 at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM);
220 } else
221 at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM);
222
223 return 0;
224}
220/* 225/*
221 * Provide additional RTC information in /proc/driver/rtc 226 * Provide additional RTC information in /proc/driver/rtc
222 */ 227 */
@@ -270,6 +275,7 @@ static const struct rtc_class_ops at91_rtc_ops = {
270 .read_alarm = at91_rtc_readalarm, 275 .read_alarm = at91_rtc_readalarm,
271 .set_alarm = at91_rtc_setalarm, 276 .set_alarm = at91_rtc_setalarm,
272 .proc = at91_rtc_proc, 277 .proc = at91_rtc_proc,
278 .alarm_irq_enable = at91_rtc_alarm_irq_enable,
273}; 279};
274 280
275/* 281/*