From 8ed87f71ec6802f33131c622656e026d4354630c Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Tue, 16 Dec 2025 19:34:48 -0600 Subject: [PATCH] mb/google/volteer: Make touchpad wake user-selectable via CFR Add CFR option "touchpad_wake" (default: false) to allow users to enable touchpad wake from sleep. Wake is disabled by default to prevent random wakeups when systems are moved while sleeping. Implementation: - Add touchpad_wake CFR option to System form - Add device alias "touchpad" to variant devicetree files (add touchpad2 where a 2nd touchpad option is present) - Update variant GPIO configs to support wake capability (this was set inconsistently) - Conditionally disable wake in ramstage based on CFR option When the option is disabled (default), config->wake and config->irq.wake are set to 0, preventing the touchpad ACPI device from defining wake methods and capability. TEST_1: Build for ELDRID, boot system into mainlinue Linux (Fedora). Close the lid to suspend the system, firmly grab it with both hands and jump 10 times. Make sure that system doesn't wake up from sleep state. TEST_2: Build for DROBIT, boot system into mainline Linux (NixOS). Close the lid to suspend the system, firmly grab it with both hands and jump few times. Make sure that system doesn't wake up from sleep state. Tested-by: Ingo Reitz <9l@9lo.re> Change-Id: Ie3b5013bcf2d5ea45388bcdce987dd9ae5870597 Co-authored-by: Alicja Michalska Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/90500 Tested-by: build bot (Jenkins) Reviewed-by: Alicja Michalska --- src/mainboard/google/volteer/cfr.c | 14 ++++++++ src/mainboard/google/volteer/mainboard.c | 33 +++++++++++++++++++ .../variants/chronicler/overridetree.cb | 2 +- .../volteer/variants/collis/overridetree.cb | 4 +-- .../volteer/variants/copano/overridetree.cb | 4 +-- .../volteer/variants/delbin/overridetree.cb | 2 +- .../volteer/variants/drobit/overridetree.cb | 2 +- .../volteer/variants/eldrid/overridetree.cb | 2 +- .../volteer/variants/elemi/overridetree.cb | 2 +- .../volteer/variants/halvor/overridetree.cb | 2 +- .../volteer/variants/lindar/overridetree.cb | 2 +- .../volteer/variants/malefor/overridetree.cb | 2 +- .../volteer/variants/terrador/overridetree.cb | 2 +- .../volteer/variants/todor/overridetree.cb | 2 +- .../google/volteer/variants/trondo/gpio.c | 2 +- .../volteer/variants/trondo/overridetree.cb | 2 +- .../volteer/variants/voema/overridetree.cb | 2 +- .../google/volteer/variants/volet/gpio.c | 2 +- .../volteer/variants/volet/overridetree.cb | 2 +- .../volteer/variants/volteer/overridetree.cb | 2 +- .../volteer/variants/volteer2/overridetree.cb | 2 +- .../google/volteer/variants/voxel/gpio.c | 2 +- .../volteer/variants/voxel/overridetree.cb | 2 +- 23 files changed, 70 insertions(+), 23 deletions(-) diff --git a/src/mainboard/google/volteer/cfr.c b/src/mainboard/google/volteer/cfr.c index 2de1ebbb7c..76f12e232c 100644 --- a/src/mainboard/google/volteer/cfr.c +++ b/src/mainboard/google/volteer/cfr.c @@ -7,6 +7,19 @@ #include #include +static const struct sm_object touchpad_wake = SM_DECLARE_ENUM({ + .opt_name = "touchpad_wake", + .ui_name = "Touchpad Wake", + .ui_helptext = "Enable or disable touchpad wake from sleep.\n" + "Disabled by default to prevent random wakeups when\n" + "the system is moved while sleeping.", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Disabled", 0 }, + { "Enabled", 1 }, + SM_ENUM_VALUE_END }, +}); + static struct sm_obj_form system = { .ui_name = "System", .obj_list = (const struct sm_object *[]) { @@ -21,6 +34,7 @@ static struct sm_obj_form system = { &pciexp_l1ss, &pciexp_speed, &s0ix_enable, + &touchpad_wake, &vtd, NULL }, diff --git a/src/mainboard/google/volteer/mainboard.c b/src/mainboard/google/volteer/mainboard.c index 4d62ed6118..c17dd7cdb7 100644 --- a/src/mainboard/google/volteer/mainboard.c +++ b/src/mainboard/google/volteer/mainboard.c @@ -4,10 +4,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -16,10 +18,13 @@ #include #include #include +#include #include "drivers/intel/pmc_mux/conn/chip.h" WEAK_DEV_PTR(conn1); +WEAK_DEV_PTR(touchpad); +WEAK_DEV_PTR(touchpad2); static void typec_orientation_fixup(void) { @@ -74,12 +79,40 @@ static void mainboard_smbios_strings(struct device *dev, struct smbios_type11 *t fw_config_for_each_found(add_fw_config_oem_string, t); } +static void update_touchpad_wake_config(const struct device *touchpad) +{ + if (!touchpad || !touchpad->chip_info || !is_dev_enabled(touchpad)) + return; + + /* Check CFR option for touchpad wake */ + unsigned int touchpad_wake_enabled = get_uint_option("touchpad_wake", 0); + + printk(BIOS_DEBUG, "Touchpad wake: %s\n", touchpad_wake_enabled?"enabled":"disabled"); + + /* Modify devicetree config directly */ + struct drivers_i2c_generic_config *config = + (struct drivers_i2c_generic_config *)touchpad->chip_info; + if (!touchpad_wake_enabled) { + /* Disable wake GPE and wake flag in IRQ descriptor */ + config->wake = 0; + config->irq.wake = 0; + + /* Reconfigure GPIO pad to remove wake capability */ + const struct pad_config touchpad_gpio[] = { + PAD_CFG_GPI_APIC(GPP_E15, NONE, PLTRST, LEVEL, INVERT), + }; + gpio_configure_pads(touchpad_gpio, ARRAY_SIZE(touchpad_gpio)); + } +} + static void mainboard_enable(struct device *dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_strings = mainboard_smbios_strings; variant_ramstage_init(); + update_touchpad_wake_config(DEV_PTR(touchpad)); + update_touchpad_wake_config(DEV_PTR(touchpad2)); } void mainboard_update_soc_chip_config(struct soc_intel_tigerlake_config *cfg) diff --git a/src/mainboard/google/volteer/variants/chronicler/overridetree.cb b/src/mainboard/google/volteer/variants/chronicler/overridetree.cb index 4688c23144..180acca7b3 100644 --- a/src/mainboard/google/volteer/variants/chronicler/overridetree.cb +++ b/src/mainboard/google/volteer/variants/chronicler/overridetree.cb @@ -242,7 +242,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/collis/overridetree.cb b/src/mainboard/google/volteer/variants/collis/overridetree.cb index b5426c16ba..b3f04d9e9c 100644 --- a/src/mainboard/google/volteer/variants/collis/overridetree.cb +++ b/src/mainboard/google/volteer/variants/collis/overridetree.cb @@ -157,7 +157,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on + device i2c 15 alias touchpad on probe TOUCHPAD REGULAR_TOUCHPAD end end @@ -168,7 +168,7 @@ chip soc/intel/tigerlake register "generic.wake" = "GPE0_DW2_15" register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on + device i2c 15 alias touchpad2 on probe TOUCHPAD NUMPAD_TOUCHPAD end end diff --git a/src/mainboard/google/volteer/variants/copano/overridetree.cb b/src/mainboard/google/volteer/variants/copano/overridetree.cb index 6ff20d0d9a..5ec8c9ac76 100644 --- a/src/mainboard/google/volteer/variants/copano/overridetree.cb +++ b/src/mainboard/google/volteer/variants/copano/overridetree.cb @@ -184,7 +184,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on + device i2c 15 alias touchpad on probe TOUCHPAD REGULAR_TOUCHPAD end end @@ -195,7 +195,7 @@ chip soc/intel/tigerlake register "generic.wake" = "GPE0_DW2_15" register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on + device i2c 15 alias touchpad2 on probe TOUCHPAD NUMPAD_TOUCHPAD end end diff --git a/src/mainboard/google/volteer/variants/delbin/overridetree.cb b/src/mainboard/google/volteer/variants/delbin/overridetree.cb index cca423f99d..f40378b8ab 100644 --- a/src/mainboard/google/volteer/variants/delbin/overridetree.cb +++ b/src/mainboard/google/volteer/variants/delbin/overridetree.cb @@ -176,7 +176,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/drobit/overridetree.cb b/src/mainboard/google/volteer/variants/drobit/overridetree.cb index 148af6e66f..be0b99baff 100644 --- a/src/mainboard/google/volteer/variants/drobit/overridetree.cb +++ b/src/mainboard/google/volteer/variants/drobit/overridetree.cb @@ -186,7 +186,7 @@ chip soc/intel/tigerlake register "generic.wake" = "GPE0_DW2_15" register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/eldrid/overridetree.cb b/src/mainboard/google/volteer/variants/eldrid/overridetree.cb index 89b0d15123..cd146a6bfb 100644 --- a/src/mainboard/google/volteer/variants/eldrid/overridetree.cb +++ b/src/mainboard/google/volteer/variants/eldrid/overridetree.cb @@ -148,7 +148,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/elemi/overridetree.cb b/src/mainboard/google/volteer/variants/elemi/overridetree.cb index abf2345be0..8f220b8fcd 100644 --- a/src/mainboard/google/volteer/variants/elemi/overridetree.cb +++ b/src/mainboard/google/volteer/variants/elemi/overridetree.cb @@ -243,7 +243,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/halvor/overridetree.cb b/src/mainboard/google/volteer/variants/halvor/overridetree.cb index 46a9014ed1..3a5ef7422c 100644 --- a/src/mainboard/google/volteer/variants/halvor/overridetree.cb +++ b/src/mainboard/google/volteer/variants/halvor/overridetree.cb @@ -93,7 +93,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref hda on end diff --git a/src/mainboard/google/volteer/variants/lindar/overridetree.cb b/src/mainboard/google/volteer/variants/lindar/overridetree.cb index 0f04be23a8..cbca78928a 100644 --- a/src/mainboard/google/volteer/variants/lindar/overridetree.cb +++ b/src/mainboard/google/volteer/variants/lindar/overridetree.cb @@ -240,7 +240,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end chip drivers/i2c/hid register "generic.hid" = ""SYNA0000"" diff --git a/src/mainboard/google/volteer/variants/malefor/overridetree.cb b/src/mainboard/google/volteer/variants/malefor/overridetree.cb index 23e4cfc3be..3827bc2fa1 100644 --- a/src/mainboard/google/volteer/variants/malefor/overridetree.cb +++ b/src/mainboard/google/volteer/variants/malefor/overridetree.cb @@ -72,7 +72,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref hda on diff --git a/src/mainboard/google/volteer/variants/terrador/overridetree.cb b/src/mainboard/google/volteer/variants/terrador/overridetree.cb index ff99716d5a..2dd4c5a8b4 100644 --- a/src/mainboard/google/volteer/variants/terrador/overridetree.cb +++ b/src/mainboard/google/volteer/variants/terrador/overridetree.cb @@ -112,7 +112,7 @@ chip soc/intel/tigerlake register "generic.wake" = "GPE0_DW2_15" register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/todor/overridetree.cb b/src/mainboard/google/volteer/variants/todor/overridetree.cb index e5ebdd1576..2e712e687a 100644 --- a/src/mainboard/google/volteer/variants/todor/overridetree.cb +++ b/src/mainboard/google/volteer/variants/todor/overridetree.cb @@ -124,7 +124,7 @@ chip soc/intel/tigerlake register "generic.wake" = "GPE0_DW2_15" register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/trondo/gpio.c b/src/mainboard/google/volteer/variants/trondo/gpio.c index b759e3f1e0..dd7c8709b6 100644 --- a/src/mainboard/google/volteer/variants/trondo/gpio.c +++ b/src/mainboard/google/volteer/variants/trondo/gpio.c @@ -128,7 +128,7 @@ static const struct pad_config override_gpio_table[] = { /* E12 : SPI1_MISO_IO1 ==> PEN_OC_ODL */ PAD_CFG_GPI(GPP_E12, NONE, DEEP), /* E15 : ISH_GP6 ==> TRACKPAD_INT_ODL */ - PAD_CFG_GPI_APIC(GPP_E15, NONE, PLTRST, LEVEL, INVERT), + PAD_CFG_GPI_IRQ_WAKE(GPP_E15, NONE, PLTRST, LEVEL, INVERT), /* E16 : ISH_GP7 ==> WWAN_SIM1_DET_OD */ PAD_CFG_GPI(GPP_E16, NONE, DEEP), /* E17 : THC0_SPI1_INT# ==> WWAN_PERST_L */ diff --git a/src/mainboard/google/volteer/variants/trondo/overridetree.cb b/src/mainboard/google/volteer/variants/trondo/overridetree.cb index ec86cb52b4..6c0a6821aa 100644 --- a/src/mainboard/google/volteer/variants/trondo/overridetree.cb +++ b/src/mainboard/google/volteer/variants/trondo/overridetree.cb @@ -65,7 +65,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref north_xhci on diff --git a/src/mainboard/google/volteer/variants/voema/overridetree.cb b/src/mainboard/google/volteer/variants/voema/overridetree.cb index bbf51356ac..e4b2616807 100644 --- a/src/mainboard/google/volteer/variants/voema/overridetree.cb +++ b/src/mainboard/google/volteer/variants/voema/overridetree.cb @@ -69,7 +69,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref pch_espi on diff --git a/src/mainboard/google/volteer/variants/volet/gpio.c b/src/mainboard/google/volteer/variants/volet/gpio.c index 4f755bb9b5..407f093023 100644 --- a/src/mainboard/google/volteer/variants/volet/gpio.c +++ b/src/mainboard/google/volteer/variants/volet/gpio.c @@ -128,7 +128,7 @@ static const struct pad_config override_gpio_table[] = { /* E12 : SPI1_MISO_IO1 ==> PEN_OC_ODL */ PAD_CFG_GPI(GPP_E12, NONE, DEEP), /* E15 : ISH_GP6 ==> TRACKPAD_INT_ODL */ - PAD_CFG_GPI_APIC(GPP_E15, NONE, PLTRST, LEVEL, INVERT), + PAD_CFG_GPI_IRQ_WAKE(GPP_E15, NONE, PLTRST, LEVEL, INVERT), /* E16 : ISH_GP7 ==> WWAN_SIM1_DET_OD */ PAD_CFG_GPI(GPP_E16, NONE, DEEP), /* E17 : THC0_SPI1_INT# ==> WWAN_PERST_L */ diff --git a/src/mainboard/google/volteer/variants/volet/overridetree.cb b/src/mainboard/google/volteer/variants/volet/overridetree.cb index 1f8a7b26a4..4aaeda4073 100644 --- a/src/mainboard/google/volteer/variants/volet/overridetree.cb +++ b/src/mainboard/google/volteer/variants/volet/overridetree.cb @@ -107,7 +107,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end chip drivers/i2c/hid register "generic.hid" = ""SYNA0000"" diff --git a/src/mainboard/google/volteer/variants/volteer/overridetree.cb b/src/mainboard/google/volteer/variants/volteer/overridetree.cb index cca74ba986..c489c2dc91 100644 --- a/src/mainboard/google/volteer/variants/volteer/overridetree.cb +++ b/src/mainboard/google/volteer/variants/volteer/overridetree.cb @@ -174,7 +174,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref hda on diff --git a/src/mainboard/google/volteer/variants/volteer2/overridetree.cb b/src/mainboard/google/volteer/variants/volteer2/overridetree.cb index ab49d5f320..ee181c86e0 100644 --- a/src/mainboard/google/volteer/variants/volteer2/overridetree.cb +++ b/src/mainboard/google/volteer/variants/volteer2/overridetree.cb @@ -233,7 +233,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref hda on diff --git a/src/mainboard/google/volteer/variants/voxel/gpio.c b/src/mainboard/google/volteer/variants/voxel/gpio.c index fc428b25a3..2d20fabb76 100644 --- a/src/mainboard/google/volteer/variants/voxel/gpio.c +++ b/src/mainboard/google/volteer/variants/voxel/gpio.c @@ -128,7 +128,7 @@ static const struct pad_config override_gpio_table[] = { /* E12 : SPI1_MISO_IO1 ==> PEN_OC_ODL */ PAD_CFG_GPI(GPP_E12, NONE, DEEP), /* E15 : ISH_GP6 ==> TRACKPAD_INT_ODL */ - PAD_CFG_GPI_APIC(GPP_E15, NONE, PLTRST, LEVEL, INVERT), + PAD_CFG_GPI_IRQ_WAKE(GPP_E15, NONE, PLTRST, LEVEL, INVERT), /* E16 : ISH_GP7 ==> WWAN_SIM1_DET_OD */ PAD_CFG_GPI(GPP_E16, NONE, DEEP), /* E17 : THC0_SPI1_INT# ==> WWAN_PERST_L */ diff --git a/src/mainboard/google/volteer/variants/voxel/overridetree.cb b/src/mainboard/google/volteer/variants/voxel/overridetree.cb index 3a4bb1bdec..6475a119ed 100644 --- a/src/mainboard/google/volteer/variants/voxel/overridetree.cb +++ b/src/mainboard/google/volteer/variants/voxel/overridetree.cb @@ -200,7 +200,7 @@ chip soc/intel/tigerlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_E15_IRQ)" register "wake" = "GPE0_DW2_15" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end chip drivers/i2c/hid register "generic.hid" = ""SYNA0000""