summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-05-02 16:50:27 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2016-08-01 16:42:00 +0000
commit3d833214700dd0c1e76f904964bedd74e9b2ed74 (patch)
tree34682488e0b7c22f5c976d4ee1ec7f8974277eae
parentf3f1b2bd140fcbd306efa3341c406c0f1dabe084 (diff)
downloadchrome-ec-3d833214700dd0c1e76f904964bedd74e9b2ed74.tar.gz
BACKPORT: mkpb: Add MKBP support over ACPI
Add a host event to support MKPB: When sent, the ACPI code will send a notification to the kernel cros-ec-lpcs driver that will issue EC_CMD_GET_NEXT_EVENT. We can allow code (sensor stack for instance) that uses MKBP to work on ACPI based architecture. Obviously, host event over MKPB is not supported. BRANCH=cyan BUG=b:27849483 TEST=Check we get sensor events on Cyan through the sensor ring. (cyan branch) Change-Id: Iadc9c852b410cf69ef15bcbbb1b086c36687c687 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/353634 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 00aef53a7b4c1a302b8f1448f2c634712c7b77eb) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359408
-rw-r--r--common/host_event_commands.c11
-rw-r--r--common/mkbp_event.c5
-rw-r--r--include/config.h3
-rw-r--r--include/ec_commands.h6
4 files changed, 20 insertions, 5 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index feb1d93552..4b9320c9ce 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -51,11 +51,13 @@ void host_set_events(uint32_t mask)
lpc_set_host_event_state(events);
#else
*(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = events;
-#endif
-
#ifdef CONFIG_MKBP_EVENT
- mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
+#ifdef CONFIG_MKBP_USE_HOST_EVENT
+#error "Config error: MKBP must not be on top of host event"
#endif
+ mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
+#endif /* CONFIG_MKBP_EVENT */
+#endif /* !CONFIG_LPC */
}
void host_clear_events(uint32_t mask)
@@ -70,11 +72,10 @@ void host_clear_events(uint32_t mask)
lpc_set_host_event_state(events);
#else
*(uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS) = events;
-#endif
-
#ifdef CONFIG_MKBP_EVENT
mkbp_send_event(EC_MKBP_EVENT_HOST_EVENT);
#endif
+#endif /* !CONFIG_LPC */
}
static int host_get_next_event(uint8_t *out)
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index c8b8d3bced..77522f2825 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -35,7 +35,12 @@ static int event_is_set(uint8_t event_type)
static void set_host_interrupt(int active)
{
/* interrupt host by using active low EC_INT signal */
+#ifdef CONFIG_MKBP_USE_HOST_EVENT
+ if (active)
+ host_set_single_event(EC_HOST_EVENT_MKBP);
+#else
gpio_set_level(GPIO_EC_INT_L, !active);
+#endif
}
void mkbp_send_event(uint8_t event_type)
diff --git a/include/config.h b/include/config.h
index 884f57b906..4fbe6fd403 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1234,6 +1234,9 @@
/* Support MKBP event */
#undef CONFIG_MKBP_EVENT
+/* MKBP events are sent using host event */
+#undef CONFIG_MKBP_USE_HOST_EVENT
+
/* Support memory protection unit (MPU) */
#undef CONFIG_MPU
diff --git a/include/ec_commands.h b/include/ec_commands.h
index b7391724fb..19d0901a68 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -434,6 +434,12 @@ enum host_event_code {
/* Keyboard fastboot combo has been pressed */
EC_HOST_EVENT_KEYBOARD_FASTBOOT = 25,
+ /* EC RTC event occurred */
+ EC_HOST_EVENT_RTC_UNUSED = 26,
+
+ /* Emulate MKBP event */
+ EC_HOST_EVENT_MKBP = 27,
+
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be