mb/google/dedede/var/magolor: Add stylus function

Add the stylus field in fw_config.
Update devicetree and gpio to handle stylus pen detection.

BUG=b:167983049
TEST=Build firmware and check behavior as following:
     1) Set the fw_config "bit4=1" for pen present:
     	Wake up from suspend when pen is removed from the garage.
     	Present the stylus menu when pen is removed from the garage.
     2) Set the fw_config "bit4=0" for pen absent:
        Wake up and present menu will not work when pen is removed
	form the garage.

Change-Id: I62489bb289b18f9aa0823005224eda3ef5218e03
Signed-off-by: Ren Kuo <ren.kuo@quanta.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/60185
Reviewed-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Ren Kuo 2021-12-16 14:32:17 +08:00 committed by Felix Held
parent 4f1378ee47
commit 84cd7c351f
4 changed files with 38 additions and 0 deletions

View File

@ -10,6 +10,10 @@ fw_config
option DB_PORTS_1C 7 option DB_PORTS_1C 7
option DB_PORTS_1A_HDMI_LTE 8 option DB_PORTS_1A_HDMI_LTE 8
end end
field STYLUS 4
option STYLUS_ABSENT 0
option STYLUS_PRESENT 1
end
field TABLETMODE 10 field TABLETMODE 10
option TABLETMODE_DISABLED 0 option TABLETMODE_DISABLED 0
option TABLETMODE_ENABLED 1 option TABLETMODE_ENABLED 1

View File

@ -1,3 +1,4 @@
## SPDX-License-Identifier: GPL-2.0-or-later ## SPDX-License-Identifier: GPL-2.0-or-later
ramstage-$(CONFIG_FW_CONFIG) += variant.c ramstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-y += gpio.c

View File

@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <baseboard/gpio.h>
#include <baseboard/variants.h>
#include <bootstate.h>
#include <fw_config.h>
#include <commonlib/helpers.h>
/* 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);

View File

@ -188,6 +188,19 @@ chip soc/intel/jasperlake
end end
end # I2C 0 end # I2C 0
device pci 15.2 on 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 chip drivers/i2c/hid
register "generic.hid" = ""ELAN6915"" register "generic.hid" = ""ELAN6915""
register "generic.desc" = ""ELAN Touchscreen"" register "generic.desc" = ""ELAN Touchscreen""