summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2019-07-02 10:53:17 -0700
committerCommit Bot <commit-bot@chromium.org>2019-07-17 01:53:49 +0000
commit360e4f98701a0309c35891f3dbea26739127e8f4 (patch)
treeb1d314939daa3427b90659d734f429e5f98f5c23
parent60d6db8fbf5bae84b94b6dac8ea8c70a08e30555 (diff)
downloadchrome-ec-360e4f98701a0309c35891f3dbea26739127e8f4.tar.gz
config: Add CONFIG_MKBP_EVENT_WAKEUP_MASK
This commit adds a new CONFIG_* option, CONFIG_MKBP_EVENT_WAKEUP_MASK. This allows a board to specify which MKBP events are allowed to wake the system when it is in suspend. BUG=b:136282898,chromium:786721 BRANCH=None TEST=With some other code, flash nocturne, suspend DUT, verify that only the MKBP events in the CONFIG_MKBP_EVENT_WAKEUP_MASK wake the system up. Change-Id: Ib4d04418aacab209d0e26703500df119924090b7 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1685785 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/mkbp_event.c15
-rw-r--r--include/config.h19
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