summaryrefslogtreecommitdiff
path: root/common/usbc/usb_pe_drp_sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/usbc/usb_pe_drp_sm.c')
-rw-r--r--common/usbc/usb_pe_drp_sm.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index e599097f43..655bae4599 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -1580,7 +1580,7 @@ static bool pe_attempt_port_discovery(int port)
*/
if (get_time().val > pe[port].discover_identity_timer) {
if (pd_get_identity_discovery(port, TCPC_TX_SOP_PRIME) ==
- PD_DISC_NEEDED && pe_can_send_sop_prime(port)) {
+ PD_DISC_NEEDED) {
pe[port].tx_type = TCPC_TX_SOP_PRIME;
set_state_pe(port, PE_VDM_IDENTITY_REQUEST_CBL);
return true;
@@ -1604,14 +1604,12 @@ static bool pe_attempt_port_discovery(int port)
set_state_pe(port, PE_INIT_VDM_MODES_REQUEST);
return true;
} else if (pd_get_svids_discovery(port, TCPC_TX_SOP_PRIME)
- == PD_DISC_NEEDED &&
- pe_can_send_sop_prime(port)) {
+ == PD_DISC_NEEDED) {
pe[port].tx_type = TCPC_TX_SOP_PRIME;
set_state_pe(port, PE_INIT_VDM_SVIDS_REQUEST);
return true;
} else if (pd_get_modes_discovery(port, TCPC_TX_SOP_PRIME) ==
- PD_DISC_NEEDED &&
- pe_can_send_sop_prime(port)) {
+ PD_DISC_NEEDED) {
pe[port].tx_type = TCPC_TX_SOP_PRIME;
set_state_pe(port, PE_INIT_VDM_MODES_REQUEST);
return true;
@@ -4767,7 +4765,11 @@ static void pe_vdm_identity_request_cbl_entry(int port)
print_current_state(port);
- if (!tc_is_vconn_src(port)) {
+ if (!pe_can_send_sop_prime(port)) {
+ /*
+ * The parent state already tried to enable SOP' traffic. If it
+ * is still disabled, there's nothing left to try.
+ */
pd_set_identity_discovery(port, pe[port].tx_type, PD_DISC_FAIL);
set_state_pe(port, get_last_state_pe(port));
return;
@@ -5035,7 +5037,11 @@ static void pe_init_vdm_svids_request_entry(int port)
print_current_state(port);
if (pe[port].tx_type == TCPC_TX_SOP_PRIME &&
- !tc_is_vconn_src(port)) {
+ !pe_can_send_sop_prime(port)) {
+ /*
+ * The parent state already tried to enable SOP' traffic. If it
+ * is still disabled, there's nothing left to try.
+ */
pd_set_svids_discovery(port, pe[port].tx_type, PD_DISC_FAIL);
set_state_pe(port, get_last_state_pe(port));
return;
@@ -5133,7 +5139,11 @@ static void pe_init_vdm_modes_request_entry(int port)
print_current_state(port);
if (pe[port].tx_type == TCPC_TX_SOP_PRIME &&
- !tc_is_vconn_src(port)) {
+ !pe_can_send_sop_prime(port)) {
+ /*
+ * The parent state already tried to enable SOP' traffic. If it
+ * is still disabled, there's nothing left to try.
+ */
pd_set_modes_discovery(port, pe[port].tx_type, svid,
PD_DISC_FAIL);
set_state_pe(port, get_last_state_pe(port));
@@ -5230,7 +5240,11 @@ static void pe_vdm_request_dpm_entry(int port)
if ((pe[port].tx_type == TCPC_TX_SOP_PRIME ||
pe[port].tx_type == TCPC_TX_SOP_PRIME_PRIME) &&
- !tc_is_vconn_src(port)) {
+ !pe_can_send_sop_prime(port)) {
+ /*
+ * The parent state already tried to enable SOP' traffic. If it
+ * is still disabled, there's nothing left to try.
+ */
dpm_vdm_naked(port, pe[port].tx_type,
PD_VDO_VID(pe[port].vdm_data[0]),
PD_VDO_CMD(pe[port].vdm_data[0]));