summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2021-02-09 10:07:47 -0700
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-02-18 22:48:27 +0000
commita7e6788ea70ea74fb905ae70035b74ec2caf39fd (patch)
tree0de280694a0b5172f90d2f788c85ea3d46aa4599
parent02bec2bd5cbef9ab5fab422b801768686e436b51 (diff)
drivers/i2c/hid: Enforce level triggered IRQ mode
As per HID over I2C Protocol Specification[1] Version 1.00 Section 7.4, the interrupt line used by the device is required to be level triggered. This change ensures that the IRQ is appropriately configured. References: [1] http://download.microsoft.com/download/7/d/d/7dd44bb7-2a7a-4505-ac1c-7227d3d96d5b/hid-over-i2c-protocol-spec-v1-0.docx BUG=b:172846122 TEST=./util/abuild/abuild. Build and boot to OS in Dedede. Change-Id: I3245a9de6e88cd83528823251083e62288192f0d Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50442 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
-rw-r--r--src/drivers/i2c/hid/hid.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/drivers/i2c/hid/hid.c b/src/drivers/i2c/hid/hid.c
index 2d213eb74e..8705c1e34a 100644
--- a/src/drivers/i2c/hid/hid.c
+++ b/src/drivers/i2c/hid/hid.c
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpigen_dsm.h>
+#include <acpi/acpi_device.h>
+#include <assert.h>
#include <device/device.h>
#include <string.h>
#include "chip.h"
@@ -68,6 +70,18 @@ static void i2c_hid_enable(struct device *dev)
}
}
+ /*
+ * Ensure that I2C HID devices use level triggered interrupts as per ACPI
+ * I2C HID requirement. Check interrupt and GPIO interrupt.
+ */
+ if ((!config->generic.irq_gpio.pin_count &&
+ config->generic.irq.mode != ACPI_IRQ_LEVEL_TRIGGERED) ||
+ (config->generic.irq_gpio.pin_count &&
+ config->generic.irq_gpio.irq.mode != ACPI_IRQ_LEVEL_TRIGGERED)) {
+ printk(BIOS_ERR, "%s IRQ is not level triggered.\n", config->generic.hid);
+ BUG();
+ }
+
dev->ops = &i2c_hid_ops;
if (config && config->generic.desc) {