diff options
author | Diana Z <dzigterman@chromium.org> | 2021-02-24 16:21:51 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-09 23:44:38 +0000 |
commit | 7dadb784c1664342a844f959636bd7303b2f13ce (patch) | |
tree | 6cf9717335b08e6c71bfd73b88efe8d36892f055 /common/usbc/usb_pe_drp_sm.c | |
parent | 1f3663c84209271a62c38308adaced5ae34032d6 (diff) | |
download | chrome-ec-7dadb784c1664342a844f959636bd7303b2f13ce.tar.gz |
TCPMv2: Start Error Recovery when errant FRS signal comes in
If the PE layer is not currently running when a FRS signal is received,
generate USB Type-C Error Recovery on the port to try getting back into
a known good state.
BRANCH=None
BUG=b:180453483
TEST=on voxel, ensure that Vbus turned is off when FRS signals after TC
detach from a device
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I185df235a5e9667db73869b07d0c89afaf0d9b67
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718837
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'common/usbc/usb_pe_drp_sm.c')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index b883351d84..985a9ea531 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -886,10 +886,17 @@ void pe_got_hard_reset(int port) * Called by the handler that detects the FRS signal in order to * switch PE states to complete the FRS that the hardware has * started. + * + * If the PE is not running, generate an error recovery to turn off + * Vbus and get the port back into a known state. */ void pd_got_frs_signal(int port) { - PE_SET_FLAG(port, PE_FLAGS_FAST_ROLE_SWAP_SIGNALED); + if (pe_is_running(port)) + PE_SET_FLAG(port, PE_FLAGS_FAST_ROLE_SWAP_SIGNALED); + else + pd_set_error_recovery(port); + task_wake(PD_PORT_TO_TASK_ID(port)); } #endif /* CONFIG_USB_PD_REV30 */ |