From ee599486ac4a2aed195a7c53f8eec2832359110d Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 19 Oct 2025 16:13:41 -0500 Subject: [PATCH] mb/google/dedede/galtic: Add CFR option for touchpad type The i2c auto-detection cannot distinguish between two touchpads using the same i2c bus and address, so drop the 'detect' flag amd implement a user-selectable CFR option instead, defaulting to both enabled. This will allow either touchpad to work properly under Linux, and give the user the ability to only enable the touchpad actually present should they wish to run Windows. Change-Id: Iaf1406c2d10bbf10b9aea30ae1cd2b2281bfcc5d Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/90350 Tested-by: build bot (Jenkins) Reviewed-by: Jason Glenesk --- src/mainboard/google/dedede/cfr.c | 16 +++++++++++++ .../dedede/variants/galtic/overridetree.cb | 6 ++--- .../google/dedede/variants/galtic/variant.c | 24 +++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/mainboard/google/dedede/cfr.c b/src/mainboard/google/dedede/cfr.c index 50f85c90cb..63705fcd3d 100644 --- a/src/mainboard/google/dedede/cfr.c +++ b/src/mainboard/google/dedede/cfr.c @@ -24,6 +24,21 @@ static const struct sm_object touchscreen = SM_DECLARE_ENUM({ #endif }); +static const struct sm_object touchpad = SM_DECLARE_ENUM({ + .opt_name = "touchpad", + .ui_name = "Touchpad Type", + .ui_helptext = "Select the model of the integrated touchpad device", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "Auto-select", 0 }, + { "ELAN0000", 1 }, + { "ELAN2702", 2 }, + SM_ENUM_VALUE_END }, +#if !CONFIG(BOARD_GOOGLE_GALTIC) + .flags = CFR_OPTFLAG_SUPPRESS, +#endif +}); + static struct sm_obj_form system = { .ui_name = "System", .obj_list = (const struct sm_object *[]) { @@ -54,6 +69,7 @@ static struct sm_obj_form devices = { .ui_name = "Devices", .obj_list = (const struct sm_object *[]) { &touchscreen, + &touchpad, NULL }, }; diff --git a/src/mainboard/google/dedede/variants/galtic/overridetree.cb b/src/mainboard/google/dedede/variants/galtic/overridetree.cb index 32977c6e99..0ef9cdb5da 100644 --- a/src/mainboard/google/dedede/variants/galtic/overridetree.cb +++ b/src/mainboard/google/dedede/variants/galtic/overridetree.cb @@ -143,17 +143,15 @@ chip soc/intel/jasperlake register "desc" = ""ELAN Touchpad"" register "irq" = "ACPI_IRQ_WAKE_EDGE_LOW(GPP_B3_IRQ)" register "wake" = "GPE0_DW0_03" - register "detect" = "1" - device i2c 15 on end + device i2c 15 alias elan0000 on end end chip drivers/i2c/hid register "generic.hid" = ""ELAN2702"" register "generic.desc" = ""ELAN Touchpad"" register "generic.irq" = "ACPI_IRQ_WAKE_LEVEL_LOW(GPP_B3_IRQ)" register "generic.wake" = "GPE0_DW0_03" - register "generic.detect" = "1" register "hid_desc_reg_offset" = "0x01" - device i2c 15 on end + device i2c 15 alias elan2702 on end end end device pci 15.2 on diff --git a/src/mainboard/google/dedede/variants/galtic/variant.c b/src/mainboard/google/dedede/variants/galtic/variant.c index 1e62f0c187..a3f91896c0 100644 --- a/src/mainboard/google/dedede/variants/galtic/variant.c +++ b/src/mainboard/google/dedede/variants/galtic/variant.c @@ -1,8 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include +#include #include #include +#include #include +#include enum { GALTIC_SKU_START = 0x120000, @@ -37,3 +41,23 @@ const char *get_wifi_sar_cbfs_filename(void) return WIFI_SAR_CBFS_DEFAULT_FILENAME; } + +#define TP_TYPE_AUTO_SELECT 0 +#define TP_TYPE_ELAN0000 1 +#define TP_TYPE_ELAN2702 2 + +void variant_devtree_update(void) +{ + struct device *tp_elan0000 = DEV_PTR(elan0000); + struct device *tp_elan2702 = DEV_PTR(elan2702); + + /* Update touchpad device */ + switch (get_uint_option("touchpad", TP_TYPE_AUTO_SELECT)) { + case TP_TYPE_ELAN0000: + tp_elan2702->enabled = 0; + break; + case TP_TYPE_ELAN2702: + tp_elan0000->enabled = 0; + break; + } +}