]> www.infradead.org Git - users/hch/misc.git/commitdiff
rtc: pcf2127: fix watchdog interrupt mask on pcf2131
authorBruno Thomsen <bruno.thomsen@gmail.com>
Tue, 2 Sep 2025 18:22:35 +0000 (20:22 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 5 Oct 2025 21:30:10 +0000 (23:30 +0200)
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>
drivers/rtc/rtc-pcf2127.c

index 3ba1de30e89c22ae07ea319d530b58adc25b520d..bb4fe81d3d62c01e77afb7210dd6745de5293e0d 100644 (file)
@@ -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);
 }