summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-06-15 06:01:04 -0600
committerCommit Bot <commit-bot@chromium.org>2020-06-19 04:07:14 +0000
commit9e5d34d063ccdb0b3841e828cbdbcb977be161df (patch)
tree49f4b55fe39622b9bea06a2f1444d3162d3a889a
parentb1ad45990b93bee6f761ba4102423b748ead0e5b (diff)
downloadchrome-ec-9e5d34d063ccdb0b3841e828cbdbcb977be161df.tar.gz
tcpci: DRP enable should set role based on version
TCPCI R1 wants both CC lines to be Rd on entry to auto toggle TCPCI R2 wants both CC lines to be Rp on entry to auto toggle Both suggest setting the Rp Value to 0 for the smallest power usage when toggling Verified on Trembyle NCT3807 TCPC which is TCPCI R2 BUG=none BRANCH=none TEST=verify basic USB-C Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I5bc0d88c62bc47f78a622f3846839f7d2be97c6b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250090 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--driver/tcpm/tcpci.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 3d9ca38d06..1993c52a65 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -467,18 +467,25 @@ int tcpci_set_role_ctrl(int port, int toggle, int rp, int pull)
int tcpci_tcpc_drp_toggle(int port)
{
int rv;
+ enum tcpc_cc_pull pull;
+
/*
* Set auto drp toggle
- * NOTE: This should be done according to the last connection
- * that we are disconnecting from. TCPCI Rev 2 spec figures
- * 4-21 and 4-22 show:
- * SNK => DRP should set CC lines to Rd/Rd
- * SRC => DRP should set CC lines to Rp/Rp
- * The function tcpci_tcpc_set_connection performs this action
- * and it may be wise as chips can use this to make this the
- * standard and remove this set_role_ctrl call.
+ *
+ * Set RC.DRP=1b (DRP)
+ * Set RC.RpValue=00b (smallest Rp to save power)
+ * Set RC.CC1=(Rp) or (Rd)
+ * Set RC.CC2=(Rp) or (Rd)
+ *
+ * TCPCI r1 wants both lines to be set to Rd
+ * TCPCI r2 wants both lines to be set to Rp
+ *
+ * Set the Rp Value to be the minimal to save power
*/
- rv = tcpci_set_role_ctrl(port, 1, tcpci_get_cached_rp(port), TYPEC_CC_RD);
+ pull = (tcpc_config[port].flags & TCPC_FLAGS_TCPCI_REV2_0)
+ ? TYPEC_CC_RP : TYPEC_CC_RD;
+
+ rv = tcpci_set_role_ctrl(port, 1, TYPEC_RP_USB, pull);
if (rv)
return rv;