summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2019-04-04 14:50:06 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-04-09 06:19:51 -0700
commit61b34b2cab9bd0ab65a3ef6ab7ad4d674cfa1255 (patch)
tree65587e5dc08686478746947937836a8cce2b688a
parentc633a2d6c8267d704cda54d30996d4eeeae87989 (diff)
downloadchrome-ec-61b34b2cab9bd0ab65a3ef6ab7ad4d674cfa1255.tar.gz
grunt/usb_pd_policy: Don't disconnect the USB lines while negotiating PD
This policy causes USB 3 to disconnect when doing DP negotiation. If negotiation results in DOCK then the USB 3 lines are reconnected resulting in renegotiating the USB device again. There are other chromebooks already doing the same thing. e.g., oak. BUG=b:123310411 TEST=Tried a test with a monitor and with a USB-C hub with HDMI. Verified that the extra disconnect is gone. Change-Id: I907e19689ff608ab2608e973875410cf94bb0053 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1553572 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--baseboard/grunt/usb_pd_policy.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c
index ab15a03172..97673cf162 100644
--- a/baseboard/grunt/usb_pd_policy.c
+++ b/baseboard/grunt/usb_pd_policy.c
@@ -240,11 +240,21 @@ static uint32_t dp_status[CONFIG_USB_PD_PORT_COUNT];
static void svdm_safe_dp_mode(int port)
{
+ const char *dp_str, *usb_str;
+
/* make DP interface safe until configure */
dp_flags[port] = 0;
dp_status[port] = 0;
- usb_mux_set(port, TYPEC_MUX_NONE,
- USB_SWITCH_CONNECT, pd_get_polarity(port));
+
+ /* Don't disconnect USB when initializing DP. This avoids an unnecessary
+ * disconnect if the result of DP negotiation is DOCK.
+ */
+ if (usb_mux_get(port, &dp_str, &usb_str) && usb_str)
+ usb_mux_set(port, TYPEC_MUX_USB, USB_SWITCH_CONNECT,
+ pd_get_polarity(port));
+ else
+ usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_CONNECT,
+ pd_get_polarity(port));
}
static int svdm_enter_dp_mode(int port, uint32_t mode_caps)