summaryrefslogtreecommitdiff
path: root/driver/tcpm
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-05-14 21:37:26 -0600
committerCommit Bot <commit-bot@chromium.org>2020-05-19 04:33:42 +0000
commit5e32f948d370fff182616bd987ffdc794f6858a6 (patch)
tree00d6e3de91e67397f1257acdbfdfb167f53fad04 /driver/tcpm
parent825289a97d5341128c9baab650b9d9d8b4ff7c7b (diff)
downloadchrome-ec-5e32f948d370fff182616bd987ffdc794f6858a6.tar.gz
tcpc: AutoDischarge can be enabled on any connection wake
I thought AutoDischarge could only be enabled when waking if DRP was enabled. This is not the case and I am removing the unnecessary portions of code dealing with this distinction. BUG=none BRANCH=none TEST=verify connections continue to work Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iddea93a0749842f366b046594f9abb936b1ec523 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2202564 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'driver/tcpm')
-rw-r--r--driver/tcpm/tcpci.c17
-rw-r--r--driver/tcpm/tcpci.h3
-rw-r--r--driver/tcpm/tcpm.h7
3 files changed, 9 insertions, 18 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index d45b1323c4..4cc686f92c 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -409,21 +409,11 @@ int tcpci_tcpc_drp_toggle(int port)
int tcpci_tcpc_set_connection(int port,
enum tcpc_cc_pull pull,
- int connect,
- int *prev_drp)
+ int connect)
{
int rv;
int role;
- /* Get the ROLE CONTROL value */
- rv = tcpc_read(port, TCPC_REG_ROLE_CTRL, &role);
- if (rv)
- return rv;
-
- /* if optional prev_drp is present then save the current DRP state */
- if (prev_drp)
- *prev_drp = !!(role & TCPC_REG_ROLE_CTRL_DRP_MASK);
-
/*
* Disconnecting will set the following and then return
* Set RC.DRP=1b (DRP)
@@ -436,6 +426,11 @@ int tcpci_tcpc_set_connection(int port,
return EC_SUCCESS;
}
+ /* Get the ROLE CONTROL value */
+ rv = tcpc_read(port, TCPC_REG_ROLE_CTRL, &role);
+ if (rv)
+ return rv;
+
if (role & TCPC_REG_ROLE_CTRL_DRP_MASK) {
enum tcpc_cc_pull cc1_pull, cc2_pull;
enum tcpc_cc_voltage_status cc1, cc2;
diff --git a/driver/tcpm/tcpci.h b/driver/tcpm/tcpci.h
index 9c9fa111e9..d400c4dee2 100644
--- a/driver/tcpm/tcpci.h
+++ b/driver/tcpm/tcpci.h
@@ -226,8 +226,7 @@ int tcpci_tcpm_release(int port);
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
int tcpci_set_role_ctrl(int port, int toggle, int rp, int pull);
int tcpci_tcpc_drp_toggle(int port);
-int tcpci_tcpc_set_connection(int port, enum tcpc_cc_pull pull,
- int connect, int *prev_drp);
+int tcpci_tcpc_set_connection(int port, enum tcpc_cc_pull pull, int connect);
#endif
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
int tcpci_enter_low_power_mode(int port);
diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h
index c62235eec9..f97bb39b9c 100644
--- a/driver/tcpm/tcpm.h
+++ b/driver/tcpm/tcpm.h
@@ -180,16 +180,13 @@ static inline int tcpm_set_cc(int port, int pull)
static inline int tcpm_set_connection(int port,
enum tcpc_cc_pull pull,
- int connect,
- int *prev_drp)
+ int connect)
{
const struct tcpm_drv *tcpc = tcpc_config[port].drv;
if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) &&
tcpc->set_connection)
- return tcpc->set_connection(port, pull, connect, prev_drp);
- else if (prev_drp)
- *prev_drp = 0;
+ return tcpc->set_connection(port, pull, connect);
return EC_SUCCESS;
}