summaryrefslogtreecommitdiff
path: root/board/samus_pd
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 /board/samus_pd
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 'board/samus_pd')
-rw-r--r--board/samus_pd/usb_pd_policy.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 59530116c9..a8b1f1a4b5 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -259,12 +259,15 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
}
static int dp_flags[PD_PORT_COUNT];
+/* DP Status VDM as returned by UFP */
+static uint32_t dp_status[PD_PORT_COUNT];
static void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
board_set_usb_mux(port, TYPEC_MUX_NONE, pd_get_polarity(port));
dp_flags[port] = 0;
+ dp_status[port] = 0;
}
static int svdm_enter_dp_mode(int port, uint32_t mode_caps)
@@ -297,10 +300,18 @@ static int svdm_dp_status(int port, uint32_t *payload)
static int svdm_dp_config(int port, uint32_t *payload)
{
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
- board_set_usb_mux(port, TYPEC_MUX_DP, pd_get_polarity(port));
+ int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
+ int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
+
+ if (!pin_mode)
+ return 0;
+
+ board_set_usb_mux(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
+ pd_get_polarity(port));
+
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
CMD_DP_CONFIG | VDO_OPOS(opos));
- payload[1] = VDO_DP_CFG(MODE_DP_PIN_E, /* UFP_U as UFP_D */
+ payload[1] = VDO_DP_CFG(pin_mode, /* UFP_U as UFP_D */
0, /* UFP_U as DFP_D */
1, /* DPv1.3 signaling */
2); /* UFP_U connected as UFP_D */
@@ -335,11 +346,13 @@ DECLARE_DEFERRED(hpd1_irq_deferred);
static int svdm_dp_attention(int port, uint32_t *payload)
{
int cur_lvl;
- int lvl = PD_VDO_HPD_LVL(payload[1]);
- int irq = PD_VDO_HPD_IRQ(payload[1]);
+ int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
+ int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
enum gpio_signal hpd = PORT_TO_HPD(port);
cur_lvl = gpio_get_level(hpd);
+ dp_status[port] = payload[1];
+
/* Its initial DP status message prior to config */
if (!(dp_flags[port] & DP_FLAGS_DP_ON)) {
if (lvl)