diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2013-10-21 08:43:18 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-21 20:05:44 +0000 |
commit | 6b4e6e66e7e575cb09dc03c44c00e184722f253c (patch) | |
tree | 2e451a107569fdf58ac0287099465fde9f668a2f | |
parent | 35916b4bc19743e6fcc0930094be4bba56c790fd (diff) | |
download | chrome-ec-6b4e6e66e7e575cb09dc03c44c00e184722f253c.tar.gz |
samus: Add the pause_in_s5 support and fix CPU throttle
These are changes ported from other haswell systems that are
useful in development. Pause in S5 can be used for power cycle
testing and the CPU throttle is important for runin since there
is no other active throttle methods.
BUG=chrome-os-partner:23449
BRANCH=samus
TEST=emerge-samus chromeos-ec
Change-Id: I8774a466141f2cdc671a5e14705ae29433f94981
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173838
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/samus/power_sequence.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c index 97c718a3d3..f40c8e0e9f 100644 --- a/board/samus/power_sequence.c +++ b/board/samus/power_sequence.c @@ -11,6 +11,7 @@ #include "console.h" #include "gpio.h" #include "hooks.h" +#include "host_command.h" #include "lid_switch.h" #include "registers.h" #include "system.h" @@ -58,6 +59,7 @@ IN_ALL_PM_SLP_DEASSERTED) static int throttle_cpu; /* Throttle CPU? */ +static int pause_in_s5; /* Pause in S5 when shutting down? */ void chipset_force_shutdown(void) { @@ -109,7 +111,8 @@ void chipset_reset(int cold_reset) void chipset_throttle_cpu(int throttle) { - /* FIXME CPRINTF("[%T %s(%d)]\n", __func__, throttle);*/ + if (chipset_in_state(CHIPSET_STATE_ON)) + gpio_set_level(GPIO_CPU_PROCHOT, throttle); } enum x86_state x86_chipset_init(void) @@ -344,7 +347,7 @@ enum x86_state x86_handle_state(enum x86_state state) gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 0); gpio_set_level(GPIO_LIGHTBAR_RESET_L, 0); - return X86_S5; + return pause_in_s5 ? X86_S5 : X86_S5G3; case X86_S5G3: /* Deassert DPWROK */ @@ -359,3 +362,34 @@ enum x86_state x86_handle_state(enum x86_state state) return state; } + +static int host_command_gsv(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_gsv, + EC_VER_MASK(0)); + +static int console_command_gsv(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, console_command_gsv, + "[on|off]", + "Should the AP pause in S5 during shutdown?", + NULL); |