summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/elm/board.h4
-rw-r--r--board/flapjack/board.h4
-rw-r--r--board/kukui/board.h4
-rw-r--r--board/oak/board.h4
-rw-r--r--board/rainier/board.h4
-rw-r--r--board/scarlet/board.h4
-rw-r--r--common/mkbp_event.c25
-rw-r--r--include/config.h6
8 files changed, 29 insertions, 26 deletions
diff --git a/board/elm/board.h b/board/elm/board.h
index 0de9730454..ffd54aacc6 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -172,8 +172,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/flapjack/board.h b/board/flapjack/board.h
index 57e398694c..693a1bb8a9 100644
--- a/board/flapjack/board.h
+++ b/board/flapjack/board.h
@@ -236,8 +236,8 @@
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-/* 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_POWER_BUTTON) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
diff --git a/board/kukui/board.h b/board/kukui/board.h
index 39e1260324..5680e1b2ec 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -228,8 +228,8 @@
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-/* 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))
diff --git a/board/oak/board.h b/board/oak/board.h
index e4ae567b29..b8ebe7c8e6 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -166,8 +166,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/rainier/board.h b/board/rainier/board.h
index 4903de557d..3827f97ea6 100644
--- a/board/rainier/board.h
+++ b/board/rainier/board.h
@@ -131,8 +131,8 @@
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-/* 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_POWER_BUTTON) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index c13b45029c..5cd82e573c 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -182,8 +182,8 @@
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-/* 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_POWER_BUTTON) |\
EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index ee0fca71de..0f59bb15f8 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -136,7 +136,7 @@ static int mkbp_set_host_active(int active, uint32_t *timestamp)
#endif
}
-#ifdef CONFIG_MKBP_WAKEUP_MASK
+#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).
@@ -153,7 +153,7 @@ static inline int host_is_sleeping(void)
#endif
return is_sleeping;
}
-#endif /* CONFIG_MKBP_WAKEUP_MASK */
+#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */
/*
* This is the deferred function that ensures that we attempt to set the MKBP
@@ -169,11 +169,12 @@ static void activate_mkbp_with_events(uint32_t events_to_add)
int skip_interrupt = 0;
int rv, schedule_deferred = 0;
-#ifdef CONFIG_MKBP_WAKEUP_MASK
- /* Only assert interrupt for wake events if host is sleeping */
+#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_WAKEUP_MASK);
-#endif
+ !(host_get_events() &
+ CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK);
+#endif /* CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK */
mutex_lock(&state.lock);
state.events |= events_to_add;
@@ -346,17 +347,19 @@ DECLARE_HOST_COMMAND(EC_CMD_GET_NEXT_EVENT,
mkbp_get_next_event,
EC_VER_MASK(0) | EC_VER_MASK(1) | EC_VER_MASK(2));
-#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 daacb22e1f..45e686ea8f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2680,10 +2680,10 @@
#undef CONFIG_MKBP_USE_CUSTOM
/*
- * 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