From ae129fc6d6fa714d5a2149f99316900148670249 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Tue, 14 Dec 2021 12:55:36 -0700 Subject: [PATCH] drivers/i2c/generic: Print error when using _CRS and PowerResource Exposing the GPIOs via an ACPI PowerResource and the _CRS results in the OS driver and ACPI thinking they own the GPIO. This can cause timing problems because it's not clear which system should be controlling the GPIO. I'm making this an error because we should really clean these up. BUG=b:210694108 TEST=Boot guybrush and see error: > I2C: 02:5d: ERROR: Exposing GPIOs in Power Resource and _CRS > \_SB.I2C1.H05D: Goodix Touchscreen at I2C: 02:5d Signed-off-by: Raul E Rangel Change-Id: Ifcc42ed81fff295fb168a0b343e96b3a650b1c84 Reviewed-on: https://review.coreboot.org/c/coreboot/+/60174 Tested-by: build bot (Jenkins) Reviewed-by: Tim Van Patten --- src/drivers/i2c/generic/generic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c index 981c2d9532..15fe7adebb 100644 --- a/src/drivers/i2c/generic/generic.c +++ b/src/drivers/i2c/generic/generic.c @@ -77,6 +77,16 @@ void i2c_generic_fill_ssdt(const struct device *dev, } } + if (config->has_power_resource && !config->disable_gpio_export_in_crs) { + /* + * This case will most likely cause timing problems. The OS driver might be + * controlling the GPIOs, but the ACPI Power Resource will also be controlling + * them. This will result in the two fighting and stomping on each other. + */ + printk(BIOS_ERR, "%s: Exposing GPIOs in Power Resource and _CRS\n", + dev_path(dev)); + } + /* Device */ acpigen_write_scope(scope); acpigen_write_device(acpi_device_name(dev));