Skip to content

Commit a6ceee2

Browse files
tq-steinaalexandrebelloni
authored andcommitted
rtc: pcf85063: Fix reading alarm
If the alarms are disabled the topmost bit (AEN_*) is set in the alarm registers. This is also interpreted in BCD number leading to this warning: rtc rtc0: invalid alarm value: 2022-09-21T80:80:80 Fix this by masking alarm enabling and reserved bits. Fixes: 05cb3a5 ("rtc: pcf85063: add alarm support") Signed-off-by: Alexander Stein <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent fe0157b commit a6ceee2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/rtc/rtc-pcf85063.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ static int pcf85063_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
169169
if (ret)
170170
return ret;
171171

172-
alrm->time.tm_sec = bcd2bin(buf[0]);
173-
alrm->time.tm_min = bcd2bin(buf[1]);
174-
alrm->time.tm_hour = bcd2bin(buf[2]);
175-
alrm->time.tm_mday = bcd2bin(buf[3]);
172+
alrm->time.tm_sec = bcd2bin(buf[0] & 0x7f);
173+
alrm->time.tm_min = bcd2bin(buf[1] & 0x7f);
174+
alrm->time.tm_hour = bcd2bin(buf[2] & 0x3f);
175+
alrm->time.tm_mday = bcd2bin(buf[3] & 0x3f);
176176

177177
ret = regmap_read(pcf85063->regmap, PCF85063_REG_CTRL2, &val);
178178
if (ret)

0 commit comments

Comments
 (0)