summaryrefslogtreecommitdiff
path: root/common/usbc
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2020-02-12 10:24:53 -0700
committerCommit Bot <commit-bot@chromium.org>2020-02-13 00:58:36 +0000
commit10ff776b895124ec06b81bd26ec3b2d99f834ece (patch)
treeec67d71a935a6e541ba07a822fc7c29bb62be60f /common/usbc
parent88808c3dda819f9da22272850d2b56ab1e538c9f (diff)
downloadchrome-ec-10ff776b895124ec06b81bd26ec3b2d99f834ece.tar.gz
tcpmv2: make connect after auto-toggle driver specific
nct38xx needs to have the cached polarity set in order to leave DRP mode without going back to an OPEN line. Other TCPCI implementations break when this happens. So moved it to a driver specific function instead TODO(b/149415919): Consider trying to clear the DRP mode instead of changing the polarity BUG=b:149311437 BRANCH=none TEST=verify charger functions on Trogdor Change-Id: I5092a468d860b573a6e5acaf7c013b3425916efb Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2050336 Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 51e2938772..35b41c0349 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -767,6 +767,11 @@ enum tcpc_cc_polarity pd_get_polarity(int port)
return tc[port].polarity;
}
+void pd_set_polarity(int port, enum tcpc_cc_polarity polarity)
+{
+ tc[port].polarity = polarity;
+}
+
enum pd_data_role pd_get_data_role(int port)
{
return tc[port].data_role;
@@ -2873,26 +2878,22 @@ static void tc_drp_auto_toggle_run(const int port)
break;
case DRP_TC_UNATTACHED_SNK:
/*
- * The TCPCI comes out of auto toggle with a prospective
- * connection. It is expecting us to set the CC lines to
- * what it is thinking is best or it goes direct back to
- * unattached. So get the SNK polarity to be able to setup
- * the CC lines to avoid this.
+ * Some TCPCI compliant TCPCs come out of auto toggle with
+ * a prospective connection. They are expecting us to set
+ * the CC lines to what it is thinking is best or it goes
+ * directly back to unattached.
*/
- tc[port].polarity = get_snk_polarity(cc1, cc2);
-
+ tcpm_auto_toggle_connection(port, cc1, cc2);
set_state_tc(port, TC_ATTACH_WAIT_SNK);
break;
case DRP_TC_UNATTACHED_SRC:
/*
- * The TCPCI comes out of auto toggle with a prospective
- * connection. It is expecting us to set the CC lines to
- * what it is thinking is best or it goes direct back to
- * unattached. So get the SRC polarity to be able to setup
- * the CC lines to avoid this.
+ * Some TCPCI compliant TCPCs come out of auto toggle with
+ * a prospective connection. They are expecting us to set
+ * the CC lines to what it is thinking is best or it goes
+ * directly back to unattached.
*/
- tc[port].polarity = get_src_polarity(cc1, cc2);
-
+ tcpm_auto_toggle_connection(port, cc1, cc2);
set_state_tc(port, TC_ATTACH_WAIT_SRC);
break;
case DRP_TC_DRP_AUTO_TOGGLE: