summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/usb_pd.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 6051706670..08236b8813 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -847,8 +847,6 @@ struct pd_cable {
(((snkp) & 0xff) << 16 | ((srcp) & 0xff) << 8 \
| ((usb) & 1) << 7 | ((gdr) & 1) << 6 | ((sign) & 0xF) << 2 \
| ((sdir) & 0x3))
-#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
@@ -867,6 +865,8 @@ struct pd_cable {
#define MODE_DP_PIN_BR2_MASK 0x3
/* Pin configs C/D/E/F support DP signaling levels */
#define MODE_DP_PIN_DP_MASK 0x3c
+/* Pin configs A/B/C/D/E/F */
+#define MODE_DP_PIN_CAPS_MASK 0x3f
#define MODE_DP_V13 0x1
#define MODE_DP_GEN2 0x2
@@ -875,6 +875,24 @@ struct pd_cable {
#define MODE_DP_SRC 0x2
#define MODE_DP_BOTH 0x3
+#define MODE_DP_CABLE_SHIFT 6
+
+/*
+ * Determine which pin assignments are valid for DP
+ *
+ * Based on whether the DP adapter identifies itself as a plug (permanently
+ * attached cable) or a receptacle, the pin assignments may be in the DFP_D
+ * field or the UFP_D field.
+ *
+ * Refer to DisplayPort Alt Mode On USB Type-C Standard version 1.0, table 5-2
+ * depending on state of receptacle bit, use pins for DFP_D (if receptacle==0)
+ * or UFP_D (if receptacle==1)
+ * Also refer to DisplayPort Alt Mode Capabilities Clarification (4/30/2015)
+ */
+#define PD_DP_PIN_CAPS(x) ((((x) >> MODE_DP_CABLE_SHIFT) & 0x1) \
+ ? (((x) >> MODE_DP_UFP_PIN_SHIFT) & MODE_DP_PIN_CAPS_MASK) \
+ : (((x) >> MODE_DP_DFP_PIN_SHIFT) & MODE_DP_PIN_CAPS_MASK))
+
/*
* DisplayPort Status VDO
* ----------------------