diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-05-05 17:35:46 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-07 17:25:40 +0000 |
commit | 3dd6e71828b12b786a7cf84fe1bf9b01a3856eee (patch) | |
tree | 74b8355f5a2aea7877721ffe5d393485ddd287e4 /power/common.c | |
parent | f8a8f0bbfdf06780759ecf1e315e9a81d41a6387 (diff) | |
download | chrome-ec-3dd6e71828b12b786a7cf84fe1bf9b01a3856eee.tar.gz |
power: Move EC_CMD_GSV_PAUSE_IN_S5 handler to common code
The same code exists in four (soon to be five!) different power
sequencing drivers, so move it up to common.
BUG=None
TEST=Manual on Samus. Run "pause_in_s5 on" on EC console, verify that
system stops in S5 on shutdown. Run "pause_in_s5 off" on EC console,
verify that system again goes to G3 on shutdown.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Iaf05ef7ce017be4f9d173e83e985a7a879ba278c
Reviewed-on: https://chromium-review.googlesource.com/269566
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'power/common.c')
-rw-r--r-- | power/common.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/power/common.c b/power/common.c index b1bced365d..f59fe45273 100644 --- a/power/common.c +++ b/power/common.c @@ -12,6 +12,7 @@ #include "extpower.h" #include "gpio.h" #include "hooks.h" +#include "host_command.h" #include "power.h" #include "system.h" #include "task.h" @@ -58,6 +59,11 @@ static uint64_t last_shutdown_time; /* When did we enter G3? */ static uint32_t hibernate_delay = CONFIG_HIBERNATE_DELAY_SEC; #endif +#ifdef CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 +/* Pause in S5 on shutdown? */ +static int pause_in_s5; +#endif + /** * Update input signals mask */ @@ -410,7 +416,6 @@ static void siglog_add(enum gpio_signal signal) #define SIGLOG(S) #endif /* CONFIG_BRINGUP */ - void power_signal_interrupt(enum gpio_signal signal) { SIGLOG(signal); @@ -422,6 +427,18 @@ void power_signal_interrupt(enum gpio_signal signal) task_wake(TASK_ID_CHIPSET); } +#ifdef CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 +inline int power_get_pause_in_s5(void) +{ + return pause_in_s5; +} + +inline void power_set_pause_in_s5(int pause) +{ + pause_in_s5 = pause; +} +#endif + /*****************************************************************************/ /* Console commands */ @@ -506,3 +523,36 @@ DECLARE_CONSOLE_COMMAND(hibdelay, command_hibernation_delay, "Set the delay before going into hibernation", NULL); #endif /* CONFIG_HIBERNATE */ + +#ifdef CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 +static int host_command_pause_in_s5(struct host_cmd_handler_args *args) +{ + const struct ec_params_get_set_value *p = args->params; + struct ec_response_get_set_value *r = args->response; + + if (p->flags & EC_GSV_SET) + pause_in_s5 = p->value; + + r->value = pause_in_s5; + + args->response_size = sizeof(*r); + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_GSV_PAUSE_IN_S5, + host_command_pause_in_s5, + EC_VER_MASK(0)); + +static int command_pause_in_s5(int argc, char **argv) +{ + if (argc > 1 && !parse_bool(argv[1], &pause_in_s5)) + return EC_ERROR_INVAL; + + ccprintf("pause_in_s5 = %s\n", pause_in_s5 ? "on" : "off"); + + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(pause_in_s5, command_pause_in_s5, + "[on|off]", + "Should the AP pause in S5 during shutdown?", + NULL); +#endif /* CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 */ |