aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorRamesh Chandrasekaran <ramesh.chandrasekaran@stericsson.com>2012-07-30 17:41:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-30 20:25:18 -0400
commitdc43d4a26b808240410ce3ea1c72a8047f90d1d8 (patch)
tree13fb879cf0167796fe21dc1ae750b4105e1467be /drivers/rtc
parent559a6fc0508392a665a26d93db9ff875bfdc6540 (diff)
drivers/rtc/rtc-ab8500.c: use UIE emulation
RTC: Fix to correct improper implementation of clock update irq (RTC_UIE) and enable UIE Emulation. [akpm@linux-foundation.org: checkpatch fixes] Signed-off-by: Ramesh Chandrasekaran <ramesh.chandrasekaran@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/Kconfig1
-rw-r--r--drivers/rtc/rtc-ab8500.c15
2 files changed, 15 insertions, 1 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 08cbdb900a18..668da5922d9e 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -694,6 +694,7 @@ config RTC_DRV_AB3100
694config RTC_DRV_AB8500 694config RTC_DRV_AB8500
695 tristate "ST-Ericsson AB8500 RTC" 695 tristate "ST-Ericsson AB8500 RTC"
696 depends on AB8500_CORE 696 depends on AB8500_CORE
697 select RTC_INTF_DEV_UIE_EMUL
697 help 698 help
698 Select this to enable the ST-Ericsson AB8500 power management IC RTC 699 Select this to enable the ST-Ericsson AB8500 power management IC RTC
699 support. This chip contains a battery- and capacitor-backed RTC. 700 support. This chip contains a battery- and capacitor-backed RTC.
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 370889d0489b..1a57e03e169d 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -225,7 +225,8 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
225{ 225{
226 int retval, i; 226 int retval, i;
227 unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)]; 227 unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)];
228 unsigned long mins, secs = 0; 228 unsigned long mins, secs = 0, cursec = 0;
229 struct rtc_time curtm;
229 230
230 if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) { 231 if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) {
231 dev_dbg(dev, "year should be equal to or greater than %d\n", 232 dev_dbg(dev, "year should be equal to or greater than %d\n",
@@ -237,6 +238,18 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
237 rtc_tm_to_time(&alarm->time, &secs); 238 rtc_tm_to_time(&alarm->time, &secs);
238 239
239 /* 240 /*
241 * Check whether alarm is set less than 1min.
242 * Since our RTC doesn't support alarm resolution less than 1min,
243 * return -EINVAL, so UIE EMUL can take it up, incase of UIE_ON
244 */
245 ab8500_rtc_read_time(dev, &curtm); /* Read current time */
246 rtc_tm_to_time(&curtm, &cursec);
247 if ((secs - cursec) < 59) {
248 dev_dbg(dev, "Alarm less than 1 minute not supported\r\n");
249 return -EINVAL;
250 }
251
252 /*
240 * Convert it to the number of seconds since 01-01-2000 00:00:00, since 253 * Convert it to the number of seconds since 01-01-2000 00:00:00, since
241 * we only have a small counter in the RTC. 254 * we only have a small counter in the RTC.
242 */ 255 */