From 01a99552df8b2bb3ff43c2304c67542616bd3e64 Mon Sep 17 00:00:00 2001 From: Sam Hurst Date: Thu, 19 Apr 2018 10:44:54 -0700 Subject: [PATCH] PD: Leave Vbus ON if Vconn and Vbus Requested is set to 0 in the AMA VDO While troubleshooting why a generic $19.99 Multiport (USB, HDMI, Type-C) Type-C dongle didn't work on Scarlet, I noticed that Vconn Req and Vbus Req were both set to zero in the AMA VDO. For a better user experience, default to Vbus ON if both Vconn and Vbus Req are both zero. BUG=b:78286905 BRANCH=NONE TEST=manual Tested the generic dongle with USB-Keyboard, TypeC power adapter, and HP monitor. Change-Id: I170eef1372c3621334de2c457bd4533eea744cc0 Signed-off-by: Sam Hurst Reviewed-on: https://chromium-review.googlesource.com/1019611 Commit-Ready: Sam Hurst Tested-by: Sam Hurst Reviewed-by: Vincent Palatin --- common/usb_pd_policy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 63e1b4811d..9f4b41b74d 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -294,16 +294,16 @@ static void dfp_consume_identity(int port, int cnt, uint32_t *payload) memcpy(&pe[port].identity, payload + 1, identity_size); switch (ptype) { case IDH_PTYPE_AMA: - /* TODO(tbroch) do I disable VBUS here if power contract - * requested it - */ - if (!PD_VDO_AMA_VBUS_REQ(payload[VDO_I(AMA)])) - pd_power_supply_reset(port); - +/* Leave vbus ON if the following macro is false */ #if defined(CONFIG_USB_PD_DUAL_ROLE) && defined(CONFIG_USBC_VCONN_SWAP) /* Adapter is requesting vconn, try to supply it */ if (PD_VDO_AMA_VCONN_REQ(payload[VDO_I(AMA)])) pd_try_vconn_src(port); + + /* Only disable vbus if vconn was requested */ + if (PD_VDO_AMA_VCONN_REQ(payload[VDO_I(AMA)]) && + !PD_VDO_AMA_VBUS_REQ(payload[VDO_I(AMA)])) + pd_power_supply_reset(port); #endif break; default: