From 8753155f713b9f775c79168c773311c07cd06944 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Wed, 15 Oct 2025 13:27:42 -0500 Subject: [PATCH] mb/google/slippy/var/peppy: Add CFR menu option for touchpad type Peppy has two touchpad options, and having the ACPI device for both enabled under Windows causes issues, as they use the same resources. Since Peppy can't use the runtime detection feature supported by newer platforms, add a CFR menu option to select between the two. Default to both touchpad devices being enabled, so that there is no change in behavior until the user changes the option. TEST=build/boot Win11/Linux on google/peppy, verify touchpad functional under both OSes when correct touchpad type selected, and functional under Linux when Auto-detect is selected. Change-Id: I0e63a252cd5bbc04244c9999b7586480891013a5 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/90163 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- src/mainboard/google/slippy/cfr.c | 25 +++++++++++++++++++ src/mainboard/google/slippy/mainboard.c | 25 +++++++++++++++++-- .../peppy/include/variant/acpi/mainboard.asl | 6 +++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/slippy/cfr.c b/src/mainboard/google/slippy/cfr.c index a9801ed578..07ff82c029 100644 --- a/src/mainboard/google/slippy/cfr.c +++ b/src/mainboard/google/slippy/cfr.c @@ -5,6 +5,21 @@ #include #include +static const struct sm_object touchpad_type = SM_DECLARE_ENUM({ + .opt_name = "touchpad_type", + .ui_name = "Touchpad Type", + .ui_helptext = "Select the installed touchpad type", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Auto-detect", 0 }, + { "Elan", 1 }, + { "Cypress", 2 }, + SM_ENUM_VALUE_END }, +#if !CONFIG(BOARD_GOOGLE_PEPPY) + .flags = CFR_OPTFLAG_SUPPRESS, +#endif +}); + static struct sm_obj_form system = { .ui_name = "System", .obj_list = (const struct sm_object *[]) { @@ -21,8 +36,18 @@ static struct sm_obj_form ec = { NULL }, }; + +static struct sm_obj_form devices = { + .ui_name = "Devices", + .obj_list = (const struct sm_object *[]) { + &touchpad_type, + NULL + }, +}; + static struct sm_obj_form *sm_root[] = { &system, + &devices, &ec, NULL }; diff --git a/src/mainboard/google/slippy/mainboard.c b/src/mainboard/google/slippy/mainboard.c index 8d470f4ba6..00bc1c7f94 100644 --- a/src/mainboard/google/slippy/mainboard.c +++ b/src/mainboard/google/slippy/mainboard.c @@ -1,14 +1,20 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include +#include +#include #include #include #include -#include +#include +#include #include #include "ec.h" #include "onboard.h" +#define TP_TYPE_AUTO 0 +#define TP_TYPE_ELAN 1 +#define TP_TYPE_CYPRESS 2 + void mainboard_suspend_resume(void) { /* Call SMM finalize() handlers before resume */ @@ -20,6 +26,20 @@ static void mainboard_init(struct device *dev) mainboard_ec_init(); } +static void mainboard_fill_ssdt(const struct device *dev) +{ + if (CONFIG(BOARD_GOOGLE_PEPPY)) { + /* Get touchpad type option from CFR; enable both if not specified */ + unsigned int touchpad_type = get_uint_option("touchpad_type", TP_TYPE_AUTO); + + acpigen_write_scope("\\_SB.PCI0.I2C0"); + /* 0 = Enalble both, 1 = Elan, 2 = Cypress */ + acpigen_write_name_integer("ETPD", touchpad_type != TP_TYPE_CYPRESS ? 1 : 0); + acpigen_write_name_integer("CTPD", touchpad_type != TP_TYPE_ELAN ? 1 : 0); + acpigen_pop_len(); /* Scope */ + } +} + static int mainboard_smbios_data(struct device *dev, int *handle, unsigned long *current) { @@ -62,6 +82,7 @@ static void mainboard_enable(struct device *dev) { dev->ops->init = mainboard_init; dev->ops->get_smbios_data = mainboard_smbios_data; + dev->ops->acpi_fill_ssdt = mainboard_fill_ssdt; install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_EDP, GMA_INT15_PANEL_FIT_CENTERING, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); } diff --git a/src/mainboard/google/slippy/variants/peppy/include/variant/acpi/mainboard.asl b/src/mainboard/google/slippy/variants/peppy/include/variant/acpi/mainboard.asl index a96ec197dd..7e7c6ab414 100644 --- a/src/mainboard/google/slippy/variants/peppy/include/variant/acpi/mainboard.asl +++ b/src/mainboard/google/slippy/variants/peppy/include/variant/acpi/mainboard.asl @@ -8,6 +8,7 @@ Scope (\_SB.PCI0.I2C0) Name (_DDN, "Elan Touchpad") Name (_UID, 1) Name (ISTP, 1) // Touchpad + External (ETPD, IntObj) Name (_CRS, ResourceTemplate() { @@ -26,7 +27,7 @@ Scope (\_SB.PCI0.I2C0) Method (_STA) { - If (\S1EN == 1) { + If (ETPD == 1) { Return (0xF) } Else { Return (0x0) @@ -50,6 +51,7 @@ Scope (\_SB.PCI0.I2C0) Name (_DDN, "Cypress Touchpad") Name (_UID, 3) Name (ISTP, 1) // Touchpad + External (CTPD, IntObj) Name (_CRS, ResourceTemplate() { @@ -68,7 +70,7 @@ Scope (\_SB.PCI0.I2C0) Method (_STA) { - If (\S1EN == 1) { + If (CTPD == 1) { Return (0xF) } Else { Return (0x0)