summaryrefslogtreecommitdiff
path: root/common/usbc/usb_tc_drp_acc_trysrc_sm.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/usbc/usb_tc_drp_acc_trysrc_sm.c')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index fad4c0cb5d..1ed6fdfe52 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1810,12 +1810,7 @@ static void pd_update_dual_role_config(int port)
* Change to sink if port is currently a source AND (new DRP
* state is force sink OR new DRP state is toggle off and we are
* in the source disconnected state).
- *
- * Force a debug detach in case there was an incomplete debug
- * connection in progress.
*/
- if (get_state_tc(port) != TC_ATTACHED_SRC)
- tcpm_debug_detach(port);
set_state_tc(port, TC_UNATTACHED_SNK);
} else if (tc[port].power_role == PD_ROLE_SINK &&
drp_state[port] == PD_DRP_FORCE_SOURCE) {
@@ -1823,8 +1818,6 @@ static void pd_update_dual_role_config(int port)
* Change to source if port is currently a sink and the
* new DRP state is force source.
*/
- if (get_state_tc(port) != TC_ATTACHED_SNK)
- tcpm_debug_detach(port);
set_state_tc(port, TC_UNATTACHED_SRC);
}
}
@@ -2151,7 +2144,12 @@ static void tc_unattached_snk_entry(const int port)
* ground through Rd.
*
* Restore default current limit Rp in case we swap to source
+ *
+ * Run any debug detaches needed before setting CC, as some TCPCs may
+ * require we set CC Open before changing power roles with a debug
+ * accessory.
*/
+ tcpm_debug_detach(port);
typec_select_pull(port, TYPEC_CC_RD);
typec_select_src_current_limit_rp(port, CONFIG_USB_PD_PULLUP);
typec_update_cc(port);
@@ -2701,7 +2699,12 @@ static void tc_unattached_src_entry(const int port)
* ground through Rp.
*
* Restore default current limit Rp.
+ *
+ * Run any debug detaches needed before setting CC, as some TCPCs may
+ * require we set CC Open before changing power roles with a debug
+ * accessory.
*/
+ tcpm_debug_detach(port);
typec_select_pull(port, TYPEC_CC_RP);
typec_select_src_current_limit_rp(port, CONFIG_USB_PD_PULLUP);
typec_update_cc(port);