Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: Add a new interrupt path for cros_ec_lpc

This commit allows cros_ec_lpc to register a direct IRQ instead of relying
on the ACPI notification chain to receive MKBP events.

This change is done in the interest of allowing reduced jitter in the
communication path between the CrOS EC and the host for receiving sensor
data.

Signed-off-by: Enrico Granata <egranata@chromium.org>
Signed-off-by: Benson Leung <bleung@chromium.org>

authored by

Enrico Granata and committed by
Benson Leung
da1cf5a1 2c42dd6e

+14 -1
+14 -1
drivers/platform/chrome/cros_ec_lpc.c
··· 25 25 #include <linux/dmi.h> 26 26 #include <linux/delay.h> 27 27 #include <linux/io.h> 28 + #include <linux/interrupt.h> 28 29 #include <linux/mfd/cros_ec.h> 29 30 #include <linux/mfd/cros_ec_commands.h> 30 31 #include <linux/module.h> ··· 250 249 acpi_status status; 251 250 struct cros_ec_device *ec_dev; 252 251 u8 buf[2]; 253 - int ret; 252 + int irq, ret; 254 253 255 254 if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, 256 255 dev_name(dev))) { ··· 288 287 ec_dev->din_size = sizeof(struct ec_host_response) + 289 288 sizeof(struct ec_response_get_protocol_info); 290 289 ec_dev->dout_size = sizeof(struct ec_host_request); 290 + 291 + /* 292 + * Some boards do not have an IRQ allotted for cros_ec_lpc, 293 + * which makes ENXIO an expected (and safe) scenario. 294 + */ 295 + irq = platform_get_irq(pdev, 0); 296 + if (irq > 0) 297 + ec_dev->irq = irq; 298 + else if (irq != -ENXIO) { 299 + dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq); 300 + return irq; 301 + } 291 302 292 303 ret = cros_ec_register(ec_dev); 293 304 if (ret) {