[PATCH 4/5] mfd: da9052: Disable IRQ wake on device removal

From: shao.mingyin

Date: Sat Nov 07 2026 - 03:08:45 EST


From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>

da9052_irq_init() calls enable_irq_wake() on the chip IRQ but neither the
error path (when requesting the ADC_EOM IRQ fails) nor da9052_irq_exit()
(the removal path reached from da9052_i2c_remove()/da9052_spi_remove())
ever calls disable_irq_wake(). The wakeup configuration is therefore left
behind when the device is unbound; the IRQ line keeps being treated as a
wakeup source and, should the descriptor be reused by another device later,
the stale wake setting persists.

Track whether the wake source was successfully enabled and disable it
symmetrically on both the probe failure path and in da9052_irq_exit().

Fixes: ed05be56643e ("mfd: da9052: Register ability of device to cause a wake-up interrupt")
Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
---
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index abbdbf0337e2..da5bac424efc 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -259,7 +259,8 @@ int da9052_irq_init(struct da9052 *da9052)
goto regmap_err;
}

- enable_irq_wake(da9052->chip_irq);
+ if (!enable_irq_wake(da9052->chip_irq))
+ da9052->irq_wake_enabled = true;

ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
da9052_auxadc_irq, da9052);
@@ -272,6 +273,10 @@ int da9052_irq_init(struct da9052 *da9052)
return 0;

request_irq_err:
+ if (da9052->irq_wake_enabled) {
+ disable_irq_wake(da9052->chip_irq);
+ da9052->irq_wake_enabled = false;
+ }
regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);
regmap_err:
return ret;
@@ -281,6 +286,10 @@ int da9052_irq_init(struct da9052 *da9052)
int da9052_irq_exit(struct da9052 *da9052)
{
da9052_free_irq(da9052, DA9052_IRQ_ADC_EOM, da9052);
+ if (da9052->irq_wake_enabled) {
+ disable_irq_wake(da9052->chip_irq);
+ da9052->irq_wake_enabled = false;
+ }
regmap_del_irq_chip(da9052->chip_irq, da9052->irq_data);

return 0;
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 9cb2fc2938ce..d7dd36891539 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -93,6 +93,8 @@ struct da9052 {

int chip_irq;

+ bool irq_wake_enabled;
+
int fault_log;

/* SOC I/O transfer related fixes for DA9052/53 */