summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-03-29 15:09:31 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-09 02:03:48 +0000
commit458dceca8ca8872b53be893ceab77fa27958707b (patch)
tree4364157f1c11d4b84411cf8a447366a5f9b0d60d
parent4813842d4f1769b171b8831aa19595845261c35f (diff)
downloadchrome-ec-458dceca8ca8872b53be893ceab77fa27958707b.tar.gz
TCPMv2: Detach from debug devices in Unattached entry
Call debug detach routine on the TCPC before setting our terminations in Unattached.SNK/SRC. This will cover more code paths than attempting to ensure we call the debug detach from every possible chipset transition, sysjump, etc. Note we should still debug detach in Attached exits when PR swapping. BRANCH=None BUG=b:183619502 TEST=on Galith, confirm that: - firmware_UserRequestRecovery passes reliably - board is able to boot with no battery and a charger attached in either port Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I6cef8ce57a569b0e15e1e10b77c830b1c7a55d75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2792690 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2816155 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-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);