diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-08-02 16:07:36 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-03 13:37:24 -0700 |
commit | 6a664f995c6c637023874a56e6bdbadf4259a857 (patch) | |
tree | a73fbe08b471f602cfaac4d1adc42d8b4d004f87 /driver/tcpm/it83xx.c | |
parent | 7ceca8cd1e661359cff4cfbdaf6b05ef7171b060 (diff) | |
download | chrome-ec-6a664f995c6c637023874a56e6bdbadf4259a857.tar.gz |
it83xx/tcpm: disable integrated pd module in hibernate
With this change, we will have better power number in hibernate.
BUG=b:111006203
BRANCH=none
TEST=reduce power consumption about ~2mW in hibernate.
Change-Id: Ia310801543bac9417e370ede6f820c297ae2f734
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1158309
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/tcpm/it83xx.c')
-rw-r--r-- | driver/tcpm/it83xx.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index 258ab78c87..72e27ad6b4 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -34,6 +34,26 @@ const struct usbpd_ctrl_t usbpd_ctrl_regs[] = { }; BUILD_ASSERT(ARRAY_SIZE(usbpd_ctrl_regs) == USBPD_PORT_COUNT); +/* + * This function disables integrated pd module and enables 5.1K resistor for + * dead battery. A EC reset or calling _init() is able to re-active pd module. + */ +void it83xx_disable_pd_module(int port) +{ + /* This only apply to PD port. */ + if (*usbpd_ctrl_regs[port].cc1 == IT83XX_USBPD_CC_PIN_CONFIG && + *usbpd_ctrl_regs[port].cc2 == IT83XX_USBPD_CC_PIN_CONFIG) { + /* Disable PD PHY */ + IT83XX_USBPD_GCR(port) &= ~((1 << 0) | (1 << 4)); + /* Power down CC1/CC2 */ + IT83XX_USBPD_CCGCR(port) |= 0x1f; + /* Disable CC1/CC2 voltage detector */ + IT83XX_USBPD_CCCSR(port) = 0xff; + /* Connect 5.1K resistor to CC1/CC2 for dead battery. */ + IT83XX_USBPD_CCPSR(port) = 0x33; + } +} + static enum tcpc_cc_voltage_status it83xx_get_cc( enum usbpd_port port, enum usbpd_cc_pin cc_pin) @@ -317,8 +337,8 @@ static void it83xx_init(enum usbpd_port port, int role) /* TX start from high */ IT83XX_USBPD_CCADCR(port) |= (1 << 6); /* enable cc1/cc2 */ - *usbpd_ctrl_regs[port].cc1 = 0x86; - *usbpd_ctrl_regs[port].cc2 = 0x86; + *usbpd_ctrl_regs[port].cc1 = IT83XX_USBPD_CC_PIN_CONFIG; + *usbpd_ctrl_regs[port].cc2 = IT83XX_USBPD_CC_PIN_CONFIG; task_clear_pending_irq(usbpd_ctrl_regs[port].irq); task_enable_irq(usbpd_ctrl_regs[port].irq); USBPD_START(port); |