From 4ca73139635261ee1273fbe1767dcf06886d2208 Mon Sep 17 00:00:00 2001 From: James_Chao Date: Tue, 22 Jan 2019 17:02:47 +0800 Subject: Ampton: Set the PS8751 to source mode before enter low power mode BUG=b:113830171 BRANCH=octopus TEST=check the power consumption is lower Change-Id: I527cdc5d1e4dd5de137ab0927e66c171696758ce Signed-off-by: James_Chao Reviewed-on: https://chromium-review.googlesource.com/1426306 Commit-Ready: James Chao Tested-by: James Chao Reviewed-by: Jett Rink --- driver/tcpm/ps8xxx.c | 14 ++++++++++++++ driver/tcpm/ps8xxx.h | 2 ++ driver/tcpm/tcpci.c | 2 +- driver/tcpm/tcpci.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'driver') diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index 3bf2ab5b12..3cb6903e5b 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -206,3 +206,17 @@ struct i2c_stress_test_dev ps8xxx_i2c_stress_test_dev = { .i2c_write = &tcpc_i2c_write, }; #endif /* CONFIG_CMD_I2C_STRESS_TEST_TCPC */ + +static int ps8xxx_mux_enter_low_power_mode(int port) +{ + mux_write(port, TCPC_REG_ROLE_CTRL, + TCPC_REG_ROLE_CTRL_SET(0, 0, TYPEC_CC_RP, TYPEC_CC_RP)); + return tcpci_tcpm_mux_enter_low_power(port); +} + +const struct usb_mux_driver ps8xxx_usb_mux_driver = { + .init = &tcpci_tcpm_mux_init, + .set = &tcpci_tcpm_mux_set, + .get = &tcpci_tcpm_mux_get, + .enter_low_power_mode = &ps8xxx_mux_enter_low_power_mode, +}; diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h index 1459bb4b3e..6d0faab56f 100644 --- a/driver/tcpm/ps8xxx.h +++ b/driver/tcpm/ps8xxx.h @@ -67,4 +67,6 @@ void ps8xxx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq); extern struct i2c_stress_test_dev ps8xxx_i2c_stress_test_dev; #endif /* defined(CONFIG_CMD_I2C_STRESS_TEST_TCPC) */ +extern const struct usb_mux_driver ps8xxx_usb_mux_driver; + #endif /* defined(__CROS_EC_USB_PD_TCPM_PS8XXX_H) */ diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index f7d98312cf..f20fbd91e3 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -809,7 +809,7 @@ int tcpci_tcpm_mux_init(int port) return error ? EC_ERROR_UNKNOWN : EC_SUCCESS; } -static int tcpci_tcpm_mux_enter_low_power(int port) +int tcpci_tcpm_mux_enter_low_power(int port) { /* If this MUX is also the TCPC, then skip low power */ if (!(usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC)) diff --git a/driver/tcpm/tcpci.h b/driver/tcpm/tcpci.h index 52a4d62847..8084e92232 100644 --- a/driver/tcpm/tcpci.h +++ b/driver/tcpm/tcpci.h @@ -155,6 +155,7 @@ void tcpci_tcpc_discharge_vbus(int port, int enable); int tcpci_tcpm_mux_init(int i2c_addr); int tcpci_tcpm_mux_set(int i2c_addr, mux_state_t mux_state); int tcpci_tcpm_mux_get(int i2c_addr, mux_state_t *mux_state); +int tcpci_tcpm_mux_enter_low_power(int port); int tcpci_get_chip_info(int port, int renew, struct ec_response_pd_chip_info_v1 **chip_info); #ifdef CONFIG_USBC_PPC -- cgit v1.2.1