summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2019-02-05 17:42:32 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-19 22:15:19 -0800
commit3e9fe80cd030bd72d831f763f2ac873fe3f4c339 (patch)
treea8560ac71a800c9008a4ff5bc3186436cd927036 /board
parent3e8588095bb0dda2aabc11fd7439083c073953f3 (diff)
downloadchrome-ec-3e9fe80cd030bd72d831f763f2ac873fe3f4c339.tar.gz
hatch: Enable bc1.2 support
This CL adds the config options and GPIO signals and interrupt handler required for bc1.2 for the pi3usb8201 chip. BUG=b:123995100 BRANCH=none TEST=Verified that bc1.2 detection occurs following connecting a charger and a EC reboot. Verified that the D+/D- switches are closed in both client and host mode as expected. Change-Id: I43ca74f02d2515dc4dfa3dd8dc689d719779e4b5 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1459822 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/hatch/board.c18
-rw-r--r--board/hatch/ec.tasklist2
-rw-r--r--board/hatch/gpio.inc2
3 files changed, 22 insertions, 0 deletions
diff --git a/board/hatch/board.c b/board/hatch/board.c
index 21ff639892..9bac034d31 100644
--- a/board/hatch/board.c
+++ b/board/hatch/board.c
@@ -24,10 +24,12 @@
#include "spi.h"
#include "switch.h"
#include "system.h"
+#include "task.h"
#include "temp_sensor.h"
#include "thermal.h"
#include "thermistor.h"
#include "uart.h"
+#include "usb_charge.h"
#include "usb_pd.h"
#include "usbc_ppc.h"
#include "util.h"
@@ -74,6 +76,22 @@ static void hdmi_hpd_interrupt(enum gpio_signal signal)
baseboard_mst_enable_control(MST_HDMI, gpio_get_level(signal));
}
+static void bc12_interrupt(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C0_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12, 0);
+ break;
+
+ case GPIO_USB_C1_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12, 0);
+ break;
+
+ default:
+ break;
+ }
+}
+
#include "gpio_list.h" /* Must come after other header files. */
/******************************************************************************/
diff --git a/board/hatch/ec.tasklist b/board/hatch/ec.tasklist
index c7d1ef8c9e..55f289ad47 100644
--- a/board/hatch/ec.tasklist
+++ b/board/hatch/ec.tasklist
@@ -22,6 +22,8 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
diff --git a/board/hatch/gpio.inc b/board/hatch/gpio.inc
index d6e77f795a..cf2fb6a840 100644
--- a/board/hatch/gpio.inc
+++ b/board/hatch/gpio.inc
@@ -28,6 +28,8 @@ GPIO_INT(USB_C0_PPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C1_PPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C0_BC12_INT_ODL, PIN(9, 5), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C1_BC12_INT_ODL, PIN(E, 4), GPIO_INT_FALLING, bc12_interrupt)
GPIO_INT(HDMI_CONN_HPD, PIN(7, 2), GPIO_INT_BOTH, hdmi_hpd_interrupt)
/*