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