[PATCH v3 3/4] rtc: pcf85063: preserve the alarm flag in clkout register updates

From: A. Sverdlin

Date: Fri Aug 28 2026 - 12:50:19 EST


From: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>

The clkout rate and enable/disable helpers update CTRL2 with
regmap_update_bits() but leave the alarm flag (AF) out of the mask. AF is
write-0-to-clear, so an AF that gets asserted between the read and the
write of the read-modify-write is written back as 0 and the pending alarm
interrupt is lost.

Add AF to the mask and write it back as 1 (write-1-to-preserve) so a
concurrently asserted alarm flag survives a clkout reconfiguration.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxxxx>
---
Changelog:
v3:
- new patch

drivers/rtc/rtc-pcf85063.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index af900fe8ae15e..a3af86456ccfc 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -431,7 +431,8 @@ static int pcf85063_clkout_set_rate(struct clk_hw *hw, unsigned long rate,
if (clkout_rates[i] == rate)
return regmap_update_bits(pcf85063->regmap,
PCF85063_REG_CTRL2,
- PCF85063_REG_CLKO_F_MASK, i);
+ PCF85063_REG_CLKO_F_MASK | PCF85063_CTRL2_AF,
+ i | PCF85063_CTRL2_AF);

return -EINVAL;
}
@@ -460,7 +461,8 @@ static int pcf85063_clkout_control(struct clk_hw *hw, bool enable)
}

return regmap_update_bits(pcf85063->regmap, PCF85063_REG_CTRL2,
- PCF85063_REG_CLKO_F_MASK, buf);
+ PCF85063_REG_CLKO_F_MASK | PCF85063_CTRL2_AF,
+ buf | PCF85063_CTRL2_AF);
}

static int pcf85063_clkout_prepare(struct clk_hw *hw)
--
2.55.0