diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-03-13 22:02:22 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-24 19:27:56 +0000 |
commit | 2b86994b8368c36a54d32f36984b2ae9a2997295 (patch) | |
tree | 4e0f38dd6ada8349b23b0df9b6a6530356c3d74d /common/usbc/usb_tc_ctvpd_sm.c | |
parent | 0252cc3de4092702043b367ace18dfc97f3327aa (diff) | |
download | chrome-ec-2b86994b8368c36a54d32f36984b2ae9a2997295.tar.gz |
TCPMv2: Not enable PD comm on TX Phy reset if not in a connected state
If PD is not in a connected state, the previous approach was to enable
PD comm on TX Phy reset and then disable it later (the SM_RUN case in
prl_run()). In this short period of time, the TCPC wil respond GoodCRC
to the PD message and the PD partner will go forward to the next state
that messes up its state machine and causes an unexpected hard reset.
We should not enable PD comm if not in a connected state.
BRANCH=None
BUG=b:151159750
TEST=Tested on Trogdor, with extra patches to fix the DP discovery
and separate the Tx and Rx buffers. Unplugged battery and plugged
a 20V charger and verified it boot fine, no reboot loop.
TEST=Built chocodile_vpdmcu image successfully.
TEST=make runtests -j
Change-Id: Ic819787f1ec0085abdded3bab8ecbcb813495408
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2107882
Reviewed-by: Sam Hurst <shurst@google.com>
Diffstat (limited to 'common/usbc/usb_tc_ctvpd_sm.c')
-rw-r--r-- | common/usbc/usb_tc_ctvpd_sm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/usbc/usb_tc_ctvpd_sm.c b/common/usbc/usb_tc_ctvpd_sm.c index 194bb664fe..804c733485 100644 --- a/common/usbc/usb_tc_ctvpd_sm.c +++ b/common/usbc/usb_tc_ctvpd_sm.c @@ -222,6 +222,17 @@ test_mockable_static void print_current_state(const int port) CPRINTS("C%d: %s", port, tc_state_names[get_state_tc(port)]); } +int pd_is_connected(int port) +{ + return (get_state_tc(port) == TC_ATTACHED_SNK) || + (get_state_tc(port) == TC_ATTACHED_SRC); +} + +bool pd_is_disconnected(int port) +{ + return !pd_is_connected(port); +} + /** * Disabled * |