diff options
author | Andrew McRae <amcrae@google.com> | 2020-06-15 12:35:44 +1000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-16 02:56:58 +0000 |
commit | 90372fc63f5f49769899c5b6837af8a74710f7f5 (patch) | |
tree | 123ea029436c8ba09351eb8c610716841d2e3ae0 /common/usbc | |
parent | 08a39ff9dbb8a1e6417ed3b55eb35cc9850d5057 (diff) | |
download | chrome-ec-90372fc63f5f49769899c5b6837af8a74710f7f5.tar.gz |
TCPMv2: Check for mode discovery complete before switching
If port discovery is run multiple times, because of power state changes
to the AP, DP alt modes are not detected because dpm_attempt_mode_entry
is run after discovery is initialised, but before discovery completes,
and so no modes are detected, and no attempt is made thereafter.
Also correct an unsigned compare against 0.
BUG=b:158813138
TEST=Confirm that type-C monitors now work
BRANCH=none
Change-Id: Idef39ad97d6af2952474e8edcebd409f8324fa80
Signed-off-by: Andrew McRae <amcrae@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2245580
Reviewed-by: Andrew McRae <amcrae@chromium.org>
Commit-Queue: Andrew McRae <amcrae@chromium.org>
Tested-by: Andrew McRae <amcrae@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r-- | common/usbc/usb_pd_dpm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c index adfb64d8fd..7ea44d169e 100644 --- a/common/usbc/usb_pd_dpm.c +++ b/common/usbc/usb_pd_dpm.c @@ -70,7 +70,7 @@ void dpm_vdm_naked(int port, enum tcpm_transmit_type type, uint16_t svid, void dpm_attempt_mode_entry(int port) { - uint32_t vdo_count; + int vdo_count; uint32_t vdm[VDO_MAX_SIZE]; if (dpm[port].mode_entry_done) @@ -78,6 +78,13 @@ void dpm_attempt_mode_entry(int port) if (pd_get_data_role(port) != PD_ROLE_DFP) return; + /* + * If discovery has not occurred for modes, do not attempt to switch + * to alt mode. + */ + if (pd_get_svids_discovery(port, TCPC_TX_SOP) != PD_DISC_COMPLETE || + pd_get_modes_discovery(port, TCPC_TX_SOP) != PD_DISC_COMPLETE) + return; /* * Check if we even discovered a DisplayPort mode; if not, just |