lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251210-rtc-pcf2131-clear-pwrmng-bits-v1-1-407c1c573726@se.com>
Date: Wed, 10 Dec 2025 21:19:59 +0100
From: Alessandro Di Chiara via B4 Relay <devnull+alessandro.dichiara.se.com@...nel.org>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org, 
 Alessandro Di Chiara <alessandro.dichiara@...com>
Subject: [PATCH] rtc: pcf2127: clear the PWRMNG bits for pcf2131

From: Alessandro Di Chiara <alessandro.dichiara@...com>

The pcf2131 does not retain the date by default. This is because the
reset value of the PWRMNG bits is 111, which is different from the
pcf2127/pcf2129, whose reset value is 000.

To keep consistency with the other rtc handled by the driver,
clear the PWRMNG bits for pcf2131 to enable:
	- Battery switch-over function in standard mode.
	- Battery low detection function.

Signed-off-by: Alessandro Di Chiara <alessandro.dichiara@...com>
---
Hi,

this patch enables battery switch-over and low detection functions for
the rtc pcf2131.

Tested only with pcf2131.
---
 drivers/rtc/rtc-pcf2127.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index bb4fe81d3d62..c6ea679645f2 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1329,8 +1329,11 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
 	 * Clear battery interrupt flags which can block new trigger events.
 	 * Note: This is the default chip behaviour but added to ensure
 	 * correct tamper timestamp and interrupt function.
+	 * For pcf2131, clear the PWRMNG bits[7:5] because the reset value
+	 * is 111, which is different from 2127/2129.
 	 */
 	ret = regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3,
+				 (pcf2127->cfg->type == PCF2131 ? PCF2127_CTRL3_PM : 0) |
 				 PCF2127_BIT_CTRL3_BTSE |
 				 PCF2127_BIT_CTRL3_BIE |
 				 PCF2127_BIT_CTRL3_BLIE, 0);

---
base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
change-id: 20251210-rtc-pcf2131-clear-pwrmng-bits-20c33af7721c

Best regards,
-- 
Alessandro Di Chiara <alessandro.dichiara@...com>



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ