From eac58f946ba9729a2009ae3028528f55a5cc389e Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Thu, 28 Aug 2014 14:06:33 -0700 Subject: ryu: disable system hibernate Hibernate is not supported on STM32F0. Disable system hibernate so that the system doesn't auto-reboot after an hour in G3. This also benefits us in terms of firmware size. BUG=chrome-os-partner:31665 TEST=Boot on Ryu. Check 'hibdelay' and 'hibernate' commands are absent. TEST=Boot Ryu from G3. TEST=Change default hibernation delay to 1 second. Put system in G3. Check it does not reboot. BRANCH=None Change-Id: Ia01d2d74bc5c22c01e29e5877bd4bd38ee7dddc8 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/214834 Reviewed-by: Vincent Palatin (cherry picked from commit 1b358e2c934c119f96bd435a3f4f12a272142400) Reviewed-on: https://chromium-review.googlesource.com/216255 Reviewed-by: Todd Broch --- board/ryu/board.h | 1 + common/system.c | 4 ++++ include/config.h | 5 +++++ power/common.c | 8 ++++++++ 4 files changed, 18 insertions(+) diff --git a/board/ryu/board.h b/board/ryu/board.h index 7d3b9f5fc3..a00a1b6897 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -35,6 +35,7 @@ #undef CONFIG_TASK_PROFILING #undef CONFIG_CONSOLE_CMDHELP #define CONFIG_INDUCTIVE_CHARGING +#undef CONFIG_HIBERNATE /* * Pericom I2C workaround diff --git a/common/system.c b/common/system.c index 0782d79289..ee6d7ce97e 100644 --- a/common/system.c +++ b/common/system.c @@ -624,11 +624,13 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) case EC_REBOOT_DISABLE_JUMP: system_disable_jump(); return EC_SUCCESS; +#ifdef CONFIG_HIBERNATE case EC_REBOOT_HIBERNATE: CPRINTS("system hibernating"); system_hibernate(0, 0); /* That shouldn't return... */ return EC_ERROR_UNKNOWN; +#endif default: return EC_ERROR_INVAL; } @@ -697,6 +699,7 @@ DECLARE_CONSOLE_COMMAND(scratchpad, command_scratchpad, NULL); #endif /* CONFIG_CMD_SCRATCHPAD */ +#ifdef CONFIG_HIBERNATE static int command_hibernate(int argc, char **argv) { int seconds = 0; @@ -720,6 +723,7 @@ DECLARE_CONSOLE_COMMAND(hibernate, command_hibernate, "[sec] [usec]", "Hibernate the EC", NULL); +#endif /* CONFIG_HIBERNATE */ static int command_version(int argc, char **argv) { diff --git a/include/config.h b/include/config.h index 609d0943b2..3ad5128aa0 100644 --- a/include/config.h +++ b/include/config.h @@ -559,6 +559,11 @@ /* Enable the software routine for CRC computation */ #undef CONFIG_SW_CRC +/*****************************************************************************/ + +/* Enable system hibernate */ +#define CONFIG_HIBERNATE + /*****************************************************************************/ /* I2C configuration */ diff --git a/power/common.c b/power/common.c index 7489f1939f..d4063d8db3 100644 --- a/power/common.c +++ b/power/common.c @@ -52,8 +52,10 @@ static enum power_state state = POWER_G3; /* Current state */ static int want_g3_exit; /* Should we exit the G3 state? */ static uint64_t last_shutdown_time; /* When did we enter G3? */ +#ifdef CONFIG_HIBERNATE /* Delay before hibernating, in seconds */ static uint32_t hibernate_delay = 3600; +#endif /** * Update input signals mask @@ -140,6 +142,7 @@ static enum power_state power_common_state(enum power_state state) } in_want = 0; +#ifdef CONFIG_HIBERNATE if (extpower_is_present()) task_wait_event(-1); else { @@ -162,6 +165,9 @@ static enum power_state power_common_state(enum power_state state) task_wait_event(wait); } } +#else /* !CONFIG_HIBERNATE */ + task_wait_event(-1); +#endif break; case POWER_S5: @@ -461,6 +467,7 @@ DECLARE_CONSOLE_COMMAND(powerindebug, command_powerindebug, "Get/set power input debug mask", NULL); +#ifdef CONFIG_HIBERNATE static int command_hibernation_delay(int argc, char **argv) { char *e; @@ -487,3 +494,4 @@ DECLARE_CONSOLE_COMMAND(hibdelay, command_hibernation_delay, "[sec]", "Set the delay before going into hibernation", NULL); +#endif /* CONFIG_HIBERNATE */ -- cgit v1.2.1