diff options
author | Furquan Shaikh <furquan@chromium.org> | 2017-09-21 11:12:16 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-22 10:18:48 -0700 |
commit | f1375bec42b6862746ed026d5c3f6a5f97d3e7ac (patch) | |
tree | 30c9edeb24c49f5ac4da61d0ecdcc87ef6c63f25 | |
parent | 6f07b9212c72bc467d3c284ca2c8cebf51dd0a98 (diff) | |
download | chrome-ec-f1375bec42b6862746ed026d5c3f6a5f97d3e7ac.tar.gz |
power: Provide chipset and board callbacks on host sleep event command
This change allows chipset and board to perform any action when host
indicates intention to enter sleep state. Chipset can take action like
enable/disable power signal interrupts and boards can enable/disable
decay of VRs on host intent to enter/exit S0ix.
BUG=b:65732924
BRANCH=None
TEST=make -j buildall
Change-Id: I6298825d4ee96a07b93523c2f366527ae2be8a27
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/677498
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | include/power.h | 16 | ||||
-rw-r--r-- | power/common.c | 8 | ||||
-rw-r--r-- | power/intel_x86.c | 15 |
3 files changed, 39 insertions, 0 deletions
diff --git a/include/power.h b/include/power.h index 9c9e912c6d..cdfcbcd173 100644 --- a/include/power.h +++ b/include/power.h @@ -143,6 +143,22 @@ void power_set_pause_in_s5(int pause); */ enum host_sleep_event power_get_host_sleep_state(void); +/** + * Provide callback to allow chipset to take any action on host sleep event + * command. + * + * @param state Current host sleep state updated by the host. + */ +void power_chipset_handle_host_sleep_event(enum host_sleep_event state); + +/** + * Provide callback to allow board to take any action on host sleep event + * command. + * + * @param state Current host sleep state updated by the host. + */ +void power_board_handle_host_sleep_event(enum host_sleep_event state); + #ifdef CONFIG_POWER_S0IX /** * Reset the sleep state reported by the host. diff --git a/power/common.c b/power/common.c index 381b1e0099..4669d23d8a 100644 --- a/power/common.c +++ b/power/common.c @@ -729,12 +729,20 @@ DECLARE_CONSOLE_COMMAND(pause_in_s5, command_pause_in_s5, /* Track last reported sleep event */ static enum host_sleep_event host_sleep_state; +void __attribute__((weak)) +power_chipset_handle_host_sleep_event(enum host_sleep_event state) +{ + /* Default weak implementation -- no action required. */ +} + static int host_command_host_sleep_event(struct host_cmd_handler_args *args) { const struct ec_params_host_sleep_event *p = args->params; host_sleep_state = p->sleep_event; + power_chipset_handle_host_sleep_event(host_sleep_state); + return EC_RES_SUCCESS; } DECLARE_HOST_COMMAND(EC_CMD_HOST_SLEEP_EVENT, diff --git a/power/intel_x86.c b/power/intel_x86.c index 8e285559d4..ea0a8dc6c6 100644 --- a/power/intel_x86.c +++ b/power/intel_x86.c @@ -454,3 +454,18 @@ void common_intel_x86_handle_rsmrst(enum power_state state) CPRINTS("Pass through GPIO_RSMRST_L_PGOOD: %d", rsmrst_in); } + +#ifdef CONFIG_POWER_TRACK_HOST_SLEEP_STATE + +void __attribute__((weak)) +power_board_handle_host_sleep_event(enum host_sleep_event state) +{ + /* Default weak implementation -- no action required. */ +} + +void power_chipset_handle_host_sleep_event(enum host_sleep_event state) +{ + power_board_handle_host_sleep_event(state); +} + +#endif |