summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-08-25 13:50:04 -0700
committerCommit Bot <commit-bot@chromium.org>2021-08-26 19:46:23 +0000
commitb4e7e05b7e36c53ea1ee9f0732a1c7d37a776c07 (patch)
tree485a4a1a403bbe5d93dcf1be4cf0ae896284d7fc /common
parent08b2deaf500d6be287839567b1887ad601885ffe (diff)
downloadchrome-ec-b4e7e05b7e36c53ea1ee9f0732a1c7d37a776c07.tar.gz
usb_mux: Add function to enable USB3.1 mode for UFP
This CL adds a new overridable function to allow boards more control over the USB mux. For type-c only connections, the mux may only be set one time based only on data role. The default function returns false, so only boards which override this function will be affected. BUG=b:195042155 BRANCH=quiche TEST=Verfied that when I connect USBC only source on gingerbread that the TUSB1064 usb mux gets configured to enable USB3.1 mode. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I5cc7466d2d13c46b1ff6cfc48af577559591f6e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3119224 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_common.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/common/usb_common.c b/common/usb_common.c
index 97ebedc3d3..0aab746f44 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -458,6 +458,11 @@ enum pd_drp_next_states drp_auto_toggle_next_state(
}
}
+__overridable bool usb_ufp_check_usb3_enable(int port)
+{
+ return false;
+}
+
mux_state_t get_mux_mode_to_set(int port)
{
/*
@@ -477,6 +482,16 @@ mux_state_t get_mux_mode_to_set(int port)
if (pd_is_disconnected(port))
return USB_PD_MUX_NONE;
+ /*
+ * For type-c only connections, there may be a need to enable USB3.1
+ * mode when the port is in a UFP data role, independent of any other
+ * conditions which are checked below. The default function returns
+ * false, so only boards that override this check will be affected.
+ */
+ if (usb_ufp_check_usb3_enable(port) && pd_get_data_role(port)
+ == PD_ROLE_UFP)
+ return USB_PD_MUX_USB_ENABLED;
+
/* If new data role isn't DFP & we only support DFP, also disconnect. */
if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE) &&
IS_ENABLED(CONFIG_USBC_SS_MUX_DFP_ONLY) &&