summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Granata <egranata@chromium.org>2018-10-03 10:44:48 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-12 23:07:16 -0700
commitc5661a8a8b3172a185dae2d649e9575ea9b72ce8 (patch)
tree4e8901e1326699a7be9a48becb292cd3d2c600a7
parentb6be8311960db02ca0c86c9471bc6e45b9cbcb90 (diff)
downloadchrome-ec-c5661a8a8b3172a185dae2d649e9575ea9b72ce8.tar.gz
nocturne: enable GPIO-based MKBP event notification
This commit configures nocturne to send MKBP events over GPIO for boards with ID >= 2, as well as over the existing host event path. This latter notification is sent for legacy compatibility purposes, largely with existing depthcharge behavior. BUG=b:112366846, b:112112483, b:112111610 TEST=physical buttons work in depthcharge + MKBP events come in on Nocturne via GPIO interrupt with no significant jitter change BRANCH=none Change-Id: I95668ab1140f1c1e6397fae42f5dc6103b404956 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1247343 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
-rw-r--r--board/nocturne/board.c22
-rw-r--r--board/nocturne/board.h1
-rw-r--r--board/nocturne/gpio.inc2
3 files changed, 23 insertions, 2 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 5d3f494127..87b8f6c67f 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -26,6 +26,8 @@
#include "hooks.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "lpc.h"
+#include "mkbp_event.h"
#include "motion_sense.h"
#include "power.h"
#include "power_button.h"
@@ -390,6 +392,26 @@ void board_hibernate(void)
;
}
+static int mkbp_uses_gpio(void)
+{
+ return board_get_version() >= 2;
+}
+
+void mkbp_set_host_active(int active)
+{
+ if (mkbp_uses_gpio())
+ mkbp_set_host_active_via_gpio(active);
+
+ /*
+ * Always send the host event for compatibility.
+ * On board versions 2 and newer, the firmware is configured
+ * to not actually trigger an SCI on MKBP events. This means that
+ * the EC can send host event notifications without concern for the
+ * board version and expect the right thing to happen.
+ */
+ mkbp_set_host_active_via_event(active);
+}
+
static void board_init(void)
{
/* Enable USB Type-C interrupts. */
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index 8ecfe4f0c6..63c409678b 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -85,7 +85,6 @@
/* MKBP */
#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_USE_HOST_EVENT
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
/* Sensors */
diff --git a/board/nocturne/gpio.inc b/board/nocturne/gpio.inc
index 985ad56e92..d9e10de5a6 100644
--- a/board/nocturne/gpio.inc
+++ b/board/nocturne/gpio.inc
@@ -61,7 +61,7 @@ GPIO(EC_BRD_ID0, PIN(4, 0), GPIO_INPUT)
GPIO(EC_BRD_ID1, PIN(9, 6), GPIO_INPUT)
GPIO(EC_BRD_ID2, PIN(9, 3), GPIO_INPUT)
GPIO(EC_BRD_ID3, PIN(F, 0), GPIO_INPUT)
-GPIO(EC_GPIO95, PIN(9, 5), GPIO_OUT_LOW)
+GPIO(EC_INT_L, PIN(9, 5), GPIO_OUT_HIGH)
GPIO(UHALL_PWR_EN, PIN(E, 0), GPIO_OUT_HIGH)
GPIO(USB2_VBUSSENSE, PIN(A, 2), GPIO_OUT_LOW)
GPIO(USB2_ID, PIN(A, 0), GPIO_OUT_LOW)