summaryrefslogtreecommitdiff
path: root/board/baklava/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/baklava/board.c')
-rw-r--r--board/baklava/board.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/board/baklava/board.c b/board/baklava/board.c
index 35a27d0c21..12365e0ff6 100644
--- a/board/baklava/board.c
+++ b/board/baklava/board.c
@@ -262,6 +262,31 @@ int dock_get_mf_preference(void)
{
return MF_ON;
}
+
+static void board_usb_tc_connect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /*
+ * The EC needs to indicate to the MST hub when the host port is
+ * attached. GPIO_UFP_PLUG_DET is used for this purpose.
+ */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 0);
+}
+DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_tc_connect, HOOK_PRIO_DEFAULT);
+
+static void board_usb_tc_disconnect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /* Only the host port disconnect is relevant */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 1);
+}
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+ HOOK_PRIO_DEFAULT);
+
#endif /* SECTION_IS_RW */
static void board_init(void)