summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2019-12-16 21:44:21 -0800
committerCommit Bot <commit-bot@chromium.org>2020-09-11 01:46:06 +0000
commit3f5511665af11ff9b027768d03b0b4b65fa3bdd3 (patch)
tree4f447f7fa10f6111804e06b3d83b580c22896c5f
parent676b2b217dce1e9b15675ea69f3f07757451228e (diff)
downloadchrome-ec-3f5511665af11ff9b027768d03b0b4b65fa3bdd3.tar.gz
ps8xxx: add support for the ps8815
this adds support for the ps8815 variant of the parade TCPC. this chip is very similar to its predecessors like the ps8751 and ps8805 and can be supported by the same driver. at this point, the TCPM can talk to the chip but we don't properly detect chargers - the CC line states seem wrong and CC status changes do not trigger an ALERT in the ps8815. BRANCH=none BUG=b:144397088,b:147459088 TEST=EC detects the chip on boot. Change-Id: If86abd1fa21cf8f33f28c4ce89050b29e9408532 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1969524 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2392236 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Commit-Queue: Edward Hill <ecgh@chromium.org>
-rw-r--r--driver/build.mk1
-rw-r--r--driver/tcpm/ps8xxx.c14
-rw-r--r--driver/tcpm/ps8xxx.h16
-rw-r--r--include/config.h1
4 files changed, 25 insertions, 7 deletions
diff --git a/driver/build.mk b/driver/build.mk
index 9b3b986e6a..498e31fe6b 100644
--- a/driver/build.mk
+++ b/driver/build.mk
@@ -115,6 +115,7 @@ driver-$(CONFIG_USB_PD_TCPM_ANX7688)+=tcpm/anx7688.o
driver-$(CONFIG_USB_PD_TCPM_ANX7447)+=tcpm/anx7447.o
driver-$(CONFIG_USB_PD_TCPM_PS8751)+=tcpm/ps8xxx.o
driver-$(CONFIG_USB_PD_TCPM_PS8805)+=tcpm/ps8xxx.o
+driver-$(CONFIG_USB_PD_TCPM_PS8815)+=tcpm/ps8xxx.o
# USB mux high-level driver
driver-$(CONFIG_USBC_SS_MUX)+=usb_mux.o
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index c2e647e693..787489cf2a 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -9,6 +9,7 @@
* Supported TCPCs:
* - PS8751
* - PS8805
+ * - PS8815
*/
#include "common.h"
@@ -19,7 +20,8 @@
#include "usb_pd.h"
#if !defined(CONFIG_USB_PD_TCPM_PS8751) && \
- !defined(CONFIG_USB_PD_TCPM_PS8805)
+ !defined(CONFIG_USB_PD_TCPM_PS8805) && \
+ !defined(CONFIG_USB_PD_TCPM_PS8815)
#error "Unsupported PS8xxx TCPC."
#endif
@@ -168,6 +170,7 @@ static int ps8xxx_get_chip_info(int port, int live,
}
+#if defined(CONFIG_USB_PD_TCPM_PS8751) || 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.
@@ -190,6 +193,15 @@ static int ps8xxx_addr_dci_disable(int port, int i2c_addr, int i2c_reg)
}
return EC_SUCCESS;
}
+#endif /* CONFIG_USB_PD_TCPM_PS8751 || CONFIG_USB_PD_TCPM_PS8805 */
+
+#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
static int ps8xxx_dci_disable(int port)
diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h
index fc474f6a2b..f030ea2724 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -41,6 +41,10 @@
#define PS8XXX_REG_MUX_USB_DCI_CFG_MODE_MASK 0xC0
#define PS8XXX_REG_MUX_USB_DCI_CFG_MODE_OFF 0x80
+#define MUX_IN_HPD_ASSERTION_REG 0xD0
+#define IN_HPD (1 << 0)
+#define HPD_IRQ (1 << 1)
+
#if defined(CONFIG_USB_PD_TCPM_PS8751)
/* Vendor defined registers */
#define PS8XXX_PRODUCT_ID 0x8751
@@ -48,9 +52,6 @@
#define FW_VER_REG 0x90
#define PS8XXX_REG_VENDOR_ID_L 0x00
#define PS8XXX_REG_VENDOR_ID_H 0x01
-#define MUX_IN_HPD_ASSERTION_REG 0xD0
-#define IN_HPD (1 << 0)
-#define HPD_IRQ (1 << 1)
#define PS8XXX_REG_MUX_DP_EQ_CONFIGURATION 0xD3
#define PS8XXX_REG_MUX_USB_C2SS_EQ 0xE7
#define PS8XXX_REG_MUX_USB_C2SS_HS_THRESHOLD 0xE8
@@ -62,9 +63,12 @@
#define PS8805_P1_REG_MUX_USB_DCI_CFG 0x4B
#define FW_VER_REG 0x82
-#define MUX_IN_HPD_ASSERTION_REG 0xD0
-#define IN_HPD (1 << 0)
-#define HPD_IRQ (1 << 1)
+
+#elif defined(CONFIG_USB_PD_TCPM_PS8815)
+/* Vendor defined registers */
+#define PS8XXX_PRODUCT_ID 0x8815
+
+#define FW_VER_REG 0x82
#endif
diff --git a/include/config.h b/include/config.h
index 8d29a7c95a..512972fbc7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3400,6 +3400,7 @@
#undef CONFIG_USB_PD_TCPM_ANX7688
#undef CONFIG_USB_PD_TCPM_PS8751
#undef CONFIG_USB_PD_TCPM_PS8805
+#undef CONFIG_USB_PD_TCPM_PS8815
#undef CONFIG_USB_PD_TCPM_MT6370
#undef CONFIG_USB_PD_TCPM_TUSB422