nfc: nxp-nci: i2c: use rising-edge IRQ on ACPI systems
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.
Fixes: 57be33f85e ("nfc: nxp-nci: remove interrupt trigger type")
Signed-off-by: Carl Lee <carl.lee@amd.com>
Tested-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Tested-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Link: https://patch.msgid.link/20260516-nfc-nxp-nci-i2c-restore-irq-trigger-fallback-v3-1-37ba4b6e9086@amd.com
Signed-off-by: David Heidelberg <david@ixit.cz>
master
parent
f040e590c0
commit
f23bf992d6
|
|
@ -16,6 +16,7 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/i2c.h>
|
#include <linux/i2c.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/irq.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/nfc.h>
|
#include <linux/nfc.h>
|
||||||
#include <linux/gpio/consumer.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 device *dev = &client->dev;
|
||||||
struct nxp_nci_i2c_phy *phy;
|
struct nxp_nci_i2c_phy *phy;
|
||||||
|
unsigned long irqflags;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
|
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)
|
if (r < 0)
|
||||||
return r;
|
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,
|
r = request_threaded_irq(client->irq, NULL,
|
||||||
nxp_nci_i2c_irq_thread_fn,
|
nxp_nci_i2c_irq_thread_fn,
|
||||||
IRQF_ONESHOT,
|
irqflags | IRQF_ONESHOT,
|
||||||
NXP_NCI_I2C_DRIVER_NAME, phy);
|
NXP_NCI_I2C_DRIVER_NAME, phy);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
nfc_err(&client->dev, "Unable to register IRQ handler\n");
|
nfc_err(&client->dev, "Unable to register IRQ handler\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue