* [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
@ 2026-03-11 9:26 Carl Lee via B4 Relay
2026-03-11 11:08 ` Luca Stefani
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Carl Lee via B4 Relay @ 2026-03-11 9:26 UTC (permalink / raw)
To: netdev, linux-kernel, krzk, carl.lee, peter.shen, colin.huang2
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>
---
drivers/nfc/nxp-nci/i2c.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 6a5ce8ff91f0..6339586a6a1b 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -268,6 +268,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 +304,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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
2026-03-11 9:26 [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback Carl Lee via B4 Relay
@ 2026-03-11 11:08 ` Luca Stefani
2026-03-11 23:46 ` kernel test robot
2026-03-12 2:43 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Luca Stefani @ 2026-03-11 11:08 UTC (permalink / raw)
To: Carl Lee, netdev, linux-kernel, krzk, peter.shen, colin.huang2
[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]
On 11/03/2026 10:26, Carl Lee wrote:
> 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>
> ---
> drivers/nfc/nxp-nci/i2c.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
> index 6a5ce8ff91f0..6339586a6a1b 100644
> --- a/drivers/nfc/nxp-nci/i2c.c
> +++ b/drivers/nfc/nxp-nci/i2c.c
> @@ -268,6 +268,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 +304,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);
Doesn't build, needs #include <linux/irq.h>
> + 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,
My ACPI NXP1001 table specifies ActiveHigh that properly gets translated
into IRQF_TRIGGER_HIGH.
Sadly this seems to just show the same storm as before, I played a bit
with the driver and noticed that it is simply broken on my device, all I
get are timeouts if I read the NCI device.
I could get it working (reading tags) by hacking the driver a bit, first
of all I disable the irq as soon as I get it, otherwise I keep getting
interrupts when the device is in MODE_COLD that would end up setting
hard_fault to EREMOTEIO. With that in place I re-implemented the
enable/disable routine in nxp_nci_i2c_set_mode, and that seems to be
enough to make it working.
[-- Attachment #2: nxp.diff --]
[-- Type: text/x-patch, Size: 2448 bytes --]
diff --git a/drivers/nfc/nxp-nci/core.c b/drivers/nfc/nxp-nci/core.c
index 66b198663387..1bb5995fcdb4 100644
--- a/drivers/nfc/nxp-nci/core.c
+++ b/drivers/nfc/nxp-nci/core.c
@@ -190,10 +190,10 @@ void nxp_nci_remove(struct nci_dev *ndev)
if (info->phy_ops->set_mode)
info->phy_ops->set_mode(info->phy_id, NXP_NCI_MODE_COLD);
+ mutex_unlock(&info->info_lock);
+
nci_unregister_device(ndev);
nci_free_device(ndev);
-
- mutex_unlock(&info->info_lock);
}
EXPORT_SYMBOL(nxp_nci_remove);
diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c
index 7aaab92c616c..1e344e7afeab 100644
--- a/drivers/nfc/nxp-nci/i2c.c
+++ b/drivers/nfc/nxp-nci/i2c.c
@@ -43,19 +43,24 @@ struct nxp_nci_i2c_phy {
*/
};
-static int nxp_nci_i2c_set_mode(void *phy_id,
- enum nxp_nci_mode mode)
+static int nxp_nci_i2c_set_mode(void *phy_id, enum nxp_nci_mode mode)
{
- struct nxp_nci_i2c_phy *phy = (struct nxp_nci_i2c_phy *) phy_id;
-
- gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
- gpiod_set_value(phy->gpiod_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0);
- usleep_range(10000, 15000);
-
- if (mode == NXP_NCI_MODE_COLD)
- phy->hard_fault = 0;
-
- return 0;
+ struct nxp_nci_i2c_phy *phy = (struct nxp_nci_i2c_phy *) phy_id;
+
+ if (mode == NXP_NCI_MODE_COLD) {
+ disable_irq(phy->i2c_dev->irq);
+ gpiod_set_value(phy->gpiod_fw, 0);
+ gpiod_set_value(phy->gpiod_en, 0);
+ phy->hard_fault = 0;
+ usleep_range(10000, 15000);
+ } else {
+ gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0);
+ gpiod_set_value(phy->gpiod_en, 1);
+ msleep(150);
+ phy->hard_fault = 0;
+ enable_irq(phy->i2c_dev->irq);
+ }
+ return 0;
}
static int nxp_nci_i2c_write(void *phy_id, struct sk_buff *skb)
@@ -317,8 +322,12 @@ static int nxp_nci_i2c_probe(struct i2c_client *client)
nxp_nci_i2c_irq_thread_fn,
irqflags | IRQF_ONESHOT,
NXP_NCI_I2C_DRIVER_NAME, phy);
- if (r < 0)
+ if (r < 0) {
nfc_err(&client->dev, "Unable to register IRQ handler\n");
+ return r;
+ }
+
+ disable_irq(client->irq);
return r;
}
@@ -327,8 +336,8 @@ static void nxp_nci_i2c_remove(struct i2c_client *client)
{
struct nxp_nci_i2c_phy *phy = i2c_get_clientdata(client);
- nxp_nci_remove(phy->ndev);
free_irq(client->irq, phy);
+ nxp_nci_remove(phy->ndev);
}
static const struct i2c_device_id nxp_nci_i2c_id_table[] = {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
2026-03-11 9:26 [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback Carl Lee via B4 Relay
2026-03-11 11:08 ` Luca Stefani
@ 2026-03-11 23:46 ` kernel test robot
2026-03-12 2:43 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-11 23:46 UTC (permalink / raw)
To: Carl Lee via B4 Relay, netdev, linux-kernel, krzk, carl.lee,
peter.shen, colin.huang2
Cc: oe-kbuild-all
Hi Carl,
kernel test robot noticed the following build errors:
[auto build test ERROR on 7109a2155340cc7b21f27e832ece6df03592f2e8]
url: https://github.com/intel-lab-lkp/linux/commits/Carl-Lee-via-B4-Relay/nfc-nxp-nci-i2c-restore-IRQ-trigger-fallback/20260311-174025
base: 7109a2155340cc7b21f27e832ece6df03592f2e8
patch link: https://lore.kernel.org/r/20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v1-1-9e20714411d7%40amd.com
patch subject: [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
config: i386-buildonly-randconfig-001-20260312 (https://download.01.org/0day-ci/archive/20260312/202603120758.LA4Bjngo-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260312/202603120758.LA4Bjngo-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603120758.LA4Bjngo-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/nfc/nxp-nci/i2c.c: In function 'nxp_nci_i2c_probe':
>> drivers/nfc/nxp-nci/i2c.c:311:20: error: implicit declaration of function 'irq_get_trigger_type' [-Werror=implicit-function-declaration]
311 | irqflags = irq_get_trigger_type(client->irq);
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/irq_get_trigger_type +311 drivers/nfc/nxp-nci/i2c.c
265
266 static int nxp_nci_i2c_probe(struct i2c_client *client)
267 {
268 struct device *dev = &client->dev;
269 struct nxp_nci_i2c_phy *phy;
270 int r;
271 unsigned long irqflags;
272
273 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
274 nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
275 return -ENODEV;
276 }
277
278 phy = devm_kzalloc(&client->dev, sizeof(struct nxp_nci_i2c_phy),
279 GFP_KERNEL);
280 if (!phy)
281 return -ENOMEM;
282
283 phy->i2c_dev = client;
284 i2c_set_clientdata(client, phy);
285
286 r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios);
287 if (r)
288 dev_dbg(dev, "Unable to add GPIO mapping table\n");
289
290 phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
291 if (IS_ERR(phy->gpiod_en)) {
292 nfc_err(dev, "Failed to get EN gpio\n");
293 return PTR_ERR(phy->gpiod_en);
294 }
295
296 phy->gpiod_fw = devm_gpiod_get_optional(dev, "firmware", GPIOD_OUT_LOW);
297 if (IS_ERR(phy->gpiod_fw)) {
298 nfc_err(dev, "Failed to get FW gpio\n");
299 return PTR_ERR(phy->gpiod_fw);
300 }
301
302 r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
303 NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
304 if (r < 0)
305 return r;
306
307 /* Prefer the trigger type configured by firmware.
308 * Some platforms do not provide it, so fall back to the
309 * historically used rising-edge trigger.
310 */
> 311 irqflags = irq_get_trigger_type(client->irq);
312 if (!irqflags)
313 irqflags = IRQF_TRIGGER_RISING;
314
315 r = request_threaded_irq(client->irq, NULL,
316 nxp_nci_i2c_irq_thread_fn,
317 irqflags | IRQF_ONESHOT,
318 NXP_NCI_I2C_DRIVER_NAME, phy);
319 if (r < 0)
320 nfc_err(&client->dev, "Unable to register IRQ handler\n");
321
322 return r;
323 }
324
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
2026-03-11 9:26 [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback Carl Lee via B4 Relay
2026-03-11 11:08 ` Luca Stefani
2026-03-11 23:46 ` kernel test robot
@ 2026-03-12 2:43 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-03-12 2:43 UTC (permalink / raw)
To: Carl Lee via B4 Relay, netdev, linux-kernel, krzk, carl.lee,
peter.shen, colin.huang2
Cc: llvm, oe-kbuild-all
Hi Carl,
kernel test robot noticed the following build errors:
[auto build test ERROR on 7109a2155340cc7b21f27e832ece6df03592f2e8]
url: https://github.com/intel-lab-lkp/linux/commits/Carl-Lee-via-B4-Relay/nfc-nxp-nci-i2c-restore-IRQ-trigger-fallback/20260311-174025
base: 7109a2155340cc7b21f27e832ece6df03592f2e8
patch link: https://lore.kernel.org/r/20260311-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v1-1-9e20714411d7%40amd.com
patch subject: [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260312/202603121049.f2P9Ik4Y-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260312/202603121049.f2P9Ik4Y-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603121049.f2P9Ik4Y-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/nfc/nxp-nci/i2c.c:311:13: error: call to undeclared function 'irq_get_trigger_type'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
311 | irqflags = irq_get_trigger_type(client->irq);
| ^
1 error generated.
vim +/irq_get_trigger_type +311 drivers/nfc/nxp-nci/i2c.c
265
266 static int nxp_nci_i2c_probe(struct i2c_client *client)
267 {
268 struct device *dev = &client->dev;
269 struct nxp_nci_i2c_phy *phy;
270 int r;
271 unsigned long irqflags;
272
273 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
274 nfc_err(&client->dev, "Need I2C_FUNC_I2C\n");
275 return -ENODEV;
276 }
277
278 phy = devm_kzalloc(&client->dev, sizeof(struct nxp_nci_i2c_phy),
279 GFP_KERNEL);
280 if (!phy)
281 return -ENOMEM;
282
283 phy->i2c_dev = client;
284 i2c_set_clientdata(client, phy);
285
286 r = devm_acpi_dev_add_driver_gpios(dev, acpi_nxp_nci_gpios);
287 if (r)
288 dev_dbg(dev, "Unable to add GPIO mapping table\n");
289
290 phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
291 if (IS_ERR(phy->gpiod_en)) {
292 nfc_err(dev, "Failed to get EN gpio\n");
293 return PTR_ERR(phy->gpiod_en);
294 }
295
296 phy->gpiod_fw = devm_gpiod_get_optional(dev, "firmware", GPIOD_OUT_LOW);
297 if (IS_ERR(phy->gpiod_fw)) {
298 nfc_err(dev, "Failed to get FW gpio\n");
299 return PTR_ERR(phy->gpiod_fw);
300 }
301
302 r = nxp_nci_probe(phy, &client->dev, &i2c_phy_ops,
303 NXP_NCI_I2C_MAX_PAYLOAD, &phy->ndev);
304 if (r < 0)
305 return r;
306
307 /* Prefer the trigger type configured by firmware.
308 * Some platforms do not provide it, so fall back to the
309 * historically used rising-edge trigger.
310 */
> 311 irqflags = irq_get_trigger_type(client->irq);
312 if (!irqflags)
313 irqflags = IRQF_TRIGGER_RISING;
314
315 r = request_threaded_irq(client->irq, NULL,
316 nxp_nci_i2c_irq_thread_fn,
317 irqflags | IRQF_ONESHOT,
318 NXP_NCI_I2C_DRIVER_NAME, phy);
319 if (r < 0)
320 nfc_err(&client->dev, "Unable to register IRQ handler\n");
321
322 return r;
323 }
324
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-12 2:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 9:26 [PATCH] nfc: nxp-nci: i2c: restore IRQ trigger fallback Carl Lee via B4 Relay
2026-03-11 11:08 ` Luca Stefani
2026-03-11 23:46 ` kernel test robot
2026-03-12 2:43 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox