summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-04-22 18:48:31 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-24 02:01:34 +0000
commit8b94f96b9c92e181f1ecb58840fddaa0ca2075ae (patch)
tree663a05705ca019c9a15f67568c9254c1fbf6f974
parentb89d113c93ed99088275416a0f181cd2f7af880c (diff)
downloadchrome-ec-8b94f96b9c92e181f1ecb58840fddaa0ca2075ae.tar.gz
TCPMv2: Cleanup: remove TC_FLAGS_AUTO_TOGGLE_SUPPORTED
Calling tcpm_auto_toggle_supported() directly is simpler and avoids bugs like crrev.com/c/2144482 BUG=none BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I93c4c616e19756bd596bfbf0097f7eff2fb2d15d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2160995 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 586404cb42..d77d4c22a1 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -78,19 +78,14 @@
#define TC_FLAGS_DISC_IDENT_IN_PROGRESS BIT(20)
/* Flag to note we should check for connection */
#define TC_FLAGS_CHECK_CONNECTION BIT(21)
-/* Flag to note the TCPM supports auto toggle */
-#define TC_FLAGS_AUTO_TOGGLE_SUPPORTED BIT(22)
/* Flag to note pd_set_suspend SUSPEND state */
-#define TC_FLAGS_SUSPEND BIT(23)
+#define TC_FLAGS_SUSPEND BIT(22)
/*
- * Clear all flags except TC_FLAGS_AUTO_TOGGLE_SUPPORTED,
- * TC_FLAGS_LPM_ENGAGED, and TC_FLAGS_SUSPEND.
+ * Clear all flags except TC_FLAGS_LPM_ENGAGED and TC_FLAGS_SUSPEND.
*/
#define CLR_ALL_BUT_LPM_FLAGS(port) (TC_CLR_FLAG(port, \
- ~(TC_FLAGS_AUTO_TOGGLE_SUPPORTED | \
- TC_FLAGS_LPM_ENGAGED | \
- TC_FLAGS_SUSPEND)))
+ ~(TC_FLAGS_LPM_ENGAGED | TC_FLAGS_SUSPEND)))
/* 100 ms is enough time for any TCPC transaction to complete. */
#define PD_LPM_DEBOUNCE_US (100 * MSEC)
@@ -1016,15 +1011,6 @@ void tc_state_init(int port)
pd_set_dual_role_no_wakeup(port, PD_DRP_TOGGLE_OFF);
else /* CHIPSET_STATE_ON */
pd_set_dual_role_no_wakeup(port, PD_DRP_TOGGLE_ON);
-
-#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
- /*
- * Some TCPCs may not support DRP Auto Toggle, so query the
- * query the TCPC for DRP Auto toggle support.
- */
- if (tcpm_auto_toggle_supported(port))
- TC_SET_FLAG(port, TC_FLAGS_AUTO_TOGGLE_SUPPORTED);
-#endif
}
enum pd_cable_plug tc_get_cable_plug(int port)
@@ -1620,7 +1606,7 @@ static void tc_unattached_snk_run(const int port)
* not already auto toggling.
*/
if (drp_state[port] == PD_DRP_TOGGLE_ON &&
- TC_CHK_FLAG(port, TC_FLAGS_AUTO_TOGGLE_SUPPORTED) &&
+ tcpm_auto_toggle_supported(port) &&
cc_is_open(cc1, cc2)) {
/*
* We are disconnected and going to DRP
@@ -2331,7 +2317,7 @@ static void tc_unattached_src_run(const int port)
* Attempt TCPC auto DRP toggle
*/
else if (drp_state[port] == PD_DRP_TOGGLE_ON &&
- TC_CHK_FLAG(port, TC_FLAGS_AUTO_TOGGLE_SUPPORTED) &&
+ tcpm_auto_toggle_supported(port) &&
cc_is_open(cc1, cc2)) {
/*
* We are disconnected and going to DRP