Skip to content

Commit da1cf5a

Browse files
Enrico Granatableungatchromium
authored andcommitted
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>
1 parent 2c42dd6 commit da1cf5a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/dmi.h>
2626
#include <linux/delay.h>
2727
#include <linux/io.h>
28+
#include <linux/interrupt.h>
2829
#include <linux/mfd/cros_ec.h>
2930
#include <linux/mfd/cros_ec_commands.h>
3031
#include <linux/module.h>
@@ -249,7 +250,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
249250
acpi_status status;
250251
struct cros_ec_device *ec_dev;
251252
u8 buf[2];
252-
int ret;
253+
int irq, ret;
253254

254255
if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE,
255256
dev_name(dev))) {
@@ -288,6 +289,18 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
288289
sizeof(struct ec_response_get_protocol_info);
289290
ec_dev->dout_size = sizeof(struct ec_host_request);
290291

292+
/*
293+
* Some boards do not have an IRQ allotted for cros_ec_lpc,
294+
* which makes ENXIO an expected (and safe) scenario.
295+
*/
296+
irq = platform_get_irq(pdev, 0);
297+
if (irq > 0)
298+
ec_dev->irq = irq;
299+
else if (irq != -ENXIO) {
300+
dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
301+
return irq;
302+
}
303+
291304
ret = cros_ec_register(ec_dev);
292305
if (ret) {
293306
dev_err(dev, "couldn't register ec_dev (%d)\n", ret);

0 commit comments

Comments
 (0)