[PATCH v2] nfc: nxp-nci: i2c: restore IRQ trigger fallback

Carl Lee via B4 Relay posted 1 patch 3 weeks, 5 days ago
drivers/nfc/nxp-nci/i2c.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
[PATCH v2] nfc: nxp-nci: i2c: restore IRQ trigger fallback
Posted by Carl Lee via B4 Relay 3 weeks, 5 days ago
From: Carl Lee <carl.lee@amd.com>

The driver previously relied on IRQF_TRIGGER_RISING when requesting
the interrupt. This was removed to rely on the trigger type provided
by firmware.

However, some platforms do not propagate the interrupt trigger type
to the IRQ descriptor, resulting in interrupts not being triggered.

Use the trigger type provided by firmware when available and fall
back to the historically used rising-edge trigger otherwise.

Signed-off-by: Carl Lee <carl.lee@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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6a5ce8ff91f0..7aaab92c616c 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>
@@ -268,6 +269,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	struct nxp_nci_i2c_phy *phy;
 	int r;
+	unsigned long irqflags;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
@@ -303,9 +305,17 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
 	if (r < 0)
 		return r;
 
+	/* Prefer the trigger type configured by firmware.
+	 * Some platforms do not provide it, so fall back to the
+	 * historically used rising-edge trigger.
+	 */
+	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 v2] nfc: nxp-nci: i2c: restore IRQ trigger fallback
Posted by Jakub Kicinski 3 weeks ago
On Thu, 12 Mar 2026 10:51:35 +0800 Carl Lee via B4 Relay wrote:
> From: Carl Lee <carl.lee@amd.com>
> 
> The driver previously relied on IRQF_TRIGGER_RISING when requesting
> the interrupt. This was removed to rely on the trigger type provided
> by firmware.
> 
> However, some platforms do not propagate the interrupt trigger type
> to the IRQ descriptor, resulting in interrupts not being triggered.
> 
> Use the trigger type provided by firmware when available and fall
> back to the historically used rising-edge trigger otherwise.

Sounds like a regression, if you can please mention which platform you
hit the issue on, and please repost with a Fixes tag, presumably:

Fixes: 57be33f85e36 ("nfc: nxp-nci: remove interrupt trigger type")


> diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
> index 6a5ce8ff91f0..7aaab92c616c 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>
> @@ -268,6 +269,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
>  	struct device *dev = &client->dev;
>  	struct nxp_nci_i2c_phy *phy;
>  	int r;
> +	unsigned long irqflags;

nit: when you repost please order the variable lines longest to shortest

 	struct device *dev = &client->dev;
 	struct nxp_nci_i2c_phy *phy;
+	unsigned long irqflags;
 	int r;
-- 
pw-bot: cr
Re: [PATCH v2] nfc: nxp-nci: i2c: restore IRQ trigger fallback
Posted by Carl Lee 1 week, 1 day ago
On Mon, Mar 16, 2026 at 07:26:09PM -0700, Jakub Kicinski wrote:
> On Thu, 12 Mar 2026 10:51:35 +0800 Carl Lee via B4 Relay wrote:
> > From: Carl Lee <carl.lee@amd.com>
> > 
> > The driver previously relied on IRQF_TRIGGER_RISING when requesting
> > the interrupt. This was removed to rely on the trigger type provided
> > by firmware.
> > 
> > However, some platforms do not propagate the interrupt trigger type
> > to the IRQ descriptor, resulting in interrupts not being triggered.
> > 
> > Use the trigger type provided by firmware when available and fall
> > back to the historically used rising-edge trigger otherwise.
> 
> Sounds like a regression, if you can please mention which platform you
> hit the issue on, and please repost with a Fixes tag, presumably:
> 
> Fixes: 57be33f85e36 ("nfc: nxp-nci: remove interrupt trigger type")
> 
> 
> > diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
> > index 6a5ce8ff91f0..7aaab92c616c 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>
> > @@ -268,6 +269,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
> >  	struct device *dev = &client->dev;
> >  	struct nxp_nci_i2c_phy *phy;
> >  	int r;
> > +	unsigned long irqflags;
> 
> nit: when you repost please order the variable lines longest to shortest
> 
>  	struct device *dev = &client->dev;
>  	struct nxp_nci_i2c_phy *phy;
> +	unsigned long irqflags;
>  	int r;
> -- 
> pw-bot: cr
> 

Hi Jakub,

Thanks for the feedback and for the detailed investigation.

After further analysis, this issue is not related to the proposed change and does not appear to be reproducible on our side.

I will drop this patch for now.

Thanks!