Re: [PATCH v2 3/3] rtc: ds1307: Add driver for Epson RX8901CE

From: Fredrik M Olsson

Date: Mon Jun 29 2026 - 11:19:04 EST


On 6/24/26 23:38, Alexandre Belloni wrote:
[Some people who received this message don't often get email from alexandre.belloni@xxxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

On 20/05/2026 16:48:55+0200, Fredrik M Olsson wrote:
+static int do_trickle_setup_rx8901(struct ds1307 *ds1307, u32 ohms __always_unused, bool diode)
+{
+ int ret;
+ unsigned int setup;
+
+ ret = regmap_read(ds1307->regmap, RX8901_REG_PWSW_CFG, &setup);
+ if (ret) {
+ dev_err(ds1307->dev, "Failed to read PWSW_CFG register\n");
+ return ret;
+ }
+
+ /* Enable low battery voltage detection */
+ setup |= RX8901_REG_PWSW_CFG_VBATLDETEN;
+
+ if (diode)
+ setup |= RX8901_REG_PWSW_CFG_CHGEN;

When diode is false, you need to explicitly clear
RX8901_REG_PWSW_CFG_CHGEN so it is possible to actually disable trickle
charging once it has been enabled has the register is battery backed.

Okay thanks I will update that in v3.


--
/Fredrik