From db93a8d74c52bc30945120c0f43c527c8af3148c Mon Sep 17 00:00:00 2001 From: Elthan_Huang Date: Mon, 29 Jan 2018 10:57:37 +0800 Subject: Nami: Enable hibernate using silego Nami EC has EC_HIBERNATE pin connected to a silego (U91). When this pin is asserted, U91 shuts down ROP_PMIC_ENVR3, which turns off the EC. Thus, we don't use the internal hibernate/wake-up feature in npcx. BUG=b:72641658 BRANCH=none TEST=Test system will shutdown and doesn't auto wake up when type hibernate in ec console. And wake up by AC plugin, LID open, or power button. Change-Id: Ib9e02f7e41087e5972eedf4855d88a4c45c75bb4 Signed-off-by: Elthan_Huang Reviewed-on: https://chromium-review.googlesource.com/890569 Commit-Ready: Daisuke Nojiri Tested-by: Raymond Chou Reviewed-by: Raymond Chou Reviewed-by: Daisuke Nojiri --- board/nami/board.c | 12 +++--------- board/nami/board.h | 1 + chip/npcx/registers.h | 1 - chip/npcx/system.c | 6 ++++-- include/config.h | 6 ++++++ 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/board/nami/board.c b/board/nami/board.c index 40891acc89..a5a9a1ac68 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -131,14 +131,6 @@ const struct power_signal_info power_signal_list[] = { }; BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); -/* Hibernate wake configuration */ -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_AC_PRESENT, - GPIO_LID_OPEN, - GPIO_POWER_BUTTON_L, -}; -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); - /* ADC channels */ const struct adc_t adc_channels[] = { /* Vbus sensing (10x voltage divider). PPVAR_BOOSTIN_SENSE */ @@ -488,7 +480,9 @@ void board_hibernate(void) { CPRINTS("Triggering PMIC shutdown."); uart_flush_output(); - /* dnojiri: revisit */ + gpio_set_level(GPIO_EC_HIBERNATE, 1); + while (1) + ; } const struct pwm_t pwm_channels[] = { diff --git a/board/nami/board.h b/board/nami/board.h index 6fb0c7d5c1..e6809aa89f 100644 --- a/board/nami/board.h +++ b/board/nami/board.h @@ -49,6 +49,7 @@ #define CONFIG_WIRELESS_SUSPEND \ (EC_WIRELESS_SWITCH_WLAN | EC_WIRELESS_SWITCH_WLAN_POWER) #define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_DX_WLAN +#undef CONFIG_SUPPORT_CHIP_HIBERNATION /* EC console commands */ #define CONFIG_CMD_ACCELS diff --git a/chip/npcx/registers.h b/chip/npcx/registers.h index 0e12e5f7f4..855adfb32d 100644 --- a/chip/npcx/registers.h +++ b/chip/npcx/registers.h @@ -47,7 +47,6 @@ /* Switcher of features */ #define SUPPORT_LCT 1 #define SUPPORT_WDG 1 -#define SUPPORT_HIB 1 #define SUPPORT_P80_SEG 0 /* Note: it uses KSO10 & KSO11 */ /* Switcher of debugging */ #define DEBUG_GPIO 0 diff --git a/chip/npcx/system.c b/chip/npcx/system.c index aa7b239c38..b2d4c4b0c0 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -422,7 +422,8 @@ void system_check_reset_cause(void) /** * Chip-level function to set GPIOs and wake-up inputs for hibernate. */ -void system_set_gpios_and_wakeup_inputs_hibernate(void) +#ifdef CONFIG_SUPPORT_CHIP_HIBERNATION +static void system_set_gpios_and_wakeup_inputs_hibernate(void) { int table, i; @@ -534,6 +535,7 @@ void __enter_hibernate(uint32_t seconds, uint32_t microseconds) __hibernate_npcx_series(); } +#endif /* CONFIG_SUPPORT_CHIP_HIBERNATION */ static char system_to_hex(uint8_t x) { @@ -637,7 +639,7 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) if (board_hibernate) board_hibernate(); -#if SUPPORT_HIB +#ifdef CONFIG_SUPPORT_CHIP_HIBERNATION /* Add additional hibernate operations here */ __enter_hibernate(seconds, microseconds); #endif diff --git a/include/config.h b/include/config.h index f091694ec1..a1d197c014 100644 --- a/include/config.h +++ b/include/config.h @@ -1675,6 +1675,12 @@ /* For ECs with multiple wakeup pins, define enabled wakeup pins */ #undef CONFIG_HIBERNATE_WAKEUP_PINS +/* + * If defined, chip hibernation is used. Your board needs to define wake-up + * signals. Undefine this to use board hibernation capability. + */ +#define CONFIG_SUPPORT_CHIP_HIBERNATION + /* * Use PSL (Power Switch Logic) for hibernating. It turns off VCC power rail * for ultra-low power consumption and uses PSL inputs rely on VSBY power rail -- cgit v1.2.1