summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <Devin.Lu@quantatw.com>2020-07-22 21:36:43 +0800
committerCommit Bot <commit-bot@chromium.org>2020-09-11 01:46:21 +0000
commitfd13ea525b40d38d3d0ae56dd23f098b3f867605 (patch)
tree7149ca40ff80ca785bc6b24433b1e9f989feee6e
parent37f82f5ef4bfd5b5aecb911aa466ff44834232eb (diff)
downloadchrome-ec-fd13ea525b40d38d3d0ae56dd23f098b3f867605.tar.gz
driver/tcpm/ps8xxx: Consistent DCI disable method
This patch make consistent with DCI disable method for PS8705/PS8805/PS8815, they are in the similar chip group. BUG=b:161202452 BRANCH=none TEST=make buildall -j. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ia919dab9fb6afd72e3b693d94fe8abee628e2f40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2313056 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393397 Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r--driver/tcpm/ps8xxx.c65
1 files changed, 19 insertions, 46 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index fce7795f13..e7e561e4ae 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -21,9 +21,9 @@
#include "timer.h"
#include "usb_pd.h"
-#if !defined(CONFIG_USB_PD_TCPM_PS8751) && \
+#if !defined(CONFIG_USB_PD_TCPM_PS8705) && \
+ !defined(CONFIG_USB_PD_TCPM_PS8751) && \
!defined(CONFIG_USB_PD_TCPM_PS8755) && \
- !defined(CONFIG_USB_PD_TCPM_PS8705) && \
!defined(CONFIG_USB_PD_TCPM_PS8805) && \
!defined(CONFIG_USB_PD_TCPM_PS8815)
#error "Unsupported PS8xxx TCPC."
@@ -174,8 +174,10 @@ static int ps8xxx_get_chip_info(int port, int live,
}
-#if defined(CONFIG_USB_PD_TCPM_PS8751) || defined(CONFIG_USB_PD_TCPM_PS8805) \
- || defined(CONFIG_USB_PD_TCPM_PS8705) || defined(CONFIG_USB_PD_TCPM_PS8755)
+#if defined(CONFIG_USB_PD_TCPM_PS8705) || \
+ defined(CONFIG_USB_PD_TCPM_PS8751) || \
+ defined(CONFIG_USB_PD_TCPM_PS8755) || \
+ defined(CONFIG_USB_PD_TCPM_PS8805)
/*
* DCI is enabled by default and burns about 40 mW when the port is in
* USB2 mode or when a C-to-A dongle is attached, so force it off.
@@ -200,15 +202,9 @@ static int ps8xxx_addr_dci_disable(int port, int i2c_addr, int i2c_reg)
}
#endif /* CONFIG_USB_PD_TCPM_PS875[15] || CONFIG_USB_PD_TCPM_PS8[78]05 */
-#ifdef CONFIG_USB_PD_TCPM_PS8815
-static int ps8xxx_dci_disable(int port)
-{
- /* DCI is disabled on the ps8815 */
- return EC_SUCCESS;
-}
-#endif /* CONFIG_USB_PD_TCPM_PS8815 */
-
-#ifdef CONFIG_USB_PD_TCPM_PS8805
+#if defined(CONFIG_USB_PD_TCPM_PS8705) || \
+ defined(CONFIG_USB_PD_TCPM_PS8755) || \
+ defined(CONFIG_USB_PD_TCPM_PS8805)
static int ps8xxx_dci_disable(int port)
{
int p1_addr;
@@ -232,43 +228,12 @@ static int ps8xxx_dci_disable(int port)
PS8XXX_P1_REG_MUX_USB_DCI_CFG);
/*
- * PS8805 will automatically re-assert bit:0 on the
+ * PS8705/PS8755/PS8805 will automatically re-assert bit:0 on the
* PS8XXX_REG_I2C_DEBUGGING_ENABLE register.
*/
return rv;
}
-#endif /* CONFIG_USB_PD_TCPM_PS8805 */
-
-#if defined(CONFIG_USB_PD_TCPM_PS8705) || defined(CONFIG_USB_PD_TCPM_PS8755)
-static int ps8xxx_dci_disable(int port)
-{
- int p1_addr;
- int p3_addr;
- int regval;
- int rv;
-
- /* Enable access to debug pages. */
- p3_addr = tcpc_config[port].i2c_info.addr_flags;
- rv = tcpc_addr_read(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
- &regval);
- if (rv)
- return rv;
-
- rv = tcpc_addr_write(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
- PS8XXX_REG_I2C_DEBUGGING_ENABLE_ON);
-
- /* Disable Auto DCI */
- p1_addr = PS8751_P3_TO_P1_FLAGS(p3_addr);
- rv = ps8xxx_addr_dci_disable(port, p1_addr,
- PS8XXX_P1_REG_MUX_USB_DCI_CFG);
-
- /* Turn off access to debug pages. */
- rv |= tcpc_addr_write(port, p3_addr, PS8XXX_REG_I2C_DEBUGGING_ENABLE,
- PS8XXX_REG_I2C_DEBUGGING_ENABLE_OFF);
-
- return rv;
-}
-#endif /* CONFIG_USB_PD_TCPM_PS87[05]5 */
+#endif /* CONFIG_USB_PD_TCPM_PS8755 || CONFIG_USB_PD_TCPM_PS8[78]05 */
#ifdef CONFIG_USB_PD_TCPM_PS8751
static int ps8xxx_dci_disable(int port)
@@ -281,6 +246,14 @@ static int ps8xxx_dci_disable(int port)
}
#endif /* CONFIG_USB_PD_TCPM_PS8751 */
+#ifdef CONFIG_USB_PD_TCPM_PS8815
+static int ps8xxx_dci_disable(int port)
+{
+ /* DCI is disabled on the ps8815 */
+ return EC_SUCCESS;
+}
+#endif /* CONFIG_USB_PD_TCPM_PS8815 */
+
static int ps8xxx_tcpm_init(int port)
{
int status;