aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJan Kardell <jan.kardell@telliq.com>2014-12-10 18:53:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:15 -0500
commit599cda555c1bf6ba9b98e28f707f7b27c8276796 (patch)
treecd2391d1617e51469983acee7c62270819a2a1a4 /drivers/rtc
parentc7aef4f88629dcd6efbf9c80c9805625e149c868 (diff)
rtc: pcf8563: handle consequeces of lacking second alarm reg
To guarantee that a set alarm occurs in the future, the set alarm time is rounded up to the nearest minute. Also we cannot handle UIE as it requires second precision. Signed-off-by: Jan Kardell <jan.kardell@telliq.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> 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/rtc-pcf8563.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 78f76d99bd35..ce6a11bc0fd7 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -361,6 +361,14 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
361 struct i2c_client *client = to_i2c_client(dev); 361 struct i2c_client *client = to_i2c_client(dev);
362 unsigned char buf[4]; 362 unsigned char buf[4];
363 int err; 363 int err;
364 unsigned long alarm_time;
365
366 /* The alarm has no seconds, round up to nearest minute */
367 if (tm->time.tm_sec) {
368 rtc_tm_to_time(&tm->time, &alarm_time);
369 alarm_time += 60-tm->time.tm_sec;
370 rtc_time_to_tm(alarm_time, &tm->time);
371 }
364 372
365 dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d " 373 dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d "
366 "enabled=%d pending=%d\n", __func__, 374 "enabled=%d pending=%d\n", __func__,
@@ -435,6 +443,9 @@ static int pcf8563_probe(struct i2c_client *client,
435 443
436 } 444 }
437 445
446 /* the pcf8563 alarm only supports a minute accuracy */
447 pcf8563->rtc->uie_unsupported = 1;
448
438 return 0; 449 return 0;
439} 450}
440 451