summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/big/gpio.inc2
-rw-r--r--board/host/gpio.inc2
-rw-r--r--board/jerry/gpio.inc2
-rw-r--r--board/llama/gpio.inc2
-rw-r--r--board/npcx_evb_arm/gpio.inc2
-rw-r--r--board/oak/board.c36
-rw-r--r--board/oak/board.h2
-rw-r--r--board/oak/gpio.inc2
-rw-r--r--board/pit/gpio.inc2
-rw-r--r--common/keyboard_mkbp.c2
-rw-r--r--power/mediatek.c4
-rw-r--r--power/rockchip.c4
-rw-r--r--test/kb_mkbp.c2
13 files changed, 50 insertions, 14 deletions
diff --git a/board/big/gpio.inc b/board/big/gpio.inc
index 31ed5e30b6..a5220d33ce 100644
--- a/board/big/gpio.inc
+++ b/board/big/gpio.inc
@@ -29,7 +29,7 @@ GPIO(WP_L, PIN(B, 4), GPIO_INPUT)
/* Outputs */
GPIO(AP_RESET_L, PIN(B, 3), GPIO_ODR_HIGH)
GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW)
-GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH)
+GPIO(EC_INT_L, PIN(B, 9), GPIO_ODR_HIGH)
GPIO(ENTERING_RW, PIN(H, 0), GPIO_OUT_LOW)
GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH)
GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH)
diff --git a/board/host/gpio.inc b/board/host/gpio.inc
index 8a9c3ae1a5..0b9fa47dba 100644
--- a/board/host/gpio.inc
+++ b/board/host/gpio.inc
@@ -12,7 +12,7 @@ GPIO_INT(BUTTON_VOLUME_DOWN_L, PIN(0, 0), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(BUTTON_VOLUME_UP, PIN(0, 0), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(CHARGE_DONE, PIN(0, 0), GPIO_INT_BOTH, inductive_charging_interrupt)
-GPIO(EC_INT, PIN(0, 0), 0)
+GPIO(EC_INT_L, PIN(0, 0), 0)
GPIO(WP, PIN(0, 0), 0)
GPIO(ENTERING_RW, PIN(0, 0), 0)
GPIO(PCH_BKLTEN, PIN(0, 0), 0)
diff --git a/board/jerry/gpio.inc b/board/jerry/gpio.inc
index f334dfcf83..0b698f8401 100644
--- a/board/jerry/gpio.inc
+++ b/board/jerry/gpio.inc
@@ -31,7 +31,7 @@ GPIO(WP_L, PIN(B, 4), GPIO_INPUT)
GPIO(BAT_LED_RED, PIN(B, 11), GPIO_OUT_HIGH)
GPIO(BAT_LED_GREEN, PIN(A, 11), GPIO_OUT_HIGH)
GPIO(EC_BL_OVERRIDE, PIN(F, 1), GPIO_OUT_LOW)
-GPIO(EC_INT, PIN(B, 9), GPIO_OUT_LOW)
+GPIO(EC_INT_L, PIN(B, 9), GPIO_OUT_LOW)
GPIO(ENTERING_RW, PIN(F, 0), GPIO_OUT_LOW)
GPIO(I2C1_SCL, PIN(B, 6), GPIO_ODR_HIGH)
GPIO(I2C1_SDA, PIN(B, 7), GPIO_ODR_HIGH)
diff --git a/board/llama/gpio.inc b/board/llama/gpio.inc
index 7b44460eab..4b52f4c8f9 100644
--- a/board/llama/gpio.inc
+++ b/board/llama/gpio.inc
@@ -34,7 +34,7 @@ GPIO(BOARD_VERSION1, PIN(C, 6), GPIO_INPUT|GPIO_PULL_UP) /* Board version stu
GPIO(BAT_LED0, PIN(B, 11), GPIO_OUT_LOW) /* LED_GREEN */
GPIO(BAT_LED1, PIN(A, 11), 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)
GPIO(KB_OUT00, PIN(B, 0), GPIO_KB_OUTPUT)
GPIO(KB_OUT01, PIN(B, 8), GPIO_KB_OUTPUT)
diff --git a/board/npcx_evb_arm/gpio.inc b/board/npcx_evb_arm/gpio.inc
index 995c68a3d8..18d50564ff 100644
--- a/board/npcx_evb_arm/gpio.inc
+++ b/board/npcx_evb_arm/gpio.inc
@@ -20,7 +20,7 @@ GPIO_INT(LID_OPEN, PIN(3, 3), GPIO_PULL_DOWN | GPIO_INT_BOTH, lid_interr
GPIO(ENTERING_RW, PIN(3, 6), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */
GPIO(PCH_WAKE_L, PIN(5, 0), GPIO_OUT_HIGH) /* Wake signal output to PCH */
/* For testing keyboard mkbp */
-GPIO(EC_INT, PIN(7, 4), GPIO_ODR_HIGH) /* Interrupt pin for keyboard mkbp */
+GPIO(EC_INT_L, PIN(7, 4), GPIO_ODR_HIGH) /* Interrupt pin for keyboard mkbp */
/* Used for module testing */
GPIO(PGOOD_FAN, PIN(C, 7), GPIO_PULL_UP | GPIO_INPUT) /* Power Good for FAN test */
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)
diff --git a/board/pit/gpio.inc b/board/pit/gpio.inc
index 7a729001ea..0f9660dafc 100644
--- a/board/pit/gpio.inc
+++ b/board/pit/gpio.inc
@@ -31,7 +31,7 @@ GPIO(WP_L, PIN(B, 4), GPIO_INPUT)
/* Outputs */
GPIO(AP_RESET_L, PIN(B, 3), GPIO_ODR_HIGH)
GPIO(CHARGER_EN, PIN(B, 2), GPIO_OUT_LOW)
-GPIO(EC_INT, PIN(B, 9), GPIO_ODR_HIGH)
+GPIO(EC_INT_L, PIN(B, 9), GPIO_ODR_HIGH)
GPIO(EN_PP1350, PIN(H, 1), GPIO_OUT_LOW)
GPIO(EN_PP3300, PIN(A, 8), GPIO_OUT_LOW)
GPIO(EN_PP5000, PIN(A, 11), GPIO_OUT_LOW)
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index 443f2b47fc..0e5f766a08 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -102,7 +102,7 @@ static int kb_fifo_remove(uint8_t *buffp)
static void set_host_interrupt(int active)
{
/* interrupt host by using active low EC_INT signal */
- gpio_set_level(GPIO_EC_INT, !active);
+ gpio_set_level(GPIO_EC_INT_L, !active);
}
/*****************************************************************************/
diff --git a/power/mediatek.c b/power/mediatek.c
index b0bba88387..78f004970b 100644
--- a/power/mediatek.c
+++ b/power/mediatek.c
@@ -475,7 +475,7 @@ static void power_off(void)
GPIO_INPUT);
/* Change EC_INT to low */
- gpio_set_level(GPIO_EC_INT, 0);
+ gpio_set_level(GPIO_EC_INT_L, 0);
lid_opened = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
@@ -589,7 +589,7 @@ static void power_on(void)
/* enable interrupt */
gpio_set_flags(GPIO_SUSPEND_L, INT_BOTH_PULL_UP);
- gpio_set_flags(GPIO_EC_INT, GPIO_OUTPUT | GPIO_OUT_HIGH);
+ gpio_set_flags(GPIO_EC_INT_L, GPIO_OUTPUT | GPIO_OUT_HIGH);
disable_sleep(SLEEP_MASK_AP_RUN);
#ifdef HAS_TASK_POWERLED
diff --git a/power/rockchip.c b/power/rockchip.c
index cbb06fc2af..7a2955af68 100644
--- a/power/rockchip.c
+++ b/power/rockchip.c
@@ -370,7 +370,7 @@ static void power_off(void)
chipset_turn_off_power_rails();
/* Change SUSPEND_L and EC_INT pin to high-Z to reduce power draw. */
gpio_set_flags(GPIO_SUSPEND_L, GPIO_INPUT);
- gpio_set_flags(GPIO_EC_INT, GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_INT_L, GPIO_INPUT);
/* Wait till we actually turn off to not mess up the state machine. */
while (power_get_signals() & IN_POWER_GOOD) {
@@ -453,7 +453,7 @@ enum power_state power_handle_state(enum power_state state)
/* setup misc gpio for S3/S0 functionality */
gpio_set_flags(GPIO_SUSPEND_L, GPIO_INPUT
| GPIO_INT_BOTH | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_EC_INT, GPIO_OUTPUT
+ gpio_set_flags(GPIO_EC_INT_L, GPIO_OUTPUT
| GPIO_OUT_HIGH);
/* Call hooks now that AP is running */
diff --git a/test/kb_mkbp.c b/test/kb_mkbp.c
index fc7a9255de..e1abcc3adb 100644
--- a/test/kb_mkbp.c
+++ b/test/kb_mkbp.c
@@ -31,7 +31,7 @@ void host_send_response(struct host_cmd_handler_args *args)
void gpio_set_level(enum gpio_signal signal, int level)
{
- if (signal == GPIO_EC_INT)
+ if (signal == GPIO_EC_INT_L)
ec_int_level = !!level;
}