[PATCH v3] nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems

Carl Lee via B4 Relay posted 1 patch 1 week, 1 day ago
There is a newer version of this series
drivers/nfc/nxp-nci/i2c.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
[PATCH v3] nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
Posted by Carl Lee via B4 Relay 1 week, 1 day ago
From: Carl Lee <carl.lee@amd.com>

Some ACPI-based platforms report incorrect IRQ trigger types (e.g.
IRQF_TRIGGER_HIGH), which can lead to interrupt storms.

Use the historically working rising-edge trigger on ACPI systems to
avoid this regression.

Device Tree-based systems continue to use the firmware-provided
trigger type.

Signed-off-by: Carl Lee <carl.lee@amd.com>
---
Some ACPI-based platforms report incorrect IRQ trigger types,
which can lead to interrupt storms.

Use rising-edge IRQ on ACPI systems to avoid this regression,
while keeping firmware-provided trigger types on non-ACPI systems.

Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: krzk@kernel.org
Cc: carl.lee@amd.com
Cc: peter.shen@amd.com
Cc: colin.huang2@amd.com
Cc: kuba@kernel.org
Cc: david@ixit.cz
Cc: luca.stefani.ge1@gmail.com
Cc: brgl@kernel.org
Cc: mpearson@squebb.ca
---
Changes in v3:
- Use rising-edge IRQ on ACPI systems to avoid interrupt storms
- Keep using firmware-provided trigger type on non-ACPI systems
- Refine commit message to focus on regression on ACPI platforms
- Link to v2: https://lore.kernel.org/r/20260312-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v2-1-362348f7fa30@amd.com

Changes in v2:
- Add missing <linux/irq.h> include for irq_get_trigger_type().
- Link to v1: https://lore.kernel.org/r/20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v1-1-9e20714411d7@amd.com
---
 drivers/nfc/nxp-nci/i2c.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6a5ce8ff91f0..266dc231c47d 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -16,6 +16,7 @@
 #include <linux/delay.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/nfc.h>
 #include <linux/gpio/consumer.h>
@@ -267,6 +268,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct nxp_nci_i2c_phy *phy;
+	unsigned long irqflags;
 	int r;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
@@ -303,9 +305,26 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
 	if (r < 0)
 		return r;
 
+	/*
+	 * ACPI platforms may report incorrect IRQ trigger types
+	 * (e.g. level-high), which can lead to interrupt storms.
+	 *
+	 * Use the historically stable rising-edge trigger for ACPI devices.
+	 *
+	 * On non-ACPI systems (e.g. Device Tree), prefer the firmware-
+	 * provided trigger type, falling back to rising-edge if not set.
+	 */
+	if (ACPI_COMPANION(dev)) {
+		irqflags = IRQF_TRIGGER_RISING;
+	} else {
+		irqflags = irq_get_trigger_type(client->irq);
+		if (!irqflags)
+			irqflags = IRQF_TRIGGER_RISING;
+	}
+
 	r = request_threaded_irq(client->irq, NULL,
 				 nxp_nci_i2c_irq_thread_fn,
-				 IRQF_ONESHOT,
+				 irqflags | IRQF_ONESHOT,
 				 NXP_NCI_I2C_DRIVER_NAME, phy);
 	if (r < 0)
 		nfc_err(&client->dev, "Unable to register IRQ handler\n");

---
base-commit: 7109a2155340cc7b21f27e832ece6df03592f2e8
change-id: 20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-cda942530c60

Best regards,
-- 
Carl Lee <carl.lee@amd.com>
Re: [PATCH v3] nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
Posted by Bartosz Golaszewski 6 days, 22 hours ago
On Sat, 16 May 2026 13:55:18 +0200, Carl Lee via B4 Relay
<devnull+carl.lee.amd.com@kernel.org> said:
> From: Carl Lee <carl.lee@amd.com>
>
> Some ACPI-based platforms report incorrect IRQ trigger types (e.g.
> IRQF_TRIGGER_HIGH), which can lead to interrupt storms.
>
> Use the historically working rising-edge trigger on ACPI systems to
> avoid this regression.
>
> Device Tree-based systems continue to use the firmware-provided
> trigger type.
>
> Signed-off-by: Carl Lee <carl.lee@amd.com>
> ---
> Some ACPI-based platforms report incorrect IRQ trigger types,
> which can lead to interrupt storms.
>
> Use rising-edge IRQ on ACPI systems to avoid this regression,
> while keeping firmware-provided trigger types on non-ACPI systems.
>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: krzk@kernel.org
> Cc: carl.lee@amd.com
> Cc: peter.shen@amd.com
> Cc: colin.huang2@amd.com
> Cc: kuba@kernel.org
> Cc: david@ixit.cz
> Cc: luca.stefani.ge1@gmail.com
> Cc: brgl@kernel.org
> Cc: mpearson@squebb.ca
> ---

LGTM!

Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Maybe:

Fixes: 57be33f85e36 ("nfc: nxp-nci: remove interrupt trigger type")
Cc: stable@vger.kernel.org # v6.19.y

?

Bart
Re: [PATCH v3] nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
Posted by Luca Stefani 1 week ago
On 16/05/2026 13:55, Carl Lee via B4 Relay wrote:
> From: Carl Lee <carl.lee@amd.com>
>
> Some ACPI-based platforms report incorrect IRQ trigger types (e.g.
> IRQF_TRIGGER_HIGH), which can lead to interrupt storms.
>
> Use the historically working rising-edge trigger on ACPI systems to
> avoid this regression.
>
> Device Tree-based systems continue to use the firmware-provided
> trigger type.
>
> Signed-off-by: Carl Lee <carl.lee@amd.com>

Tested-by: Luca Stefani <luca.stefani.ge1@gmail.com>

I wonder if all ACPI devices are reporting the wrong trigger type, but 
at least this goes back to the status quo.

I'll gladly help/test if someone wants to delve deeper, but so far this 
seems lenovo specific as Mark mentioned.

> ---
> Some ACPI-based platforms report incorrect IRQ trigger types,
> which can lead to interrupt storms.
>
> Use rising-edge IRQ on ACPI systems to avoid this regression,
> while keeping firmware-provided trigger types on non-ACPI systems.
>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: krzk@kernel.org
> Cc: carl.lee@amd.com
> Cc: peter.shen@amd.com
> Cc: colin.huang2@amd.com
> Cc: kuba@kernel.org
> Cc: david@ixit.cz
> Cc: luca.stefani.ge1@gmail.com
> Cc: brgl@kernel.org
> Cc: mpearson@squebb.ca
> ---
> Changes in v3:
> - Use rising-edge IRQ on ACPI systems to avoid interrupt storms
> - Keep using firmware-provided trigger type on non-ACPI systems
> - Refine commit message to focus on regression on ACPI platforms
> - Link to v2: https://lore.kernel.org/r/20260312-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v2-1-362348f7fa30@amd.com
>
> Changes in v2:
> - Add missing <linux/irq.h> include for irq_get_trigger_type().
> - Link to v1: https://lore.kernel.org/r/20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v1-1-9e20714411d7@amd.com
> ---
>   drivers/nfc/nxp-nci/i2c.c | 21 ++++++++++++++++++++-
>   1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
> index 6a5ce8ff91f0..266dc231c47d 100644
> --- a/drivers/nfc/nxp-nci/i2c.c
> +++ b/drivers/nfc/nxp-nci/i2c.c
> @@ -16,6 +16,7 @@
>   #include <linux/delay.h>
>   #include <linux/i2c.h>
>   #include <linux/interrupt.h>
> +#include <linux/irq.h>
>   #include <linux/module.h>
>   #include <linux/nfc.h>
>   #include <linux/gpio/consumer.h>
> @@ -267,6 +268,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
>   {
>   	struct device *dev = &client->dev;
>   	struct nxp_nci_i2c_phy *phy;
> +	unsigned long irqflags;
>   	int r;
>   
>   	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> @@ -303,9 +305,26 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
>   	if (r < 0)
>   		return r;
>   
> +	/*
> +	 * ACPI platforms may report incorrect IRQ trigger types
> +	 * (e.g. level-high), which can lead to interrupt storms.
> +	 *
> +	 * Use the historically stable rising-edge trigger for ACPI devices.
> +	 *
> +	 * On non-ACPI systems (e.g. Device Tree), prefer the firmware-
> +	 * provided trigger type, falling back to rising-edge if not set.
> +	 */
> +	if (ACPI_COMPANION(dev)) {
> +		irqflags = IRQF_TRIGGER_RISING;
> +	} else {
> +		irqflags = irq_get_trigger_type(client->irq);
> +		if (!irqflags)
> +			irqflags = IRQF_TRIGGER_RISING;
> +	}
> +
>   	r = request_threaded_irq(client->irq, NULL,
>   				 nxp_nci_i2c_irq_thread_fn,
> -				 IRQF_ONESHOT,
> +				 irqflags | IRQF_ONESHOT,
>   				 NXP_NCI_I2C_DRIVER_NAME, phy);
>   	if (r < 0)
>   		nfc_err(&client->dev, "Unable to register IRQ handler\n");
>
> ---
> base-commit: 7109a2155340cc7b21f27e832ece6df03592f2e8
> change-id: 20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-cda942530c60
>
> Best regards,