mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
Add command for Haswell to pause in s5 at shutdown
At normal AP shutdown, Haswell systems skip S5 entirely and go directly to G3. It's sometimes handy to pause in S5 as the other systems do, for things like power-cycle tests that use the RTC to do a delayed wake from S5. This CL adds a console command and a host command to enable/disable that pause in S5. The default is to skip S5, and the override value is not persistent across EC reboots, so whenever the EC hibernates or reboots (Refresh + Power, software sync), you'll have to re-enable it again. BUG=chrome-os-partner:22346 BRANCH=falco,ToT TEST=manual On Haswell systems only. To enable the pause in S5 at shutdown, do either of these: EC console: gsv s5 1 root shell: ectool pause_in_s5 on Shut the AP down politely, and it should pause in S5 for 10 seconds before continuing to G3. You can see this by watching the EC console. To disable the pause in S5 at shutdown, do any of these: EC console: gsv s5 0 root shell: ectool pause_in_s5 off or press Refresh + POWER Boot the system, then politely shut down. This time it should go directly to G3 without pausing in S5. Change-Id: I324e6e2373bc20b61a731b4ef443d7bb8edb6b83 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168086 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHIPSET_HASWELL
|
||||
#define CONFIG_CHIPSET_X86
|
||||
#define CONFIG_CMD_GSV
|
||||
#define CONFIG_EXTPOWER_FALCO
|
||||
#define CONFIG_EXTPOWER_GPIO
|
||||
#define CONFIG_FAN
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHIPSET_HASWELL
|
||||
#define CONFIG_CHIPSET_X86
|
||||
#define CONFIG_CMD_GSV
|
||||
#define CONFIG_EXTPOWER_GPIO
|
||||
#define CONFIG_FAN
|
||||
#define CONFIG_FAN_EN_GPIO GPIO_PP5000_FAN_EN
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define CONFIG_CHARGER_DISCHARGE_ON_AC
|
||||
#define CONFIG_CHIPSET_HASWELL
|
||||
#define CONFIG_CHIPSET_X86
|
||||
#define CONFIG_CMD_GSV
|
||||
#define CONFIG_EXTPOWER_GPIO
|
||||
#define CONFIG_FAN
|
||||
#define CONFIG_FAN_RPM_MIN 1000
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "chipset_x86_common.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "getset.h"
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "system.h"
|
||||
@@ -315,7 +316,9 @@ enum x86_state x86_handle_state(enum x86_state state)
|
||||
|
||||
/* Disable PP5000 (5V) rail. */
|
||||
gpio_set_level(GPIO_PP5000_EN, 0);
|
||||
return X86_S5G3;
|
||||
|
||||
/* Start shutting down */
|
||||
return gsv[GSV_PARAM_s5] ? X86_S5 : X86_S5G3;
|
||||
|
||||
case X86_S5G3:
|
||||
/* Deassert DPWROK, assert RSMRST# */
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
* List of get/set value items: <name, init_val>
|
||||
*/
|
||||
#define GSV_LIST \
|
||||
GSV_ITEM(s5, 0xdeadbeef) \
|
||||
GSV_ITEM(s5, 0) \
|
||||
/* end */
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "compile_time_macros.h"
|
||||
#include "ec_flash.h"
|
||||
#include "ectool.h"
|
||||
#include "getset.h"
|
||||
#include "lightbar.h"
|
||||
#include "lock/gec_lock.h"
|
||||
#include "misc_util.h"
|
||||
@@ -104,6 +105,8 @@ const char help_str[] =
|
||||
" Various lightbar control commands\n"
|
||||
" panicinfo\n"
|
||||
" Prints saved panic info\n"
|
||||
" pause_in_s5 [on|off]\n"
|
||||
" Whether or not the AP should pause in S5 on shutdown\n"
|
||||
" port80flood\n"
|
||||
" Rapidly write bytes to port 80\n"
|
||||
" powerinfo\n"
|
||||
@@ -179,6 +182,20 @@ int is_battery_range(int val)
|
||||
return (val >= 0 && val <= 65535) ? 1 : 0;
|
||||
}
|
||||
|
||||
int parse_bool(const char *s, int *dest)
|
||||
{
|
||||
if (!strcasecmp(s, "off") || !strncasecmp(s, "dis", 3) ||
|
||||
tolower(*s) == 'f' || tolower(*s) == 'n') {
|
||||
*dest = 0;
|
||||
return 1;
|
||||
} else if (!strcasecmp(s, "on") || !strncasecmp(s, "ena", 3) ||
|
||||
tolower(*s) == 't' || tolower(*s) == 'y') {
|
||||
*dest = 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void print_help(const char *prog)
|
||||
{
|
||||
@@ -300,6 +317,28 @@ int cmd_test(int argc, char *argv[])
|
||||
return rv;
|
||||
}
|
||||
|
||||
int cmd_s5(int argc, char *argv[])
|
||||
{
|
||||
struct ec_cmd_get_set_value s;
|
||||
int rv;
|
||||
|
||||
s.flags = GSV_PARAM_s5;
|
||||
|
||||
if (argc > 1) {
|
||||
s.flags |= EC_GSV_SET;
|
||||
if (!parse_bool(argv[1], &s.value)) {
|
||||
fprintf(stderr, "invalid arg \"%s\"\n", argv[1]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
rv = ec_command(EC_CMD_GET_SET_VALUE, 0,
|
||||
&s, sizeof(s), &s, sizeof(s));
|
||||
if (rv > 0)
|
||||
printf("%s\n", s.value ? "on" : "off");
|
||||
|
||||
return rv < 0;
|
||||
}
|
||||
|
||||
|
||||
int cmd_cmdversions(int argc, char *argv[])
|
||||
@@ -3337,6 +3376,7 @@ const struct command commands[] = {
|
||||
{"keyconfig", cmd_keyconfig},
|
||||
{"keyscan", cmd_keyscan},
|
||||
{"panicinfo", cmd_panic_info},
|
||||
{"pause_in_s5", cmd_s5},
|
||||
{"powerinfo", cmd_power_info},
|
||||
{"protoinfo", cmd_proto_info},
|
||||
{"pstoreinfo", cmd_pstore_info},
|
||||
|
||||
Reference in New Issue
Block a user