From 528448e3fc5c82e982817b81b643084977db9cdf Mon Sep 17 00:00:00 2001 From: Shelley Chen Date: Wed, 30 May 2018 20:13:24 -0700 Subject: mb/google/poppy/variants/nami: Fix Elan touchscreen power off sequence Power off does not seem to use the ACPI _OFF function, but rather the smihandler. Creating variant_smi_sleep function for nami to handle the power off sequence during reboot/power off. BUG=b:78311818 BRANCH=None TEST=Run "poweroff" command from AP console with SMI_DEBUG enabled Make sure delays are consistent with spec Change-Id: Ifeea545fe268be249793b3e508c51f5e4c1a3460 Signed-off-by: Shelley Chen Reviewed-on: https://review.coreboot.org/26724 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/mainboard/google/poppy/smihandler.c | 4 ++ .../baseboard/include/baseboard/variants.h | 1 + .../google/poppy/variants/nami/Makefile.inc | 2 + .../google/poppy/variants/nami/smihandler.c | 47 ++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 src/mainboard/google/poppy/variants/nami/smihandler.c (limited to 'src') diff --git a/src/mainboard/google/poppy/smihandler.c b/src/mainboard/google/poppy/smihandler.c index e880581d5b..c8ff7499ba 100644 --- a/src/mainboard/google/poppy/smihandler.c +++ b/src/mainboard/google/poppy/smihandler.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -29,8 +30,11 @@ void mainboard_smi_espi_handler(void) chromeec_smi_process_events(); } +void __weak variant_smi_sleep(u8 slp_typ) {} + void mainboard_smi_sleep(u8 slp_typ) { + variant_smi_sleep(slp_typ); chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS, MAINBOARD_EC_S5_WAKE_EVENTS); } diff --git a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h index 97cb0fef2e..7e850b6e78 100644 --- a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h @@ -54,6 +54,7 @@ void variant_memory_params(struct memory_params *p); int variant_memory_sku(void); void variant_devtree_update(void); uint32_t variant_board_sku(void); +void variant_smi_sleep(u8 slp_typ); struct nhlt; void variant_nhlt_init(struct nhlt *nhlt); diff --git a/src/mainboard/google/poppy/variants/nami/Makefile.inc b/src/mainboard/google/poppy/variants/nami/Makefile.inc index 618011caef..8fc0264ccf 100644 --- a/src/mainboard/google/poppy/variants/nami/Makefile.inc +++ b/src/mainboard/google/poppy/variants/nami/Makefile.inc @@ -35,6 +35,8 @@ ramstage-y += gpio.c ramstage-y += nhlt.c ramstage-y += mainboard.c +smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.c + # Add OEM ID table cbfs-files-y += oem.bin oem.bin-file := $(call strip_quotes,$(CONFIG_OEM_BIN_FILE)) diff --git a/src/mainboard/google/poppy/variants/nami/smihandler.c b/src/mainboard/google/poppy/variants/nami/smihandler.c new file mode 100644 index 0000000000..b29e8ccb56 --- /dev/null +++ b/src/mainboard/google/poppy/variants/nami/smihandler.c @@ -0,0 +1,47 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2018 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include "gpio.h" + +#define TOUCH_DISABLE GPP_C3 +#define TOUCH_RESET GPP_B3 +#define TOUCH_ENABLE GPP_B4 + +/* + * Elan touchscreen has higher delay requirements than the other + * devices, so using that. + */ +#define ELAN_STOP_OFF_DELAY 2 +#define ELAN_RESET_OFF_DELAY 2 +#define ELAN_ENABLE_OFF_DELAY 100 + +void variant_smi_sleep(u8 slp_typ) +{ + if (slp_typ == ACPI_S5) { + /* TOUCHSCREEN_DIS# */ + gpio_set(TOUCH_DISABLE, 0); + mdelay(ELAN_STOP_OFF_DELAY); + /* TOUCHSCREEN_RST# */ + gpio_set(TOUCH_RESET, 0); + mdelay(ELAN_RESET_OFF_DELAY); + /* EN_PP3300_DX_TOUCHSCREEN */ + gpio_set(TOUCH_ENABLE, 0); + mdelay(ELAN_ENABLE_OFF_DELAY); + } +} -- cgit v1.2.3