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>
diff --git a/board/elm/board.h b/board/elm/board.h
index 0de9730..ffd54aa 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 57e3986..693a1bb 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 39e1260..5680e1b 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 e4ae567..b8ebe7c 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 4903de5..3827f97 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 c13b450..5cd82e5 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 ee0fca7..0f59bb1 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -136,7 +136,7 @@
 #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 @@
 #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 @@
 	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 @@
 		     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 daacb22..45e686e 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