diff options
author | Jan Kardell <[email protected]> | 2014-12-10 15:53:40 -0800 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2014-12-10 17:41:15 -0800 |
commit | 599cda555c1bf6ba9b98e28f707f7b27c8276796 (patch) | |
tree | cd2391d1617e51469983acee7c62270819a2a1a4 | |
parent | c7aef4f88629dcd6efbf9c80c9805625e149c868 (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 <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Vincent Donnefort <[email protected]>
Cc: Dan Carpenter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | drivers/rtc/rtc-pcf8563.c | 11 |
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) struct i2c_client *client = to_i2c_client(dev); unsigned char buf[4]; int err; + unsigned long alarm_time; + + /* The alarm has no seconds, round up to nearest minute */ + if (tm->time.tm_sec) { + rtc_tm_to_time(&tm->time, &alarm_time); + alarm_time += 60-tm->time.tm_sec; + rtc_time_to_tm(alarm_time, &tm->time); + } dev_dbg(dev, "%s, min=%d hour=%d wday=%d mday=%d " "enabled=%d pending=%d\n", __func__, @@ -435,6 +443,9 @@ static int pcf8563_probe(struct i2c_client *client, } + /* the pcf8563 alarm only supports a minute accuracy */ + pcf8563->rtc->uie_unsupported = 1; + return 0; } |