diff options
author | Keith Short <keithshort@chromium.org> | 2021-02-08 16:03:08 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-09 21:29:59 +0000 |
commit | 37eb042b7db814887619c172ce9bd29cb0680785 (patch) | |
tree | a36f3c752037c22c43cf56e17c40fae23864c18d /common/usbc/usb_tc_drp_acc_trysrc_sm.c | |
parent | 089d99ce717b5149b401df93693551fbf3126681 (diff) | |
download | chrome-ec-37eb042b7db814887619c172ce9bd29cb0680785.tar.gz |
tcpmv2: Update the mux state when PD connection established
The entry in Attached.SNK configures the mux and enables the SuperSpeed
USB pairs are required by the PD spec.
This change reconfigures the mux data role once source caps are received
from the partner. This ensures that SuperSpeed USB pairs are disabled
when a PD capable charger, without USB communication, is connected.
BUG=b:178727224
BRANCH=none
TEST=make buildall
TEST=connect non-PD charger, verify mux state enables USB
TEST=connect PD charger, verify mux state disables USB
TEST=connect Gatkex, verify USB4 entry
TEST=conned DP+USB display. Verify USB and DP entry.
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I16cf82dff7434bddfa867093a6385c19122444db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2683334
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common/usbc/usb_tc_drp_acc_trysrc_sm.c')
-rw-r--r-- | common/usbc/usb_tc_drp_acc_trysrc_sm.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 51277d7bcb..741556a594 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -818,12 +818,26 @@ int tc_is_attached_snk(int port) void tc_pd_connection(int port, int en) { if (en) { + bool new_pd_capable = false; + + if (!TC_CHK_FLAG(port, TC_FLAGS_PARTNER_PD_CAPABLE)) + new_pd_capable = true; + TC_SET_FLAG(port, TC_FLAGS_PARTNER_PD_CAPABLE); /* If a PD device is attached then disable deep sleep */ if (IS_ENABLED(CONFIG_LOW_POWER_IDLE) && !IS_ENABLED(CONFIG_USB_PD_TCPC_ON_CHIP)) { disable_sleep(SLEEP_MASK_USB_PD); } + + /* + * Update the mux state, only when the PD capable flag + * transitions from 0 to 1. This ensures that PD charger + * devices, without data capability are not marked as having + * USB. + */ + if (new_pd_capable) + set_usb_mux_with_current_data_role(port); } else { TC_CLR_FLAG(port, TC_FLAGS_PARTNER_PD_CAPABLE); /* If a PD device isn't attached then enable deep sleep */ |