diff options
Diffstat (limited to 'driver/tcpm/rt1718s.c')
-rw-r--r-- | driver/tcpm/rt1718s.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index e8ee85368a..a1cdf06c9a 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -551,15 +551,37 @@ __overridable int board_rt1718s_set_snk_enable(int port, int enable) return EC_SUCCESS; } +__overridable int board_rt1718s_set_src_enable(int port, int enable) +{ + return EC_SUCCESS; +} + static int rt1718s_tcpm_set_snk_ctrl(int port, int enable) { int rv; - rv = board_rt1718s_set_snk_enable(port, enable); + /* The order matters. Board hook should run after the tcpm call to + * prevent the GPIO config auto-reload overwriting a wrong value. + */ + rv = tcpci_tcpm_set_snk_ctrl(port, enable); + if (rv) + return rv; + + return board_rt1718s_set_snk_enable(port, enable); +} + +static int rt1718s_tcpm_set_src_ctrl(int port, int enable) +{ + int rv; + + /* The order matters. Board hook should run after the tcpm call to + * prevent the GPIO config auto-reload overwriting a wrong value. + */ + rv = tcpci_tcpm_set_src_ctrl(port, enable); if (rv) return rv; - return tcpci_tcpm_set_snk_ctrl(port, enable); + return board_rt1718s_set_src_enable(port, enable); } static void rt1718s_alert(int port) @@ -806,7 +828,7 @@ const struct tcpm_drv rt1718s_tcpm_drv = { #endif .get_chip_info = &tcpci_get_chip_info, .set_snk_ctrl = &rt1718s_tcpm_set_snk_ctrl, - .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, + .set_src_ctrl = &rt1718s_tcpm_set_src_ctrl, #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &rt1718s_enter_low_power_mode, #endif |