summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-04-28 14:42:59 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-30 02:31:18 +0000
commit63786f247e2f8a058465b75cd476ef0c7ec5979f (patch)
tree8c380b1dbf448fc70b159d9872329f1d0eabd6ae /include
parentfab26ee8914ad9f111d982388aeec61c13d6b1c6 (diff)
downloadchrome-ec-63786f247e2f8a058465b75cd476ef0c7ec5979f.tar.gz
samus_pd: Request different DP pin modes including multi-function.
Previously samus_pd just picked pin mode E without regard to what the UFP was requesting. This change surveys the UFP's DP pin capabilities and then requests the appropriate pin config. Additionally if the UFP supports multi-function and has preferred it during the initial DP status message, samus will configure its type-c mux in 'dock' mode. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:38728 TEST=manual, 1. hoho + samus, pin mode = 'C' 2. dingdong + samus, pin mode = 'E'. 3. apple type-C HDMI multiport + samus, pin mode = 'D' and USB device enumerates as SuperSpeed. 4. plankton + samus w/ patch asserting alternate mode with multi-function preferred sets config to 'F' now and only drives DP out on 2 lanes w/ other two allowing USB key to be seen. Change-Id: Ie4764c33f108e8a88f0052b64ddb96cb92e5a78b Reviewed-on: https://chromium-review.googlesource.com/267796 Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 3c0c48e07a..30e25d949a 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -487,12 +487,22 @@ 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 MODE_DP_PIN_A 0x01
#define MODE_DP_PIN_B 0x02
#define MODE_DP_PIN_C 0x04
#define MODE_DP_PIN_D 0x08
#define MODE_DP_PIN_E 0x10
+#define MODE_DP_PIN_F 0x20
+
+/* Pin configs B/D/F support multi-function */
+#define MODE_DP_PIN_MF_MASK 0x2a
+/* Pin configs A/B support BR2 signaling levels */
+#define MODE_DP_PIN_BR2_MASK 0x3
+/* Pin configs C/D/E/F support DP signaling levels */
+#define MODE_DP_PIN_DP_MASK 0x3c
#define MODE_DP_V13 0x1
#define MODE_DP_GEN2 0x2
@@ -520,8 +530,9 @@ struct pd_policy {
| ((usbc) & 1) << 5 | ((mf) & 1) << 4 | ((en) & 1) << 3 \
| ((lp) & 1) << 2 | ((conn & 0x3) << 0))
-#define PD_VDO_HPD_IRQ(x) ((x >> 8) & 1)
-#define PD_VDO_HPD_LVL(x) ((x >> 7) & 1)
+#define PD_VDO_DPSTS_HPD_IRQ(x) (((x) >> 8) & 1)
+#define PD_VDO_DPSTS_HPD_LVL(x) (((x) >> 7) & 1)
+#define PD_VDO_DPSTS_MF_PREF(x) (((x) >> 4) & 1)
#define HPD_DEBOUNCE_LVL (100*MSEC)
#define HPD_DEBOUNCE_IRQ (2*MSEC)
@@ -1019,6 +1030,15 @@ int pd_custom_flash_vdm(int port, int cnt, uint32_t *payload);
uint32_t pd_dfp_enter_mode(int port, uint16_t svid, int opos);
/**
+ * Get DisplayPort pin mode for DFP to request from UFP's capabilities.
+ *
+ * @param port USB-C port number.
+ * @param status DisplayPort Status VDO.
+ * @return one-hot PIN config to request.
+ */
+int pd_dfp_dp_get_pin_mode(int port, uint32_t status);
+
+/**
* Exit alternate mode on DFP
*
* @param port USB-C port number