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>
This commit is contained in:
Karthikeyan Ramasubramanian 2021-02-09 10:07:47 -07:00 committed by Tim Wawrzynczak
parent 02bec2bd5c
commit a7e6788ea7
1 changed files with 14 additions and 0 deletions

View File

@ -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) {