summaryrefslogtreecommitdiff
path: root/board/baklava
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-11-17 13:24:36 -0800
committerCommit Bot <commit-bot@chromium.org>2021-11-23 22:33:47 +0000
commit0349a5b6d95308141754523708a2d11d8bacce4c (patch)
treea31a8683db03c0893b6ff3829f9c529b152173a5 /board/baklava
parent87ccd7e748602057441d244824b686c4ed201a52 (diff)
downloadchrome-ec-0349a5b6d95308141754523708a2d11d8bacce4c.tar.gz
honeybuns: Add board level USB_PD_CONNECT hooks
This CL moves the board specific parts of USB_PD_CONNECT hook to board.c file as there are different GPIOs that must be changed between quiche/gingerbread. For Gingerbread, the USB Hubs are held in reset until there is a usbc attach event. quiche/baklava don't require USB hub resets to be controlled, but do have a separate GPIO indicator the MST hub. BUG=b:206059703 BRANCH=quiche TEST=verified GPIO signal levels for signals affected by this CL on quiche and gingerbread. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I88ef6ddfe5026fc75384507920368681d28a21f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3291133 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/baklava')
-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)