From c6e463edc2671444785a4b4db5e5b4cca465da51 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Wed, 6 Oct 2021 14:47:29 -0700 Subject: PS8xxx: Move the delay before Vconn shutdown to PS8xxx driver This workaround is PS8xxx chip specific. Move it from the general TCPCI driver to the PS8xxx driver. BRANCH=Trogdor BUG=b:185202064, b:183586640 TEST=Verified the dock detection: * Insert the dock to the Type-C port and shutdown the device; * Press powerbutton to power on the device; * Use lsusb command, list can not find the dock information; * The dock can be found. Change-Id: I33b4d0649c534735cf20e38831757449dd03ff27 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3209650 Reviewed-by: Diana Z --- driver/tcpm/ps8xxx.c | 16 +++++++++++++++- driver/tcpm/tcpci.c | 9 --------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 4643c669c0..11551b1a7c 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -895,6 +895,20 @@ static int ps8xxx_tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1, return tcpci_tcpm_get_cc(port, cc1, cc2); } +static int ps8xxx_tcpm_set_vconn(int port, int enable) +{ + /* + * Add delay of writing TCPC_REG_POWER_CTRL makes + * CC status being judged correctly when disable VCONN. + * This may be a PS8XXX firmware issue, Parade is still trying. + * https://partnerissuetracker.corp.google.com/issues/185202064 + */ + if (!enable) + msleep(PS8XXX_VCONN_TURN_OFF_DELAY_US); + + return tcpci_tcpm_set_vconn(port, enable); +} + const struct tcpm_drv ps8xxx_tcpm_drv = { .init = ps8xxx_tcpm_init, .release = ps8xxx_tcpm_release, @@ -908,7 +922,7 @@ const struct tcpm_drv ps8xxx_tcpm_drv = { #ifdef CONFIG_USB_PD_DECODE_SOP .sop_prime_enable = tcpci_tcpm_sop_prime_enable, #endif - .set_vconn = tcpci_tcpm_set_vconn, + .set_vconn = ps8xxx_tcpm_set_vconn, .set_msg_header = tcpci_tcpm_set_msg_header, .set_rx_enable = tcpci_tcpm_set_rx_enable, .get_message_raw = tcpci_tcpm_get_message_raw, diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 1e08e0967d..e22a284a1a 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -661,15 +661,6 @@ int tcpci_tcpm_set_vconn(int port, int enable) reg &= ~TCPC_REG_POWER_CTRL_VCONN(1); reg |= TCPC_REG_POWER_CTRL_VCONN(enable); - /* - * Add delay of writing TCPC_REG_POWER_CTRL makes - * CC status being judged correctly when disable VCONN. - * This may be a PS8XXX firmware issue, Parade is still trying. - * https://partnerissuetracker.corp.google.com/issues/185202064 - */ - if (!enable) - msleep(PS8XXX_VCONN_TURN_OFF_DELAY_US); - return tcpc_write(port, TCPC_REG_POWER_CTRL, reg); } -- cgit v1.2.1