diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/build.mk | 1 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 38 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.h | 10 |
3 files changed, 47 insertions, 2 deletions
diff --git a/driver/build.mk b/driver/build.mk index 498e31fe6b..f454661743 100644 --- a/driver/build.mk +++ b/driver/build.mk @@ -114,6 +114,7 @@ driver-$(CONFIG_USB_PD_TCPM_ANX74XX)+=tcpm/anx74xx.o 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_PS8705)+=tcpm/ps8xxx.o driver-$(CONFIG_USB_PD_TCPM_PS8805)+=tcpm/ps8xxx.o driver-$(CONFIG_USB_PD_TCPM_PS8815)+=tcpm/ps8xxx.o diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 787489cf2a..0147739d02 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -20,6 +20,7 @@ #include "usb_pd.h" #if !defined(CONFIG_USB_PD_TCPM_PS8751) && \ + !defined(CONIFG_USB_PD_TCPM_PS8705) && \ !defined(CONFIG_USB_PD_TCPM_PS8805) && \ !defined(CONFIG_USB_PD_TCPM_PS8815) #error "Unsupported PS8xxx TCPC." @@ -170,7 +171,8 @@ static int ps8xxx_get_chip_info(int port, int live, } -#if defined(CONFIG_USB_PD_TCPM_PS8751) || defined(CONFIG_USB_PD_TCPM_PS8805) +#if defined(CONFIG_USB_PD_TCPM_PS8751) || defined(CONFIG_USB_PD_TCPM_PS8805) \ + || defined(CONFIG_USB_PD_TCPM_PS8705) /* * 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. @@ -193,7 +195,7 @@ 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 */ +#endif /* CONFIG_USB_PD_TCPM_PS8751 || CONFIG_USB_PD_TCPM_PS8[78]05 */ #ifdef CONFIG_USB_PD_TCPM_PS8815 static int ps8xxx_dci_disable(int port) @@ -230,6 +232,38 @@ static int ps8xxx_dci_disable(int port) } #endif /* CONFIG_USB_PD_TCPM_PS8805 */ +#ifdef CONFIG_USB_PD_TCPM_PS8705 +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, + ®val); + 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 = p3_addr - + (PS8751_I2C_ADDR1_FLAGS - PS8751_I2C_ADDR1_P1_FLAGS); + rv = ps8xxx_addr_dci_disable(port, p1_addr, + PS8705_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_PS8705 */ + #ifdef CONFIG_USB_PD_TCPM_PS8751 static int ps8xxx_dci_disable(int port) { diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h index f030ea2724..708cc0d382 100644 --- a/driver/tcpm/ps8xxx.h +++ b/driver/tcpm/ps8xxx.h @@ -57,8 +57,18 @@ #define PS8XXX_REG_MUX_USB_C2SS_HS_THRESHOLD 0xE8 #define PS8751_REG_MUX_USB_DCI_CFG 0xED +#elif defined(CONFIG_USB_PD_TCPM_PS8705) +/* Vendor defined registers */ +/* NOTE: The Product ID will read as 0x8803 if the firmware has malfunctioned */ +#define PS8XXX_PRODUCT_ID 0x8705 + +#define PS8705_P1_REG_MUX_USB_DCI_CFG 0x4B +/* NOTE: The revision will read as 0x00 if the firmware has malfunctioned. */ +#define FW_VER_REG 0x82 + #elif defined(CONFIG_USB_PD_TCPM_PS8805) /* Vendor defined registers */ +/* NOTE: The Product ID will read as 0x8803 if the firmware has malfunctioned */ #define PS8XXX_PRODUCT_ID 0x8805 #define PS8805_P1_REG_MUX_USB_DCI_CFG 0x4B |