[PATCH v2 04/13] platform/chrome: Allow transports to select EC IRQ flags
From: Wang Yang
Date: Thu Dec 03 2026 - 23:21:41 EST
Initialize IRQ flags to IRQF_TRIGGER_LOW | IRQF_ONESHOT when the EC
device is allocated. Use these flags when registering the interrupt so
a transport can rely on the trigger type configured by its firmware.
Prepared with OpenAI Codex assistance.
Signed-off-by: Wang Yang <yang.wang@xxxxxxxxxxxxxxxx>
---
drivers/platform/chrome/cros_ec.c | 3 ++-
include/linux/platform_data/cros_ec_proto.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c
index 81631b363402..5c2ce6b74975 100644
--- a/drivers/platform/chrome/cros_ec.c
+++ b/drivers/platform/chrome/cros_ec.c
@@ -63,6 +63,7 @@ struct cros_ec_device *cros_ec_device_alloc(struct device *dev)
return NULL;
ec_dev->dev = dev;
+ ec_dev->irqflags = IRQF_TRIGGER_LOW | IRQF_ONESHOT;
ec_dev->max_response = sizeof(struct ec_response_get_protocol_info);
ec_dev->max_request = sizeof(struct ec_params_rwsig_action);
ec_dev->suspend_timeout_ms = EC_HOST_SLEEP_TIMEOUT_DEFAULT;
@@ -247,7 +248,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
err = devm_request_threaded_irq(dev, ec_dev->irq,
cros_ec_irq_handler,
cros_ec_irq_thread,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+ ec_dev->irqflags,
"chromeos-ec", ec_dev);
if (err)
goto exit;
diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h
index a1ccecf5e1f8..6307f520db55 100644
--- a/include/linux/platform_data/cros_ec_proto.h
+++ b/include/linux/platform_data/cros_ec_proto.h
@@ -111,6 +111,7 @@ struct cros_ec_command {
* @proto_version: The protocol version used for this device.
* @priv: Private data.
* @irq: Interrupt to use.
+ * @irqflags: Interrupt request flags, defaulting to IRQF_TRIGGER_LOW | IRQF_ONESHOT.
* @id: Device id.
* @din: Input buffer (for data from EC). This buffer will always be
* dword-aligned and include enough space for up to 7 word-alignment
@@ -181,6 +182,7 @@ struct cros_ec_device {
u16 proto_version;
void *priv;
int irq;
+ unsigned long irqflags;
u8 *din;
u8 *dout;
int din_size;
--
2.43.0