summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2019-07-02 11:03:07 -0700
committerCommit Bot <commit-bot@chromium.org>2019-07-17 23:58:21 +0000
commit3cc417a240ce917e0e5f55aadcd5a4cbccc8f47c (patch)
treee52abe90911570274028c8cf484f50e8a856289d
parentf8d6179a26bf512c43638d0916fde0fc966cc3fb (diff)
downloadchrome-ec-3cc417a240ce917e0e5f55aadcd5a4cbccc8f47c.tar.gz
mkbp_event: Add CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT.
MKBP was recently refactored to offer choice in the MKBP notification method. However, if a board is using a GPIO to notify the AP of a MKBP event, and the AP cannot wake from the GPIO, the MKBP event cannot wake the system up from suspend as is. This commit simply adds a new config option, CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT such that MKBP events can wake the system from suspend. Note that the board will have to add MKBP events to the host event sleep mask in coreboot. Typically on ARM devices, EC_INT_L is already a wake pin, but on Intel devices it is not; there's actually a different pin, PCH_WAKE_L which is set via sending a host event and wakes the system. BUG=b:136272898,chromium:786721 BRANCH=None TEST=Enable config option on nocturne, flash nocturne, suspend DUT, verify that MKBP events can wake the AP. Change-Id: If5026bfe3efacbc051f99a180e061c6fd679ce5a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1685786 Reviewed-by: Jett Rink <jettrink@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/mkbp_event.c19
-rw-r--r--include/config.h15
2 files changed, 31 insertions, 3 deletions
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index 7da6b6044b..8e05a17f17 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -68,7 +68,8 @@ struct mkbp_state {
static struct mkbp_state state;
uint32_t mkbp_last_event_time;
-#ifdef CONFIG_MKBP_USE_GPIO
+#if defined(CONFIG_MKBP_USE_GPIO) || \
+ defined(CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT)
static int mkbp_set_host_active_via_gpio(int active, uint32_t *timestamp)
{
/*
@@ -87,9 +88,20 @@ static int mkbp_set_host_active_via_gpio(int active, uint32_t *timestamp)
if (timestamp)
interrupt_enable();
+#ifdef CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT
+ /*
+ * In case EC_INT_L is not a wake pin, make sure that we also attempt to
+ * wake the AP via a host event. If MKBP events are masked thru the
+ * host event interface in S0, no ill effects should occur as the
+ * notification will only be received via the GPIO.
+ */
+ if (active)
+ host_set_single_event(EC_HOST_EVENT_MKBP);
+#endif /* CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT */
+
return EC_SUCCESS;
}
-#endif
+#endif /* CONFIG_MKBP_USE_GPIO(_AND_HOST_EVENT)? */
#ifdef CONFIG_MKBP_USE_HOST_EVENT
static int mkbp_set_host_active_via_event(int active, uint32_t *timestamp)
@@ -129,7 +141,8 @@ static int mkbp_set_host_active(int active, uint32_t *timestamp)
return mkbp_set_host_active_via_custom(active, timestamp);
#elif defined(CONFIG_MKBP_USE_HOST_EVENT)
return mkbp_set_host_active_via_event(active, timestamp);
-#elif defined(CONFIG_MKBP_USE_GPIO)
+#elif defined(CONFIG_MKBP_USE_GPIO) ||\
+ defined(CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT)
return mkbp_set_host_active_via_gpio(active, timestamp);
#elif defined(CONFIG_MKBP_USE_HECI)
return mkbp_set_host_active_via_heci(active, timestamp);
diff --git a/include/config.h b/include/config.h
index 3eb6d671d6..a798f0eac1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2674,6 +2674,20 @@
/* MKBP events are sent by using GPIO */
#undef CONFIG_MKBP_USE_GPIO
+/*
+ * MKBP events are notified by using both a GPIO and a host event.
+ *
+ * You should use this if you are using a GPIO to notify the AP of an MKBP
+ * event, and you need an MKBP event to wake the AP in suspend and the AP cannot
+ * wake from the GPIO. Since you are using both a GPIO and a hostevent for the
+ * notification, make sure that the S0 hostevent mask does NOT include MKBP
+ * events. Otherwise, you will have multiple consumers for a single event.
+ * However, make sure to configure the host event *sleep* mask in coreboot to
+ * include MKBP events. In order to prevent all MKBP events from waking the AP,
+ * use CONFIG_MKBP_EVENT_WAKEUP_MASK to filter the events.
+ */
+#undef CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT
+
/* MKBP events are sent by using HECI on an ISH */
#undef CONFIG_MKBP_USE_HECI
@@ -4380,6 +4394,7 @@
#if !defined(CONFIG_MKBP_USE_CUSTOM) && \
!defined(CONFIG_MKBP_USE_HOST_EVENT) && \
!defined(CONFIG_MKBP_USE_GPIO) && \
+ !defined(CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT) && \
!defined(CONFIG_MKBP_USE_HECI)
#error Please define one of CONFIG_MKBP_USE_* macro.
#endif