Skip to content

Commit f432d5d

Browse files
psvtrajankartben
authored andcommitted
drivers: rtc: pcf8563: fix get alarm time
While getting alarm time, BIT(7) of each register is checked if it is set, which send the alarm time as 0 to the requestor. Fix it by checking if the BIT(7) of each register is not set. Signed-off-by: Thiyagarajan Pandiyan <psvthiyagarajan@gmail.com>
1 parent 0e8fdf6 commit f432d5d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/rtc/rtc_pcf8563.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,22 @@ static int pcf8563_alarm_get_time(const struct device *dev, uint16_t id, uint16_
335335
*mask = 0U;
336336

337337
/* The first bit is the enabled flag */
338-
if (regs[0] & BIT(7)) {
338+
if (!(regs[0] & BIT(7))) {
339339
timeptr->tm_min = bcd2bin(regs[0] & GENMASK(6, 0));
340340
*mask |= RTC_ALARM_TIME_MASK_MINUTE;
341341
}
342342

343-
if (regs[1] & BIT(7)) {
343+
if (!(regs[1] & BIT(7))) {
344344
timeptr->tm_hour = bcd2bin(regs[1] & GENMASK(5, 0));
345345
*mask |= RTC_ALARM_TIME_MASK_HOUR;
346346
}
347347

348-
if (regs[2] & BIT(7)) {
348+
if (!(regs[2] & BIT(7))) {
349349
timeptr->tm_mday = bcd2bin(regs[2] & GENMASK(5, 0));
350350
*mask |= RTC_ALARM_TIME_MASK_MONTHDAY;
351351
}
352352

353-
if (regs[3] & BIT(7)) {
353+
if (!(regs[3] & BIT(7))) {
354354
timeptr->tm_wday = bcd2bin(regs[3] & GENMASK(2, 0));
355355
*mask |= RTC_ALARM_TIME_MASK_WEEKDAY;
356356
}

0 commit comments

Comments
 (0)