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 <rrangel@chromium.org>
Change-Id: Ifcc42ed81fff295fb168a0b343e96b3a650b1c84
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60174
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Van Patten <timvp@google.com>
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 981c2d9..15fe7ad 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -77,6 +77,16 @@
}
}
+ 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));