diff --git a/src/mainboard/google/hatch/cfr.c b/src/mainboard/google/hatch/cfr.c index 2de1ebbb7c..76f12e232c 100644 --- a/src/mainboard/google/hatch/cfr.c +++ b/src/mainboard/google/hatch/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/hatch/ramstage.c b/src/mainboard/google/hatch/ramstage.c index 6cce734c90..c91ce7c449 100644 --- a/src/mainboard/google/hatch/ramstage.c +++ b/src/mainboard/google/hatch/ramstage.c @@ -1,9 +1,15 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include +#include +#include #include +#include +#include #include #include +#include #include void mainboard_silicon_init_params(FSPS_UPD *supd) @@ -26,6 +32,33 @@ void __weak variant_mainboard_enable(struct device *dev) /* Override mainboard settings per board */ } +static void update_touchpad_wake_config(void) +{ + const struct device *touchpad = DEV_PTR(touchpad); + if (!touchpad || !touchpad->chip_info) + 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_A21, NONE, DEEP, LEVEL, INVERT), + }; + gpio_configure_pads(touchpad_gpio, ARRAY_SIZE(touchpad_gpio)); + } +} + static void mainboard_init(struct device *dev) { mainboard_ec_init(); @@ -35,6 +68,7 @@ static void mainboard_enable(struct device *dev) { dev->ops->init = mainboard_init; variant_mainboard_enable(dev); + update_touchpad_wake_config(); } static void mainboard_chip_init(void *chip_info) diff --git a/src/mainboard/google/hatch/variants/akemi/overridetree.cb b/src/mainboard/google/hatch/variants/akemi/overridetree.cb index 1102c8731b..0510844e26 100644 --- a/src/mainboard/google/hatch/variants/akemi/overridetree.cb +++ b/src/mainboard/google/hatch/variants/akemi/overridetree.cb @@ -120,7 +120,7 @@ chip soc/intel/cannonlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" 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/hatch/variants/dratini/overridetree.cb b/src/mainboard/google/hatch/variants/dratini/overridetree.cb index 5ae9481f7e..b160a9161a 100644 --- a/src/mainboard/google/hatch/variants/dratini/overridetree.cb +++ b/src/mainboard/google/hatch/variants/dratini/overridetree.cb @@ -80,7 +80,7 @@ chip soc/intel/cannonlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/hatch/overridetree.cb b/src/mainboard/google/hatch/variants/hatch/overridetree.cb index 36f489516b..23b0be2a98 100644 --- a/src/mainboard/google/hatch/variants/hatch/overridetree.cb +++ b/src/mainboard/google/hatch/variants/hatch/overridetree.cb @@ -79,7 +79,7 @@ chip soc/intel/cannonlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/helios/overridetree.cb b/src/mainboard/google/hatch/variants/helios/overridetree.cb index c9f0caeb0d..880ba21c18 100644 --- a/src/mainboard/google/hatch/variants/helios/overridetree.cb +++ b/src/mainboard/google/hatch/variants/helios/overridetree.cb @@ -90,7 +90,7 @@ chip soc/intel/cannonlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb b/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb index b4421b0ec6..91fa294619 100644 --- a/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb +++ b/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb @@ -104,7 +104,7 @@ chip soc/intel/cannonlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/jinlon/overridetree.cb b/src/mainboard/google/hatch/variants/jinlon/overridetree.cb index 4f861c9ba1..79e7aff362 100644 --- a/src/mainboard/google/hatch/variants/jinlon/overridetree.cb +++ b/src/mainboard/google/hatch/variants/jinlon/overridetree.cb @@ -110,7 +110,7 @@ chip soc/intel/cannonlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" register "detect" = "1" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/kindred/overridetree.cb b/src/mainboard/google/hatch/variants/kindred/overridetree.cb index f47fce0405..c6c478ebb9 100644 --- a/src/mainboard/google/hatch/variants/kindred/overridetree.cb +++ b/src/mainboard/google/hatch/variants/kindred/overridetree.cb @@ -116,7 +116,7 @@ chip soc/intel/cannonlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" 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/hatch/variants/kohaku/overridetree.cb b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb index f00d9bb9d5..59704cafa1 100644 --- a/src/mainboard/google/hatch/variants/kohaku/overridetree.cb +++ b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb @@ -129,7 +129,7 @@ chip soc/intel/cannonlake register "generic.detect" = "1" register "generic.wake" = "GPE0_DW0_21" register "hid_desc_reg_offset" = "0x20" - device i2c 0x20 on end + device i2c 0x20 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/mushu/overridetree.cb b/src/mainboard/google/hatch/variants/mushu/overridetree.cb index 8766c9ec3a..f3b98ecc09 100644 --- a/src/mainboard/google/hatch/variants/mushu/overridetree.cb +++ b/src/mainboard/google/hatch/variants/mushu/overridetree.cb @@ -97,7 +97,7 @@ chip soc/intel/cannonlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/nightfury/overridetree.cb b/src/mainboard/google/hatch/variants/nightfury/overridetree.cb index f020f468c4..6b91bbdcdb 100644 --- a/src/mainboard/google/hatch/variants/nightfury/overridetree.cb +++ b/src/mainboard/google/hatch/variants/nightfury/overridetree.cb @@ -164,7 +164,7 @@ chip soc/intel/cannonlake register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "detect" = "1" register "wake" = "GPE0_DW0_21" - device i2c 0x15 on end + device i2c 0x15 alias touchpad on end end end device ref i2c1 on diff --git a/src/mainboard/google/hatch/variants/palkia/overridetree.cb b/src/mainboard/google/hatch/variants/palkia/overridetree.cb index 7fca6cc661..6c6b7470e4 100644 --- a/src/mainboard/google/hatch/variants/palkia/overridetree.cb +++ b/src/mainboard/google/hatch/variants/palkia/overridetree.cb @@ -101,7 +101,7 @@ chip soc/intel/cannonlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_A21_IRQ)" register "wake" = "GPE0_DW0_21" - device i2c 15 on end + device i2c 15 alias touchpad on end end end device ref i2c1 on