[PATCH v2 3/3] mfd: da9052: Balance the parent IRQ wake reference
From: shao.mingyin
Date: Thu Nov 26 2026 - 23:18:01 EST
da9052_irq_init() enables wake on the chip IRQ before requesting ADC_EOM.
The error path and da9052_irq_exit() leave a successful wake enable
unbalanced, so the IRQ retains its wake reference after probe failure
or device removal.
Enable wake after requesting ADC_EOM, and record whether the enable
succeeded. Drop that reference before tearing down the parent IRQ
chip. The device can still probe when wake is unavailable.
Fixes: ed05be56643e ("mfd: da9052: Register ability of device to cause a wake-up interrupt")
Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
---
Changes in v2:
- Enable wake after requesting ADC_EOM and keep the conditional
disable for irqchips that reject wake enable.
Previous version: https://lore.kernel.org/all/20261107162123768WcPgulYo-5-EuCbXTrwwH@xxxxxxxxxx/
Build-tested on Linux-next next-20261118 with GCC 13.3.0 for x86_64.
drivers/mfd/da9052-irq.c | 7 +++++--
include/linux/mfd/da9052/da9052.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index abbdbf0337e2..0fbf274a8fd2 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -259,8 +259,6 @@ int da9052_irq_init(struct da9052 *da9052)
goto regmap_err;
}
- enable_irq_wake(da9052->chip_irq);
-
ret = da9052_request_irq(da9052, DA9052_IRQ_ADC_EOM, "adc-irq",
da9052_auxadc_irq, da9052);
@@ -269,6 +267,9 @@ int da9052_irq_init(struct da9052 *da9052)
goto request_irq_err;
}
+ ret = enable_irq_wake(da9052->chip_irq);
+ da9052->irq_wake_enabled = !ret;
+
return 0;
request_irq_err:
@@ -281,6 +282,8 @@ 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);
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..ba155de6bf24 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -92,6 +92,7 @@ struct da9052 {
u8 chip_id;
int chip_irq;
+ bool irq_wake_enabled;
int fault_log;
base-commit: e8017d29067fd1310a65c3494ce1a1b492adbac6
--
2.43.0