diff options
Diffstat (limited to 'common/usbc/usb_tc_drp_acc_trysrc_sm.c')
-rw-r--r-- | common/usbc/usb_tc_drp_acc_trysrc_sm.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 2a5ac25944..45d28687a0 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -2271,6 +2271,19 @@ static void tc_attached_snk_run(const int port) } /* + * From 4.5.2.2.5.2 Exiting from Attached.SNK State: + * + * "A port that is not a Vconn-Powered USB Device and is not in the + * process of a USB PD PR_Swap or a USB PD Hard Reset or a USB PD + * FR_Swap shall transition to Unattached.SNK within tSinkDisconnect + * when Vbus falls below vSinkDisconnect for Vbus operating at or + * below 5 V or below vSinkDisconnectPD when negotiated by USB PD + * to operate above 5 V." + * + * TODO(b/149530538): Use vSinkDisconnectPD when above 5V + */ + + /* * Debounce Vbus before we drop that we are doing a PR_Swap */ if (TC_CHK_FLAG(port, TC_FLAGS_PR_SWAP_IN_PROGRESS) && @@ -2284,7 +2297,7 @@ static void tc_attached_snk_run(const int port) * with the swap and should have Vbus, so re-enable * AutoDischargeDisconnect. */ - if (pd_is_vbus_present(port)) + if (!pd_check_vbus_level(port, VBUS_REMOVED)) tcpm_enable_auto_discharge_disconnect(port, 1); } @@ -2297,7 +2310,7 @@ static void tc_attached_snk_run(const int port) /* * Detach detection */ - if (!pd_is_vbus_present(port)) { + if (pd_check_vbus_level(port, VBUS_REMOVED)) { if (IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP)) { pd_dfp_exit_mode(port, TCPC_TX_SOP, 0, 0); pd_dfp_exit_mode(port, TCPC_TX_SOP_PRIME, 0, 0); @@ -2396,7 +2409,7 @@ static void tc_attached_snk_run(const int port) #else /* CONFIG_USB_PE_SM */ /* Detach detection */ - if (!pd_is_vbus_present(port)) { + if (pd_check_vbus_level(port, VBUS_REMOVED)) { set_state_tc(port, TC_UNATTACHED_SNK); return; } @@ -3331,7 +3344,7 @@ static void tc_ct_attached_snk_run(int port) * transition to CTUnattached.SNK within tSinkDisconnect when VBUS * falls below vSinkDisconnect */ - if (!pd_is_vbus_present(port)) { + if (pd_check_vbus_level(port, VBUS_REMOVED)) { set_state_tc(port, TC_CT_UNATTACHED_SNK); return; } |