diff options
author | xiong <xiong.huang@bitland.com.cn> | 2020-02-25 11:45:11 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-27 08:42:34 +0000 |
commit | 5c1188f049e3d639b4cb127734b846d46f710ad3 (patch) | |
tree | 15db4916621a0f51cb0e5486db0fd55d57276921 | |
parent | dd453ede19a1a2e9a13b1c85b209b4c7e93d0467 (diff) | |
download | chrome-ec-5c1188f049e3d639b4cb127734b846d46f710ad3.tar.gz |
USB PD: reset VCONN and keep consistent with the previous explicit contract
In one case, TCPC was being a sink but a VCONN source in a previous
explicit contract. TCPC was still be a sink but not go on suppling
VCONN after rebooting EC.
Guarding the saved VCONN role and If TCPC was being sourcing VCONN
and as a sink source in previous explicit contract, TCPC should still
be the VCONN source.
BUG=b:150112192
TEST=Some dongles (PS176-01 and JCA374) can display after
rebooting EC with adapter.
BRANCH=kukui
Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Change-Id: Ia1e226d21e3a20411521b9ce6f19f749ac48bf51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2071536
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Commit-Queue: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com>
-rw-r--r-- | common/usb_pd_protocol.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 67592e3249..e1b1b8e27b 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2902,7 +2902,21 @@ void pd_task(void *u) */ pd_power_supply_reset(port); #ifdef CONFIG_USBC_VCONN - set_vconn(port, 0); +#ifdef CONFIG_USB_PD_DUAL_ROLE + /* + * If we were previously a sink but also the VCONN source, we should + * still continue to source VCONN. Otherwise, we should turn off VCONN + * since we are also going to turn off VBUS. + */ + if (pd_comm_is_enabled(port) && + (pd_get_saved_port_flags(port, &saved_flgs) == EC_SUCCESS) && + ((saved_flgs & PD_BBRMFLG_POWER_ROLE) == PD_ROLE_SINK) && + (saved_flgs & PD_BBRMFLG_EXPLICIT_CONTRACT) && + (saved_flgs & PD_BBRMFLG_VCONN_ROLE)) + set_vconn(port, 1); + else +#endif + set_vconn(port, 0); #endif /* Initialize TCPM driver and wait for TCPC to be ready */ |