From 511f7c3d6aa07f943bf32ac8ca42d1ce302eec7a Mon Sep 17 00:00:00 2001 From: Cliff Huang Date: Tue, 1 Apr 2025 12:33:54 -0700 Subject: [PATCH] drivers/intel/touch: Conditionally add ACPI _PRW based on wake source This change addresses an issue in the touch driver where the ACPI _PRW method was added unconditionally. The ACPI _PRW method should only be generated when an Interrupt() resource is used in the _CRS method. When a GpioInt() resource is used instead, the _PRW method is not required. The ACPI generation code has been updated to conditionally add the _PRW method based on whether the wake source is a GPIO interrupt or an IRQ interrupt. Now, the _PRW method is only added when an IRQ pin is specified, which is consistent with ACPI requirements. BUG=none TEST=Configure the DRIVERS_INTEL_TOUCH option on a motherboard that has the necessary touch configurations with wake support. Verify that the THC ACPI tables are correctly generated in the SSDT. If wake_gpio (i.e. GpioInt()) is used for wake, no _PRW is generated for the device. Signed-off-by: Cliff Huang Change-Id: I56fc8486c7494ff37c1d580d57838fee286128a6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/87085 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/drivers/intel/touch/touch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/drivers/intel/touch/touch.c b/src/drivers/intel/touch/touch.c index 02833124e6..a89d2e61ab 100644 --- a/src/drivers/intel/touch/touch.c +++ b/src/drivers/intel/touch/touch.c @@ -194,6 +194,10 @@ static void touch_generate_acpi_crs(const struct drivers_intel_touch_config *con touch_acpi_name(dev)); acpigen_write_name("_CRS"); acpigen_write_resourcetemplate_header(); + /* + * NOTE: config->wake_gpio: uses GpioInt() in _CRS; PAD needs to be Driver Mode + * config->wake_irq: uses Interrupt() in _CRS; use GPE; PAD needs to be ACPI Mode + */ if (config->wake_gpio.pin_count) acpi_device_write_gpio(&config->wake_gpio); else if (config->wake_irq.pin) @@ -201,7 +205,8 @@ static void touch_generate_acpi_crs(const struct drivers_intel_touch_config *con acpigen_write_resourcetemplate_footer(); acpigen_write_name_integer("_S0W", ACPI_DEVICE_SLEEP_D3_HOT); - acpigen_write_PRW(config->wake_gpe, 3); + if (config->wake_irq.pin) + acpigen_write_PRW(config->wake_gpe, 3); } static void touch_generate_acpi_i2cdev_dsd(const struct device *dev)