summaryrefslogtreecommitdiff
path: root/power/braswell.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-05-05 17:35:46 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-07 17:25:40 +0000
commit3dd6e71828b12b786a7cf84fe1bf9b01a3856eee (patch)
tree74b8355f5a2aea7877721ffe5d393485ddd287e4 /power/braswell.c
parentf8a8f0bbfdf06780759ecf1e315e9a81d41a6387 (diff)
downloadchrome-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/braswell.c')
-rw-r--r--power/braswell.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/power/braswell.c b/power/braswell.c
index 0e2adb1034..aa9301f5d8 100644
--- a/power/braswell.c
+++ b/power/braswell.c
@@ -11,7 +11,6 @@
#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
-#include "host_command.h"
#include "lid_switch.h"
#include "lpc.h"
#include "power.h"
@@ -52,7 +51,6 @@
#define IN_ALL_S0 (IN_PGOOD_S0 | IN_ALL_PM_SLP_DEASSERTED)
static int throttle_cpu; /* Throttle CPU? */
-static int pause_in_s5 = 1; /* Pause in S5 when shutting down? */
void chipset_force_shutdown(void)
{
@@ -108,6 +106,9 @@ void chipset_throttle_cpu(int throttle)
enum power_state power_chipset_init(void)
{
+ /* Pause in S5 when shutting down. */
+ power_set_pause_in_s5(1);
+
/*
* If we're switching between images without rebooting, see if the x86
* is already powered on; if so, leave it there instead of cycling
@@ -292,7 +293,7 @@ enum power_state power_handle_state(enum power_state state)
/*wireless_set_state(WIRELESS_OFF);*/
/* Start shutting down */
- return pause_in_s5 ? POWER_S5 : POWER_S5G3;
+ return power_get_pause_in_s5() ? POWER_S5 : POWER_S5G3;
case POWER_S5G3:
/* Assert RSMRST# */
@@ -302,34 +303,3 @@ enum power_state power_handle_state(enum power_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);