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 <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90350
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jason Glenesk <jason.glenesk@gmail.com>
This commit is contained in:
Matt DeVillier 2025-10-19 16:13:41 -05:00
commit ee599486ac
3 changed files with 42 additions and 4 deletions

View file

@ -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
},
};

View file

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

View file

@ -1,8 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <baseboard/variants.h>
#include <device/device.h>
#include <ec/google/chromeec/ec.h>
#include <fw_config.h>
#include <option.h>
#include <sar.h>
#include <static.h>
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;
}
}