diff options
author | Koro Chen <koro.chen@mediatek.com> | 2016-07-15 11:52:30 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-29 07:03:17 -0700 |
commit | a1b8cda639ff6520da57880bdb84ca91a38e83af (patch) | |
tree | 7ff18cc188dbf334a2bb13d34f43cd3fbf1c14be /driver | |
parent | 33bbf37d2af612d701a004070c358502c4bbe83d (diff) | |
download | chrome-ec-a1b8cda639ff6520da57880bdb84ca91a38e83af.tar.gz |
pd: tcpci: Fix tcpci_tcpm_set_vconn() to set bit0 (VCONN) only.
Previously, tcpci_tcpm_set_vconn() would set bit0 and clear all others
of POWER_CTRL. With this patch, only bit0 is updated.
BRANCH=oak
BUG=chrome-os-partner:55221
TEST=plug/unplug apple dongle, check TCPCI 0x1c bit4 should be always 1
Change-Id: I83f113c13bdaad8ce6ece56241296a8f097e1f0a
Signed-off-by: Koro Chen <koro.chen@mediatek.com>
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360771
Reviewed-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/tcpci.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 1176980419..7eb2d9146b 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -104,8 +104,14 @@ int tcpci_tcpm_set_polarity(int port, int polarity) int tcpci_tcpm_set_vconn(int port, int enable) { - return tcpc_write(port, TCPC_REG_POWER_CTRL, - TCPC_REG_POWER_CTRL_SET(enable)); + int reg, rv; + + rv = tcpc_read(port, TCPC_REG_POWER_CTRL, ®); + if (rv) + return rv; + reg &= ~TCPC_REG_POWER_CTRL_VCONN(1); + reg |= TCPC_REG_POWER_CTRL_VCONN(enable); + return tcpc_write(port, TCPC_REG_POWER_CTRL, reg); } int tcpci_tcpm_set_msg_header(int port, int power_role, int data_role) |