diff options
author | Matthew Blecker <matthewb@google.com> | 2020-02-21 14:57:21 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-22 05:38:29 +0000 |
commit | 71f97f2c63ef5e7ad2d88645949efea26c23fb3f (patch) | |
tree | 3ef3575f75be5b0e16438001f8d24695f2b477b2 | |
parent | 589cd65310dbff8c44fb9e5da5b28d49d4094ce5 (diff) | |
download | chrome-ec-71f97f2c63ef5e7ad2d88645949efea26c23fb3f.tar.gz |
ps8xxx: Only apply PS8751 DRP disabled CC status workaround to PS8751.
BRANCH=none
BUG=b:147472779,b:147684491,b:148710467
TEST=make buildall
Change-Id: I8eed7bf86fe7c3e135517aaa31c3315128ca74e1
Signed-off-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2068803
Reviewed-by: caveh jalali <caveh@chromium.org>
-rw-r--r-- | driver/tcpm/ps8xxx.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index ba4a8e324e..177a3ee6f4 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -259,27 +259,28 @@ static int ps8xxx_tcpm_init(int port) return ps8xxx_dci_disable(port); } -static int ps8xxx_get_cc(int port, enum tcpc_cc_voltage_status *cc1, +#ifdef CONFIG_USB_PD_TCPM_PS8751 +/* + * TODO(twawrzynczak): Remove this workaround when no + * longer needed. See: https://issuetracker.google.com/147684491 + * + * This is a workaround for what appears to be a bug in PS8751 firmware + * version 0x44. (Does the bug exist in other PS8751 firmware versions? + * Should this workaround be limited to only 0x44?) + * + * With nothing connected to the port, sometimes after DRP is disabled, + * the CC_STATUS register reads the CC state incorrectly (reading it + * as though a port partner is detected), which ends up confusing + * our TCPM. The workaround for this seems to be a short sleep and + * then re-reading the CC state. In other words, the issue shows up + * as a short glitch or transient, which a dummy read and then a short + * delay will allow the transient to disappear. + */ +static int ps8751_get_gcc(int port, enum tcpc_cc_voltage_status *cc1, enum tcpc_cc_voltage_status *cc2) { int rv; int status; - - /* - * TODO(twawrzynczak): remove this workaround when no - * longer needed, see b/147684491. - * - * This is a workaround for what appears to be a bug in PS8751 firmware - * version 0x44. - * - * With nothing connected to the port, sometimes after DRP is disabled, - * the CC_STATUS register reads the CC state incorrectly (reading it - * as though a port partner is detected), which ends up confusing - * our TCPM. The workaround for this seems to be a short sleep and - * then re-reading the CC state. In other words, the issue shows up - * as a short glitch or transient, which a dummy read and then a short - * delay will allow the transient to disappear. - */ rv = tcpc_read(port, TCPC_REG_CC_STATUS, &status); if (rv) return rv; @@ -289,11 +290,16 @@ static int ps8xxx_get_cc(int port, enum tcpc_cc_voltage_status *cc1, return tcpci_tcpm_get_cc(port, cc1, cc2); } +#endif const struct tcpm_drv ps8xxx_tcpm_drv = { .init = &ps8xxx_tcpm_init, .release = &ps8xxx_tcpm_release, - .get_cc = &ps8xxx_get_cc, +#ifdef CONFIG_USB_PD_TCPM_PS8751 + .get_cc = &ps8751_get_gcc, +#else + .get_cc = &tcpci_tcpm_get_cc, +#endif #ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC .get_vbus_level = &tcpci_tcpm_get_vbus_level, #endif |