diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-07-23 13:56:46 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-05 23:50:59 +0000 |
commit | 82e39fbcb5cdfd368d87ee1fce7b495e727409b3 (patch) | |
tree | 61e09cd2fa64ad3cfb6bede28222b38fe3e3604d /power/intel_x86.c | |
parent | 7ac9332b6b07fab2e09a8c4b6cf82a49ad9abcb9 (diff) | |
download | chrome-ec-82e39fbcb5cdfd368d87ee1fce7b495e727409b3.tar.gz |
power/intel_x86: Decouple LPC logic from sleep detection
Move the LPC handling logic out of the sleep failure detection
functions. For example, move the lpc_s0ix_suspend_clear_masks()
to the first SUSPEND hook, move power_update_wake_mask() out of
sleep_complete_resume().
BRANCH=None
BUG=b:162083524
TEST=Build the hatch board.
Change-Id: I16c4ed88e7cf40aabb9ce2d9ec95f7994dfe7efc
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321873
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'power/intel_x86.c')
-rw-r--r-- | power/intel_x86.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/power/intel_x86.c b/power/intel_x86.c index 6d969168cf..1433fc44ab 100644 --- a/power/intel_x86.c +++ b/power/intel_x86.c @@ -194,14 +194,18 @@ static void sleep_notify_transition(int check_state, int hook_id) if (sleep_notify != check_state) return; - /* Clear masks before any hooks are run for suspend. */ - if (sleep_notify == SLEEP_NOTIFY_SUSPEND) - lpc_s0ix_suspend_clear_masks(); - hook_notify(hook_id); sleep_notify = SLEEP_NOTIFY_NONE; } +static void handle_chipset_suspend(void) +{ + /* Clear masks before any hooks are run for suspend. */ + lpc_s0ix_suspend_clear_masks(); + +} +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, handle_chipset_suspend, HOOK_PRIO_FIRST); + static void handle_chipset_reset(void) { if (chipset_in_state(CHIPSET_STATE_STANDBY)) { @@ -297,14 +301,6 @@ static void sleep_complete_resume(struct host_sleep_event_context *ctx) { hook_call_deferred(&sleep_transition_timeout_data, -1); ctx->sleep_transitions = sleep_signal_transitions; - - /* - * If the sleep signal timed out and never transitioned, then the - * wake mask was modified to its suspend state (S0ix), so that the - * event wakes the system. Explicitly restore the wake mask to its - * S0 state now. - */ - power_update_wake_mask(); } static void sleep_reset_tracking(void) @@ -692,7 +688,13 @@ __override void power_chipset_handle_host_sleep_event( lpc_s0ix_resume_restore_masks(); power_signal_disable_interrupt(sleep_sig[SYS_SLEEP_S0IX]); sleep_complete_resume(ctx); - + /* + * If the sleep signal timed out and never transitioned, then + * the wake mask was modified to its suspend state (S0ix), so + * that the event wakes the system. Explicitly restore the wake + * mask to its S0 state now. + */ + power_update_wake_mask(); } else if (state == HOST_SLEEP_EVENT_DEFAULT_RESET) { power_signal_disable_interrupt(sleep_sig[SYS_SLEEP_S0IX]); } |