From: Bruno Thomsen bruno.thomsen@gmail.com
[ Upstream commit 87064da2db7be537a7da20a25c18ba912c4db9e1 ]
When using interrupt pin (INT A) as watchdog output all other interrupt sources need to be disabled to avoid additional resets. Resulting INT_A_MASK1 value is 55 (0x37).
Signed-off-by: Bruno Thomsen bruno.thomsen@gmail.com Link: https://lore.kernel.org/r/20250902182235.6825-1-bruno.thomsen@gmail.com Signed-off-by: Alexandre Belloni alexandre.belloni@bootlin.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES — this change should go to stable.
- `drivers/rtc/rtc-pcf2127.c:611-623` now masks every INT A source except the watchdog bit on PCF2131 when `reset-source` is in use, so the INT A pin stays dedicated to driving the external reset pulse instead of reasserting on alarm/periodic/tamper events. - Before this fix, `drivers/rtc/rtc-pcf2127.c:1174-1182` left all INT A mask bits cleared, and the probe path unconditionally enables several interrupt sources (see `pcf2127_enable_ts()` at `drivers/rtc/rtc- pcf2127.c:1128-1163`). With INT A wired as the watchdog output, any of those interrupts could immediately toggle the line and spuriously reset the system—effectively breaking boards that request watchdog/reset operation. - The new masking runs only when CONFIG_WATCHDOG is enabled and the DT property requests watchdog output (`drivers/rtc/rtc- pcf2127.c:575-617`), so normal RTC users keep their interrupt functionality. If the write were to fail, behaviour simply falls back to the pre-fix state, so the delta carries minimal regression risk. - The patch is tiny, self-contained to this driver, and fixes a user- visible bug (unwanted resets) without altering interfaces, making it an appropriate and low-risk stable backport candidate.
Suggested follow-up for maintainers: consider backporting anywhere PCF2131 watchdog/reset support exists alongside unmasked INT A sources.
drivers/rtc/rtc-pcf2127.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c index 3ba1de30e89c2..bb4fe81d3d62c 100644 --- a/drivers/rtc/rtc-pcf2127.c +++ b/drivers/rtc/rtc-pcf2127.c @@ -608,6 +608,21 @@ static int pcf2127_watchdog_init(struct device *dev, struct pcf2127 *pcf2127) set_bit(WDOG_HW_RUNNING, &pcf2127->wdd.status); }
+ /* + * When using interrupt pin (INT A) as watchdog output, only allow + * watchdog interrupt (PCF2131_BIT_INT_WD_CD) and disable (mask) all + * other interrupts. + */ + if (pcf2127->cfg->type == PCF2131) { + ret = regmap_write(pcf2127->regmap, + PCF2131_REG_INT_A_MASK1, + PCF2131_BIT_INT_BLIE | + PCF2131_BIT_INT_BIE | + PCF2131_BIT_INT_AIE | + PCF2131_BIT_INT_SI | + PCF2131_BIT_INT_MI); + } + return devm_watchdog_register_device(dev, &pcf2127->wdd); }