summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2017-02-17 18:57:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-04-06 20:05:08 -0700
commita8e6b070cbd107d8c2f44f44ae8231a4f4efea90 (patch)
treee8613b738941e4a4c88dbfd0884644d0ae93a331 /common
parent6277174bff831f7fae8958dfdab131893cc43dcc (diff)
downloadchrome-ec-a8e6b070cbd107d8c2f44f44ae8231a4f4efea90.tar.gz
pd: prefer CD pin assignments over EF for USBC->USBC case.
BRANCH=samus,glados,oak,gru,reef BUG=chromium:694597 TEST=manual, connect samus to USB-C monitor via cable and see it select pin assigmnent 'C' Change-Id: Iddad5b654715bd30ba081c62f8fb53e07816498c Reviewed-on: https://chromium-review.googlesource.com/465379 Commit-Ready: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_policy.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 6c33d48f58..568169fbbf 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -496,8 +496,8 @@ static void dfp_consume_attention(int port, uint32_t *payload)
}
/*
- * This algorithm defaults to choosing higher pin config over lower ones. Pin
- * configs are organized in pairs with the following breakdown.
+ * This algorithm defaults to choosing higher pin config over lower ones in
+ * order to prefer multi-function if desired.
*
* NAME | SIGNALING | OUTPUT TYPE | MULTI-FUNCTION | PIN CONFIG
* -------------------------------------------------------------
@@ -511,9 +511,8 @@ static void dfp_consume_attention(int port, uint32_t *payload)
* if UFP has NOT asserted multi-function preferred code masks away B/D/F
* leaving only A/C/E. For single-output dongles that should leave only one
* possible pin config depending on whether its a converter DP->(VGA|HDMI) or DP
- * output. If someone creates a multi-output dongle presumably they would need
- * to either offer different mode capabilities depending upon connection type or
- * the DFP would need additional system policy to expose those options.
+ * output. If UFP is a USB-C receptacle it may assert C/D/E/F. The DFP USB-C
+ * receptacle must always choose C/D in those cases.
*/
int pd_dfp_dp_get_pin_mode(int port, uint32_t status)
{
@@ -535,6 +534,10 @@ int pd_dfp_dp_get_pin_mode(int port, uint32_t status)
/* TODO(crosbug.com/p/39656) revisit if DFP drives USB Gen 2 signals */
pin_caps &= ~MODE_DP_PIN_BR2_MASK;
+ /* if C/D present they have precedence over E/F for USB-C->USB-C */
+ if (pin_caps & (MODE_DP_PIN_C | MODE_DP_PIN_D))
+ pin_caps &= ~(MODE_DP_PIN_E | MODE_DP_PIN_F);
+
/* get_next_bit returns undefined for zero */
if (!pin_caps)
return 0;