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>
This commit is contained in:
Furquan Shaikh
2017-09-21 11:12:16 -07:00
committed by chrome-bot
parent 6f07b9212c
commit f1375bec42
3 changed files with 39 additions and 0 deletions

View File

@@ -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.

View File

@@ -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,

View File

@@ -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