From ef96869a8d0c587584d181cd05d331372d507b3a Mon Sep 17 00:00:00 2001 From: Scott Collyer Date: Mon, 8 Mar 2021 18:04:39 -0800 Subject: TCPMv2: PE/DPM: Don't preemptively set modal flag Currently we are setting the modal flag as a DFP when the ENTER command is being sent, without confirmation of the ACK reply from the UFP. This CL keeps this behavior for TCPMv1, but moves the setting of the modal flag into the alt mode specific state machine. Currently, we only support DP and Thunderbolt alt modes. When the modal flag is set pre-emptively, we will fail the TDA.2.2.3: BMC-PROT-SEQ-DRSWAP compliance test. This is because we trigger a hard reset if the modal flag is set and we receive a data role swap request. BUG=b:180764800,b:159946351,b:181386294 BRANCH=None TEST=Verifed that TDA.2.2.3: BMC-PROT-SEQ-DRSWAP passes on quiche Signed-off-by: Scott Collyer Change-Id: I4ae527903859e8ffdb01f355606c5d0f7d177def Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751329 Commit-Queue: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Abe Levkoy --- common/usb_pd_alt_mode_dfp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common/usb_pd_alt_mode_dfp.c') diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index 1c683145f1..c671616da6 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -250,10 +250,12 @@ uint32_t pd_dfp_enter_mode(int port, enum tcpm_transmit_type type, /* * Strictly speaking, this should only happen when the request * has been ACKed. - * TODO(b/159854667): Redo setting the enter mode flag to incorporate - * it into the DP state machine. + * For TCPMV1, still set modal flag pre-emptively. For TCPMv2, the modal + * flag is set when the ENTER command is ACK'd for each alt mode that is + * supported. */ - pd_set_dfp_enter_mode_flag(port, true); + if (IS_ENABLED(CONFIG_USB_PD_TCPMV1)) + pd_set_dfp_enter_mode_flag(port, true); /* SVDM to send to UFP for mode entry */ return VDO(modep->fx->svid, 1, CMD_ENTER_MODE | VDO_OPOS(modep->opos)); -- cgit v1.2.1