diff --git a/src/mainboard/google/dedede/variants/baseboard/devicetree.cb b/src/mainboard/google/dedede/variants/baseboard/devicetree.cb index fa1ad8d1e8..1b59ef056c 100644 --- a/src/mainboard/google/dedede/variants/baseboard/devicetree.cb +++ b/src/mainboard/google/dedede/variants/baseboard/devicetree.cb @@ -10,6 +10,10 @@ fw_config option DB_PORTS_1C 7 option DB_PORTS_1A_HDMI_LTE 8 end + field STYLUS 4 + option STYLUS_ABSENT 0 + option STYLUS_PRESENT 1 + end field TABLETMODE 10 option TABLETMODE_DISABLED 0 option TABLETMODE_ENABLED 1 diff --git a/src/mainboard/google/dedede/variants/magolor/Makefile.inc b/src/mainboard/google/dedede/variants/magolor/Makefile.inc index 24c75d1d9a..33333832e8 100644 --- a/src/mainboard/google/dedede/variants/magolor/Makefile.inc +++ b/src/mainboard/google/dedede/variants/magolor/Makefile.inc @@ -1,3 +1,4 @@ ## SPDX-License-Identifier: GPL-2.0-or-later ramstage-$(CONFIG_FW_CONFIG) += variant.c +ramstage-y += gpio.c diff --git a/src/mainboard/google/dedede/variants/magolor/gpio.c b/src/mainboard/google/dedede/variants/magolor/gpio.c new file mode 100644 index 0000000000..ae890851d5 --- /dev/null +++ b/src/mainboard/google/dedede/variants/magolor/gpio.c @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include +#include + +/* Pad configuration of stylus */ +static const struct pad_config stylus_det_pads[] = { + /* C12 : AP_PEN_DET_ODL (external pull-high) */ + PAD_CFG_GPI_GPIO_DRIVER(GPP_C12, NONE, DEEP), +}; + +static void fw_config_handle(void *unused) +{ + if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_PRESENT))) + gpio_configure_pads(stylus_det_pads, ARRAY_SIZE(stylus_det_pads)); +} +BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); diff --git a/src/mainboard/google/dedede/variants/magolor/overridetree.cb b/src/mainboard/google/dedede/variants/magolor/overridetree.cb index e5d75b1f9b..66fc4ea02f 100644 --- a/src/mainboard/google/dedede/variants/magolor/overridetree.cb +++ b/src/mainboard/google/dedede/variants/magolor/overridetree.cb @@ -188,6 +188,19 @@ chip soc/intel/jasperlake end end # I2C 0 device pci 15.2 on + chip drivers/generic/gpio_keys + register "name" = ""PENH"" + register "gpio" = "ACPI_GPIO_INPUT_ACTIVE_LOW(GPP_C12)" + register "key.wakeup_route" = "WAKEUP_ROUTE_GPIO_IRQ" + register "key.wakeup_event_action" = "EV_ACT_DEASSERTED" + register "key.dev_name" = ""EJCT"" + register "key.linux_code" = "SW_PEN_INSERTED" + register "key.linux_input_type" = "EV_SW" + register "key.label" = ""pen_eject"" + device generic 0 on + probe STYLUS STYLUS_PRESENT + end + end chip drivers/i2c/hid register "generic.hid" = ""ELAN6915"" register "generic.desc" = ""ELAN Touchscreen""