diff options
author | Ting Shen <phoenixshen@google.com> | 2022-07-15 17:34:53 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-18 07:26:37 +0000 |
commit | 524cba08cceb373050cf79c41e4f6f92ff519c5e (patch) | |
tree | 88d226c72fbe9441bd627dd4fcdce3d85e09a532 /common | |
parent | b5f0e68ae441132d8aa1811513a07a27d5ae5709 (diff) | |
download | chrome-ec-524cba08cceb373050cf79c41e4f6f92ff519c5e.tar.gz |
mkbp: don't queue mkbp events in S3
In S3, if a mkbp event is not a wake source, we should not queue it in
the mkbp fifo, otherwise the system will see a bunch of outdated event
after resume.
mkbp_fifo_add() uses the return value from mkbp_send_event() to
decide if it needs to queue the event. So we need to pass the decision
through the path activate_mkbp_with_events() -> mkbp_send_event() ->
mkbp_fifo_add().
BUG=b:238057993
TEST=suspend -> lidclose -> lidopen(=resume)
verify that powerd does not see the lid close event.
BRANCH=cherry
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: I3e1c58f97020d7ee2e3b4b56f14c4cadf51bef64
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3765440
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Mengqi Guo <mqg@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/mkbp_event.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/common/mkbp_event.c b/common/mkbp_event.c index b499789e04..71ce7f8a05 100644 --- a/common/mkbp_event.c +++ b/common/mkbp_event.c @@ -201,7 +201,10 @@ static inline int host_is_sleeping(void) static void force_mkbp_if_events(void); DECLARE_DEFERRED(force_mkbp_if_events); -static void activate_mkbp_with_events(uint32_t events_to_add) +/* + * Send events to AP, return true if succeeded to generate host interrupt. + */ +static bool activate_mkbp_with_events(uint32_t events_to_add) { int interrupt_id = -1; int skip_interrupt = 0; @@ -243,7 +246,7 @@ static void activate_mkbp_with_events(uint32_t events_to_add) /* If we don't need to send an interrupt we are done */ if (interrupt_id < 0) - return; + return false; /* Send a rising edge MKBP interrupt */ rv = mkbp_set_host_active(1, &mkbp_last_event_time); @@ -266,6 +269,8 @@ static void activate_mkbp_with_events(uint32_t events_to_add) if (rv != EC_SUCCESS) CPRINTS("Could not activate MKBP (%d). Deferring", rv); } + + return rv == EC_SUCCESS; } /* @@ -338,9 +343,7 @@ static void force_mkbp_if_events(void) test_mockable int mkbp_send_event(uint8_t event_type) { - activate_mkbp_with_events(BIT(event_type)); - - return 1; + return activate_mkbp_with_events(BIT(event_type)); } static int set_inactive_if_no_events(void) |