diff options
author | Yilun Lin <yllin@google.com> | 2018-10-23 18:17:52 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-29 11:21:37 -0700 |
commit | 5f068e277ba6de108615aa3190ccb14b316b67f0 (patch) | |
tree | 3d4590e0a925b1f424b2f9f72f4f987c21e03d90 | |
parent | 453584443b3df088d3416bc2bc12e59d0a3aca58 (diff) | |
download | chrome-ec-5f068e277ba6de108615aa3190ccb14b316b67f0.tar.gz |
tcpm/mt6370: Support low power mode.
TEST=make BOARD=kukui -j
TEST=Test plug/unplug pd charger that can do pd negiotiate.
TEST=Test plug/unplug peripheral that can sink power.
BUG=b:113641776, b:80160923
BRANCH=None
Change-Id: I4dd1ee5cfe2111af0abb47f62f34cf34e3fd81ad
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1297096
Commit-Ready: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | driver/tcpm/mt6370.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/driver/tcpm/mt6370.c b/driver/tcpm/mt6370.c index d79ef0b691..a77dd96b57 100644 --- a/driver/tcpm/mt6370.c +++ b/driver/tcpm/mt6370.c @@ -102,6 +102,22 @@ static int mt6370_get_cc(int port, int *cc1, int *cc2) return rv; } +#ifdef CONFIG_USB_PD_TCPC_LOW_POWER +static int mt6370_enter_low_power_mode(int port) +{ + int rv; + + /* VBUS_DET_EN for detecting charger plug. */ + rv = tcpc_write(port, MT6370_REG_BMC_CTRL, + MT6370_REG_BMCIO_LPEN | MT6370_REG_VBUS_DET_EN); + + if (rv) + return rv; + + return tcpci_enter_low_power_mode(port); +} +#endif + /* MT6370 is a TCPCI compatible port controller */ const struct tcpm_drv mt6370_tcpm_drv = { .init = &mt6370_init, @@ -130,4 +146,7 @@ const struct tcpm_drv mt6370_tcpm_drv = { .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif +#ifdef CONFIG_USB_PD_TCPC_LOW_POWER + .enter_low_power_mode = &mt6370_enter_low_power_mode, +#endif }; |