diff options
author | Aseda Aboagye <aaboagye@google.com> | 2019-07-02 10:38:56 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-19 17:44:11 +0000 |
commit | 785f4c11ed0387735cbe6e48516fbc7d4d1ce8ad (patch) | |
tree | 93cf74f31120424896dca0a458c56fe657ad7ea5 | |
parent | 39d10c7e537e7b1c2ece072c5ee89e76a73f3ce2 (diff) | |
download | chrome-ec-785f4c11ed0387735cbe6e48516fbc7d4d1ce8ad.tar.gz |
cleanup: Rename CONFIG_MKBP_WAKEUP_MASK for clarity.
CONFIG_MKBP_WAKEUP_MASK is a bit confusing and is wrongly named. The
comment stated that "With this option, we can define the MKBP wakeup
events in this mask (as a white list) in board level, those evets allow
to interrupt AP during S3.". However, these events are NOT MKBP events
at all but are instead host events. This commit tries to clear things
up by renaming CONFIG_MKBP_WAKEUP_MASK to
CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK to better show that these events are
in fact host events.
BUG=b:136282898
BRANCH=None
TEST=`make -j buildall`
Change-Id: I42beadec8217435fd30e679ccf52d784a8ef99a0
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1685784
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715982
Reviewed-by: Duncan Laurie <dlaurie@google.com>
-rw-r--r-- | board/elm/board.h | 4 | ||||
-rw-r--r-- | board/oak/board.h | 4 | ||||
-rw-r--r-- | common/mkbp_event.c | 38 | ||||
-rw-r--r-- | include/config.h | 6 |
4 files changed, 31 insertions, 21 deletions
diff --git a/board/elm/board.h b/board/elm/board.h index ea2452c34a..a18c0538e6 100644 --- a/board/elm/board.h +++ b/board/elm/board.h @@ -175,8 +175,8 @@ #define TIM_CLOCK32 2 #define TIM_WATCHDOG 4 -/* Define the MKBP events which are allowed to wakeup AP in S3. */ -#define CONFIG_MKBP_WAKEUP_MASK \ +/* Define the host events which are allowed to wakeup AP in S3. */ +#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\ diff --git a/board/oak/board.h b/board/oak/board.h index 6567b6dea5..e42f7d8753 100644 --- a/board/oak/board.h +++ b/board/oak/board.h @@ -168,8 +168,8 @@ #define TIM_CLOCK32 2 #define TIM_WATCHDOG 4 -/* Define the MKBP events which are allowed to wakeup AP in S3. */ -#define CONFIG_MKBP_WAKEUP_MASK \ +/* Define the host events which are allowed to wakeup AP in S3. */ +#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\ diff --git a/common/mkbp_event.c b/common/mkbp_event.c index 6848bd2813..173745dd98 100644 --- a/common/mkbp_event.c +++ b/common/mkbp_event.c @@ -45,6 +45,7 @@ static void set_host_interrupt(int active) #endif } +#ifdef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK /** * Check if the host is sleeping. Check our power state in addition to the * self-reported sleep state of host (CONFIG_POWER_TRACK_HOST_SLEEP_STATE). @@ -59,20 +60,27 @@ static inline int host_is_sleeping(void) #endif return is_sleeping; } +#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */ int mkbp_send_event(uint8_t event_type) { + int skip_interrupt = 0; + set_event(event_type); -#ifdef CONFIG_MKBP_WAKEUP_MASK - /* Only assert interrupt for wake events if host is sleeping */ - if (host_is_sleeping()) { - /* Skip host wake if this isn't a wake event */ - if (!(host_get_events() & CONFIG_MKBP_WAKEUP_MASK) && - event_type != EC_MKBP_EVENT_KEY_MATRIX) - return 0; - } -#endif +#ifdef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK + /* Check to see if this host event should wake the system. */ + skip_interrupt = host_is_sleeping() && + !(host_get_events() & + CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK); +#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */ + + /* To skip the interrupt, we cannot have the EC_MKBP_EVENT_KEY_MATRIX */ + skip_interrupt = skip_interrupt && + (event_type != EC_MKBP_EVENT_KEY_MATRIX); + + if (skip_interrupt) + return 0; set_host_interrupt(1); return 1; @@ -143,17 +151,19 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_NEXT_EVENT, mkbp_get_next_event, EC_VER_MASK(0)); -#ifdef CONFIG_MKBP_WAKEUP_MASK -static int mkbp_get_wake_mask(struct host_cmd_handler_args *args) +#ifdef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK +#ifdef CONFIG_MKBP_USE_HOST_EVENT +static int mkbp_get_host_event_wake_mask(struct host_cmd_handler_args *args) { struct ec_response_host_event_mask *r = args->response; - r->mask = CONFIG_MKBP_WAKEUP_MASK; + r->mask = CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK; args->response_size = sizeof(*r); return EC_RES_SUCCESS; } DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_WAKE_MASK, - mkbp_get_wake_mask, + mkbp_get_host_event_wake_mask, EC_VER_MASK(0)); -#endif +#endif /* CONFIG_MKBP_USE_HOST_EVENT */ +#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */ diff --git a/include/config.h b/include/config.h index 72f5adb951..558770865c 100644 --- a/include/config.h +++ b/include/config.h @@ -1755,10 +1755,10 @@ #undef CONFIG_MKBP_USE_HOST_EVENT /* - * With this option, we can define the MKBP wakeup events in this mask (as a - * white list) in board level, those events allow to interrupt AP during S3. + * If using MKBP to send host events, with this option, we can define the host + * events that should wake the system in suspend. */ -#undef CONFIG_MKBP_WAKEUP_MASK +#undef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK /* Support memory protection unit (MPU) */ #undef CONFIG_MPU |