diff options
-rw-r--r-- | driver/ppc/rt1718s.c | 17 | ||||
-rw-r--r-- | driver/tcpm/rt1718s.c | 6 | ||||
-rw-r--r-- | driver/tcpm/rt1718s.h | 17 |
3 files changed, 33 insertions, 7 deletions
diff --git a/driver/ppc/rt1718s.c b/driver/ppc/rt1718s.c index 96cb789cd0..68bd1aad16 100644 --- a/driver/ppc/rt1718s.c +++ b/driver/ppc/rt1718s.c @@ -169,15 +169,20 @@ static int rt1718s_is_vbus_present(int port) } #endif +int rt1718s_frs_init(int port) +{ + /* Set Rx frs unmasked */ + RETURN_ERROR(update_bits(port, RT1718S_RT_MASK1, + RT1718S_RT_MASK1_M_RX_FRS, 0xFF)); + return EC_SUCCESS; +} + static int rt1718s_init(int port) { atomic_clear(&flags[port]); if (IS_ENABLED(CONFIG_USB_PD_FRS_PPC)) - /* Set Rx frs unmasked */ - RETURN_ERROR(update_bits(port, RT1718S_RT_MASK1, - RT1718S_RT_MASK1_M_RX_FRS, - 0xFF)); + RETURN_ERROR(rt1718s_frs_init(port)); return EC_SUCCESS; } @@ -189,8 +194,7 @@ static int rt1718s_set_polarity(int port, int polarity) } #endif -#ifdef CONFIG_USB_PD_FRS_PPC -static int rt1718s_set_frs_enable(int port, int enable) +int rt1718s_set_frs_enable(int port, int enable) { /* * Use write instead of update to save 2 i2c read. @@ -210,7 +214,6 @@ static int rt1718s_set_frs_enable(int port, int enable) RETURN_ERROR(write_reg(port, RT1718S_VBUS_CTRL_EN, vbus_ctrl_en)); return EC_SUCCESS; } -#endif const struct ppc_drv rt1718s_ppc_drv = { .init = &rt1718s_init, diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index beabd8830b..6e7499cbb9 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -252,6 +252,9 @@ static int rt1718s_init(int port) TCPC_REG_ALERT_MASK_VENDOR_DEF, MASK_SET)); + if (IS_ENABLED(CONFIG_USB_PD_FRS_TCPC)) + rt1718s_frs_init(port); + RETURN_ERROR(board_rt1718s_init(port)); return EC_SUCCESS; @@ -558,6 +561,9 @@ const struct tcpm_drv rt1718s_tcpm_drv = { #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &rt1718s_enter_low_power_mode, #endif +#ifdef CONFIG_USB_PD_FRS_TCPC + .set_frs_enable = &rt1718s_set_frs_enable, +#endif }; const struct bc12_drv rt1718s_bc12_drv = { diff --git a/driver/tcpm/rt1718s.h b/driver/tcpm/rt1718s.h index 07c3ed3f82..b0733d099a 100644 --- a/driver/tcpm/rt1718s.h +++ b/driver/tcpm/rt1718s.h @@ -242,4 +242,21 @@ void rt1718s_gpio_set_level(int port, enum rt1718s_gpio signal, int value); */ int rt1718s_gpio_get_level(int port, enum rt1718s_gpio signal); +/** + * Set fast role swap. + * + * @param port USB-C port + * @param enable enable/disable FRS + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +int rt1718s_set_frs_enable(int port, int enable); + +/** + * Initialize RT1718S FRS function + * + * @param port USB-C port + * @return EC_SUCCESS if success, EC_ERROR_UNKNOWN otherwise. + */ +int rt1718s_frs_init(int port); + #endif /* __CROS_EC_USB_PD_TCPM_MT6370_H */ |