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 <cliff.huang@intel.com>
Change-Id: I56fc8486c7494ff37c1d580d57838fee286128a6
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87085
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Cliff Huang 2025-04-01 12:33:54 -07:00 committed by Matt DeVillier
commit 511f7c3d6a

View file

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