diff options
author | Diana Z <dzigterman@chromium.org> | 2018-11-20 14:16:06 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-21 18:13:19 -0800 |
commit | d0571edba7a64f6a229cbec5218735a6f1d602b9 (patch) | |
tree | f3c64948e6afe5999a2f6bcaba8b57f75a93903c | |
parent | f9c82a8456e975bec8ee255bfba9e49821dd96c9 (diff) | |
download | chrome-ec-d0571edba7a64f6a229cbec5218735a6f1d602b9.tar.gz |
USB PD: Handle Vconn changes during hard reset
According to section 6.8.2 of the PD spec, during hard reset it is
required that the sink cease sourcing Vconn, and that the source turn
Vconn off and back on (specific timing for the source can be found in
section 7.1.5).
BRANCH=None
BUG=b:119540455,b:119742692,b:116764439
TEST=set up a hub which requires Vconn on bobba, ran EC reset and
verified that after the port hard reset the EC was sourcing Vconn
Change-Id: I9c4c89e46b2b32d658ce2eaae4a6b23fd465c406
Signed-off-by: Diana Z <dzigterman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1344793
Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index ccfeb944e6..f58bdda679 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1216,6 +1216,17 @@ void pd_execute_hard_reset(int port) CHARGE_CEIL_NONE); #endif /* CONFIG_CHARGE_MANAGER */ +#ifdef CONFIG_USBC_VCONN + /* + * Sink must turn off Vconn after a hard reset if it was being + * sourced previously + */ + if (pd[port].flags & PD_FLAGS_VCONN_ON) { + set_vconn(port, 0); + pd[port].flags &= ~PD_FLAGS_VCONN_ON; + } +#endif + set_state(port, PD_STATE_SNK_HARD_RESET_RECOVER); return; } @@ -1224,6 +1235,9 @@ void pd_execute_hard_reset(int port) /* We are a source, cut power */ pd_power_supply_reset(port); pd[port].src_recover = get_time().val + PD_T_SRC_RECOVER; +#ifdef CONFIG_USBC_VCONN + set_vconn(port, 0); +#endif set_state(port, PD_STATE_SRC_HARD_RESET_RECOVER); } @@ -2976,6 +2990,15 @@ void pd_task(void *u) break; } +#ifdef CONFIG_USBC_VCONN + /* + * Start sourcing Vconn again and set the flag, in case + * it was 0 due to a previous swap + */ + set_vconn(port, 1); + pd[port].flags |= PD_FLAGS_VCONN_ON; +#endif + /* Enable VBUS */ timeout = 10*MSEC; if (pd_set_power_supply_ready(port)) { |