summaryrefslogtreecommitdiff
path: root/board/oak
diff options
context:
space:
mode:
authorBen Lok <ben.lok@mediatek.com>2015-08-31 14:35:01 +0800
committerchrome-bot <chrome-bot@chromium.org>2015-08-31 22:59:52 -0700
commitc2cf0fb198feea043a331e5d2156979d23f1aa46 (patch)
tree606be714410424767317523693737dd7748a7920 /board/oak
parenta030c63bafb3e18619b2ec325c0a6b2de3c4bfe7 (diff)
downloadchrome-ec-c2cf0fb198feea043a331e5d2156979d23f1aa46.tar.gz
oak: enable MBKP events for PD events
(refer to CL:273620) enable the MKBP event feature to send host event and wire up the PD specific events. But, CONFIG_MKBP_EVENT conflicts with CONFIG_KEYBOARD_PROTOCOL_MKBP, due to the GPIO name of EC interrupt pin. Align the GPIO naming of EC interrupt pin to EC_INT_L. BRANCH=none BUG=chrome-os-partner:44643 TEST=On Oak rev3, plug/unplug USB devices and add kernel trace to see the PD events happening. Change-Id: I10de9c6611583bb6165bdc1848e542d4b8bba954 Signed-off-by: Ben Lok <ben.lok@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/296012 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'board/oak')
-rw-r--r--board/oak/board.c36
-rw-r--r--board/oak/board.h2
-rw-r--r--board/oak/gpio.inc2
3 files changed, 38 insertions, 2 deletions
diff --git a/board/oak/board.c b/board/oak/board.c
index ffe5ddf049..b77e582930 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -7,6 +7,7 @@
#include "adc.h"
#include "adc_chip.h"
+#include "atomic.h"
#include "battery.h"
#include "charge_manager.h"
#include "charge_state.h"
@@ -46,6 +47,13 @@
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT GPIO_ODR_HIGH
+/*
+ * PD host event status for host command
+ * Note: this variable must be aligned on 4-byte boundary because we pass the
+ * address to atomic_ functions which use assembly to access them.
+ */
+static struct ec_response_host_event_status host_event_status __aligned(4);
+
/* Dispaly port hardware can connect to port 0, 1 or neither. */
#define PD_PORT_NONE -1
@@ -161,6 +169,18 @@ void board_reset_pd_mcu(void)
gpio_set_level(GPIO_USB_PD_RST_L, 1);
}
+/* Send host event up to AP */
+void pd_send_host_event(int mask)
+{
+ /* mask must be set */
+ if (!mask)
+ return;
+
+ atomic_or(&(host_event_status.status), mask);
+ /* interrupt the AP */
+ host_set_single_event(EC_HOST_EVENT_PD_MCU);
+}
+
void __board_i2c_set_timeout(int port, uint32_t timeout)
{
}
@@ -346,3 +366,19 @@ void board_set_ap_reset(int asserted)
gpio_set_level(GPIO_AP_RESET_L, !asserted);
}
}
+
+/****************************************************************************/
+/* Host commands */
+static int host_event_status_host_cmd(struct host_cmd_handler_args *args)
+{
+ struct ec_response_host_event_status *r = args->response;
+
+ /* Read and clear the host event status to return to AP */
+ r->status = atomic_read_clear(&(host_event_status.status));
+
+ args->response_size = sizeof(*r);
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_PD_HOST_EVENT_STATUS, host_event_status_host_cmd,
+ EC_VER_MASK(0));
+
diff --git a/board/oak/board.h b/board/oak/board.h
index f2ef24500e..1bd3fbc390 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -53,7 +53,7 @@
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_FORCE_CONSOLE_RESUME
+#define CONFIG_MKBP_EVENT
#define CONFIG_PMIC_FW_LONG_PRESS_TIMER
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_COMMON
diff --git a/board/oak/gpio.inc b/board/oak/gpio.inc
index d5c8a1cac0..013cddea0e 100644
--- a/board/oak/gpio.inc
+++ b/board/oak/gpio.inc
@@ -42,7 +42,7 @@ GPIO(BAT_LED1, PIN(A, 11), GPIO_OUT_LOW) /* LED_ORANGE or LED_RED(>re
GPIO(PWR_LED0, PIN(F, 10), GPIO_OUT_LOW) /* LED_GREEN */
GPIO(PWR_LED1, PIN(F, 9), GPIO_OUT_LOW) /* LED_ORANGE */
GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW)
-GPIO(EC_INT, PIN(B, 9), GPIO_OUT_HIGH)
+GPIO(EC_INT_L, PIN(B, 9), GPIO_OUT_HIGH)
GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW)