0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-25 06:26:15 +00:00
openwrt/target/linux/bcm27xx/patches-6.6/950-1234-rtc-pcf8523-Fix-oscillator-stop-bit-handling-reading.patch
Álvaro Fernández Rojas 538a1d740c bcm27xx: update to latest RPi patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.58..rpi-6.6.y

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-10-31 13:44:23 +01:00

54 lines
1.7 KiB
Diff

From 8beb6891489c3c99618a7390578109aadfdf8901 Mon Sep 17 00:00:00 2001
From: Axel <48924884+Paladinking@users.noreply.github.com>
Date: Wed, 28 Aug 2024 09:46:13 +0200
Subject: [PATCH 1234/1350] rtc: pcf8523: Fix oscillator stop bit handling
reading from Control_1
The check if the oscillator stop bit is set was reading from Control_1
register instead of the Seconds register.
This caused the Seconds register to be incorrectly changed if bit 7 of
Control_1 happens to be set.
Signed-off-by: Axel Hammarberg <axel.hammarberg@gmail.com>
---
drivers/rtc/rtc-pcf8523.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -108,10 +108,10 @@ static int pcf8523_rtc_read_time(struct
if (err < 0)
return err;
- if ((regs[0] & PCF8523_CONTROL1_STOP) || (regs[3] & PCF8523_SECONDS_OS))
+ if (regs[PCF8523_REG_CONTROL1] & PCF8523_CONTROL1_STOP)
return -EINVAL;
- if (regs[0] & PCF8523_SECONDS_OS) {
+ if (regs[PCF8523_REG_SECONDS] & PCF8523_SECONDS_OS) {
/*
* If the oscillator was stopped, try to clear the flag. Upon
* power-up the flag is always set, but if we cannot clear it
@@ -120,10 +120,10 @@ static int pcf8523_rtc_read_time(struct
* that the clock cannot be assumed to be correct.
*/
- regs[0] &= ~PCF8523_SECONDS_OS;
+ regs[PCF8523_REG_SECONDS] &= ~PCF8523_SECONDS_OS;
err = regmap_write(pcf8523->regmap, PCF8523_REG_SECONDS,
- regs[0]);
+ regs[PCF8523_REG_SECONDS]);
if (err < 0)
return err;
@@ -135,7 +135,7 @@ static int pcf8523_rtc_read_time(struct
if (value & PCF8523_SECONDS_OS)
return -EAGAIN;
- regs[0] = value;
+ regs[PCF8523_REG_SECONDS] = value;
}
tm->tm_sec = bcd2bin(regs[3] & 0x7f);