]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rtc: pcf8563: fix wrong alarm register
authorTroy Mitchell <troymitchell988@gmail.com>
Sat, 31 May 2025 07:20:40 +0000 (15:20 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 1 Jun 2025 22:00:37 +0000 (00:00 +0200)
When the regmap framework was introduced to this driver,
the PCF8563_REG_AMN register within the set_alarm function was
incorrectly changed to PCF8563_REG_SC.

The PCF8563_REG_SC register is the seconds register.
This caused alarm values to be written to the seconds register
when an alarm was set. Which means the alarm would not trigger
as expected and the seconds register would be overwritten
with an incorrect value.

Signed-off-by: Troy Mitchell <troymitchell988@gmail.com>
Link: https://lore.kernel.org/r/20250531-pcf8563-fix-alarm-v2-1-cac4b1716167@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf8563.c

index 5a084d426e58d09cfedf0809695a96a27627c420..b2611697fa5e3adc61f687e39385d10736dec677 100644 (file)
@@ -285,7 +285,7 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
        buf[2] = bin2bcd(tm->time.tm_mday);
        buf[3] = tm->time.tm_wday & 0x07;
 
-       err = regmap_bulk_write(pcf8563->regmap, PCF8563_REG_SC, buf,
+       err = regmap_bulk_write(pcf8563->regmap, PCF8563_REG_AMN, buf,
                                sizeof(buf));
        if (err)
                return err;