summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-06-29 17:38:33 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-01 03:49:10 +0000
commit943e9292f1b02fb819ec22904825c5274fdc68d2 (patch)
treef975090d555bd5a1a7b4e76b7443fd262c3c88f9
parente3c72ce5c1fcc48809b06aa2b6c0e4be8f860172 (diff)
downloadchrome-ec-943e9292f1b02fb819ec22904825c5274fdc68d2.tar.gz
pd: Change which DP pin config DP source uses for sink capabilities.
DP Alternate mode specification defines two bytes in the DP capabilities payload with respect to pin configs. One that governs the DFP and the other the UFP. The one that the DP source needs to examine depends upon whether the UFP is a receptacle or a plug. Previously we just examined the DFP pin config which was correct for all UFP plugs but not UFP receptacles. This change fixes that by examining bit <6> of capability message to determe plug vs receptacle and in case of receptacle choosing the UFP ping config instead. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chromium:505652 TEST=manual, hoho & apple (UFP_D plugs) still work. While I don't have a test for UFP_D receptacle partner device reports following for its DP caps which should now decode correctly. <31:24> 00 Reserved/SBZ <23:16> 1C UFP pin config == C, D, E <15:08> 00 DFP pin config zero <07:00> C5 <6> == 1 == receptacle Change-Id: Ib9e3a808828ff6b8c062baf0fc3c23b3da33c2c3 Reviewed-on: https://chromium-review.googlesource.com/282621 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--common/usb_pd_policy.c2
-rw-r--r--include/usb_pd.h8
2 files changed, 5 insertions, 5 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 3972e2289c..2606ca651f 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -437,7 +437,7 @@ int pd_dfp_dp_get_pin_mode(int port, uint32_t status)
mode_caps = modep->data->mode_vdo[modep->opos - 1];
/* TODO(crosbug.com/p/39656) revisit with DFP that can be a sink */
- pin_caps = PD_VDO_MODE_DP_SRCP(mode_caps);
+ pin_caps = PD_DP_PIN_CAPS(mode_caps);
/* if don't want multi-function then ignore those pin configs */
if (!PD_VDO_DPSTS_MF_PREF(status))
diff --git a/include/usb_pd.h b/include/usb_pd.h
index e9edebb526..a5bfe7ab3b 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -496,8 +496,8 @@ struct pd_policy {
* DisplayPort modes capabilities
* -------------------------------
* <31:24> : SBZ
- * <23:16> : sink pin assignment supported
- * <15:8> : source pin assignment supported
+ * <23:16> : UFP_D pin assignment supported
+ * <15:8> : DFP_D pin assignment supported
* <7> : USB 2.0 signaling (0b=yes, 1b=no)
* <6> : Plug | Receptacle (0b == plug, 1b == receptacle)
* <5:2> : xxx1: Supports DPv1.3, xx1x Supports USB Gen 2 signaling
@@ -508,8 +508,8 @@ struct pd_policy {
(((snkp) & 0xff) << 16 | ((srcp) & 0xff) << 8 \
| ((usb) & 1) << 7 | ((gdr) & 1) << 6 | ((sign) & 0xF) << 2 \
| ((sdir) & 0x3))
-#define PD_VDO_MODE_DP_SNKP(x) (((x) >> 16) & 0x3f)
-#define PD_VDO_MODE_DP_SRCP(x) (((x) >> 8) & 0x3f)
+#define PD_DP_PIN_CAPS(x) ((((x) >> 6) & 0x1) ? (((x) >> 16) & 0x3f) \
+ : (((x) >> 8) & 0x3f))
#define MODE_DP_PIN_A 0x01
#define MODE_DP_PIN_B 0x02