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 <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90163
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
This commit is contained in:
Matt DeVillier 2025-10-15 13:27:42 -05:00
commit 8753155f71
3 changed files with 52 additions and 4 deletions

View file

@ -5,6 +5,21 @@
#include <ec/google/chromeec/cfr.h>
#include <southbridge/intel/lynxpoint/cfr.h>
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
};

View file

@ -1,14 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <smbios.h>
#include <acpi/acpi.h>
#include <acpi/acpigen.h>
#include <cpu/x86/smm.h>
#include <device/device.h>
#include <drivers/intel/gma/int15.h>
#include <acpi/acpi.h>
#include <option.h>
#include <smbios.h>
#include <southbridge/intel/lynxpoint/pch.h>
#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);
}

View file

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