summaryrefslogtreecommitdiff
path: root/common
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 /common
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>
Diffstat (limited to 'common')
-rw-r--r--common/mkbp_event.c19
1 files changed, 16 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);