diff options
-rw-r--r-- | common/mock/tcpc_mock.c | 2 | ||||
-rw-r--r-- | common/usb_common.c | 9 | ||||
-rw-r--r-- | common/usbc_ppc.c | 4 | ||||
-rw-r--r-- | driver/tcpm/tcpm.h | 2 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 2 |
5 files changed, 15 insertions, 4 deletions
diff --git a/common/mock/tcpc_mock.c b/common/mock/tcpc_mock.c index 6dd5da7248..71be5ca281 100644 --- a/common/mock/tcpc_mock.c +++ b/common/mock/tcpc_mock.c @@ -197,5 +197,7 @@ const struct tcpm_drv mock_tcpc_driver = { #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &mock_enter_low_power_mode, #endif +#ifdef CONFIG_USB_PD_FRS_TCPC .set_frs_enable = &mock_set_frs_enable, +#endif }; diff --git a/common/usb_common.c b/common/usb_common.c index 9cf12ff6d2..b1920e3351 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -740,8 +740,13 @@ int pd_is_vbus_present(int port) #ifdef CONFIG_USB_PD_FRS int pd_set_frs_enable(int port, int enable) { - ppc_set_frs_enable(port, enable); - return tcpm_set_frs_enable(port, enable); + int rv = EC_SUCCESS; + + if (IS_ENABLED(CONFIG_USB_PD_FRS_PPC)) + rv = ppc_set_frs_enable(port, enable); + if (rv == EC_SUCCESS && IS_ENABLED(CONFIG_USB_PD_FRS_TCPC)) + rv = tcpm_set_frs_enable(port, enable); + return rv; } #endif /* defined(CONFIG_USB_PD_FRS) */ diff --git a/common/usbc_ppc.c b/common/usbc_ppc.c index 765e028a65..c3710c0852 100644 --- a/common/usbc_ppc.c +++ b/common/usbc_ppc.c @@ -323,7 +323,7 @@ int ppc_vbus_source_enable(int port, int enable) return rv; } -#ifdef CONFIG_USB_PD_FRS +#ifdef CONFIG_USB_PD_FRS_PPC int ppc_set_frs_enable(int port, int enable) { int rv = EC_ERROR_UNIMPLEMENTED; @@ -341,7 +341,7 @@ int ppc_set_frs_enable(int port, int enable) return rv; } -#endif /* defined(CONFIG_USB_PD_FRS) */ +#endif /* defined(CONFIG_USB_PD_FRS_PPC) */ #ifdef CONFIG_USB_PD_VBUS_DETECT_PPC int ppc_is_vbus_present(int port) diff --git a/driver/tcpm/tcpm.h b/driver/tcpm/tcpm.h index 9bb8362158..0c2f0417e9 100644 --- a/driver/tcpm/tcpm.h +++ b/driver/tcpm/tcpm.h @@ -461,6 +461,7 @@ int tcpm_has_pending_message(int port); */ void tcpm_clear_pending_messages(int port); +#ifdef CONFIG_USB_PD_FRS_TCPC /** * Enable/Disable TCPC Fast Role Swap detection * @@ -482,6 +483,7 @@ static inline int tcpm_set_frs_enable(int port, int enable) rv = tcpc->set_frs_enable(port, enable); return rv; } +#endif /* defined(CONFIG_USB_PD_FRS_TCPC) */ #ifdef CONFIG_CMD_TCPC_DUMP static inline void tcpm_dump_registers(int port) diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index fb46d055e7..26131214ba 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -387,6 +387,7 @@ struct tcpm_drv { int (*enter_low_power_mode)(int port); #endif +#ifdef CONFIG_USB_PD_FRS_TCPC /** * Enable/Disable TCPC FRS detection * @@ -396,6 +397,7 @@ struct tcpm_drv { * @return EC_SUCCESS or error */ int (*set_frs_enable)(int port, int enable); +#endif /** * Handle TCPCI Faults |