diff options
author | Matthew Blecker <matthewb@google.com> | 2020-02-21 14:57:21 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-24 17:40:08 +0000 |
commit | 18eb94947ee6a93e51f811a55ded47f980f7c087 (patch) | |
tree | 1d12b1cf77027757f97aa033a47263bfbb4f4fd9 | |
parent | 84133279c9371ed23148844e75fb1069426d8091 (diff) | |
download | chrome-ec-18eb94947ee6a93e51f811a55ded47f980f7c087.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>
(cherry picked from commit 71f97f2c63ef5e7ad2d88645949efea26c23fb3f)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2069028
Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Commit-Queue: Tim Wawrzynczak <twawrzynczak@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 e87372be17..ff62bffb79 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -246,27 +246,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; @@ -276,11 +277,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 |