diff options
-rw-r--r-- | common/mkbp_event.c | 15 | ||||
-rw-r--r-- | include/config.h | 19 |
2 files changed, 30 insertions, 4 deletions
diff --git a/common/mkbp_event.c b/common/mkbp_event.c index 0f59bb15f8..7da6b6044b 100644 --- a/common/mkbp_event.c +++ b/common/mkbp_event.c @@ -136,7 +136,8 @@ static int mkbp_set_host_active(int active, uint32_t *timestamp) #endif } -#ifdef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK +#if defined(CONFIG_MKBP_EVENT_WAKEUP_MASK) || \ + defined(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). @@ -148,12 +149,13 @@ static inline int host_is_sleeping(void) #ifdef CONFIG_POWER_TRACK_HOST_SLEEP_STATE enum host_sleep_event sleep_state = power_get_host_sleep_state(); is_sleeping |= - (sleep_state == HOST_SLEEP_EVENT_S3_SUSPEND || + (sleep_state == HOST_SLEEP_EVENT_S0IX_SUSPEND || + sleep_state == HOST_SLEEP_EVENT_S3_SUSPEND || sleep_state == HOST_SLEEP_EVENT_S3_WAKEABLE_SUSPEND); #endif return is_sleeping; } -#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */ +#endif /* CONFIG_MKBP_(HOST_EVENT_)?WAKEUP_MASK */ /* * This is the deferred function that ensures that we attempt to set the MKBP @@ -176,6 +178,13 @@ static void activate_mkbp_with_events(uint32_t events_to_add) CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK); #endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */ +#ifdef CONFIG_MKBP_EVENT_WAKEUP_MASK + /* Check to see if this MKBP event should wake the system. */ + if (!skip_interrupt) + skip_interrupt = host_is_sleeping() && + !(events_to_add & CONFIG_MKBP_EVENT_WAKEUP_MASK); +#endif /* CONFIG_MKBP_EVENT_WAKEUP_MASK */ + mutex_lock(&state.lock); state.events |= events_to_add; diff --git a/include/config.h b/include/config.h index 4f349a5050..546833b26f 100644 --- a/include/config.h +++ b/include/config.h @@ -2682,10 +2682,27 @@ /* * If using MKBP to send host events, with this option, we can define the host - * events that should wake the system in suspend. + * events that should wake the system in suspend. Some examples are: + * + * EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) + * EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) + * + * The only things that should be in this mask are: + * EC_HOST_EVENT_MASK(EC_HOST_EVENT_*) */ #undef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK +/* + * Define which MKBP events should wakeup the system in suspend. Some examples + * are: + * + * EC_MKBP_EVENT_KEY_MATRIX + * EC_MKBP_EVENT_SWITCH + * + * The only things that should be in this mask are EC_MKBP_EVENT_*. + */ +#undef CONFIG_MKBP_EVENT_WAKEUP_MASK + /* Support memory protection unit (MPU) */ #undef CONFIG_MPU |