From 03df4b2fc497fb1e2865ca9027910a5168394e80 Mon Sep 17 00:00:00 2001 From: Devin Lu Date: Thu, 21 Apr 2022 11:18:45 +0800 Subject: TCPCI: Allow TCPM to use sink/source control without PPCs presence This patch removes define CONFIG_USBC_PPC to allow TCPM to use sink and source control without PPCs presence. since they exist generally in TCPCI specification independently of PPCs. BUG=b:211791444 BRANCH=none TEST=make buildall Signed-off-by: Devin Lu Change-Id: Ia4be8bf872f981c23908944381b156778f63064b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3597314 Reviewed-by: Diana Z --- common/mock/tcpc_mock.c | 2 -- driver/tcpm/anx7447.c | 2 -- driver/tcpm/mt6370.c | 2 -- driver/tcpm/nct38xx.c | 4 ---- driver/tcpm/ps8xxx.c | 4 +--- driver/tcpm/rt1715.c | 4 +--- driver/tcpm/rt1718s.c | 2 -- driver/tcpm/tcpci.c | 4 ---- driver/tcpm/tusb422.c | 4 +--- include/driver/tcpm/tcpci.h | 2 -- include/driver/tcpm/tcpm.h | 2 -- include/usb_pd_tcpm.h | 2 -- 12 files changed, 3 insertions(+), 31 deletions(-) diff --git a/common/mock/tcpc_mock.c b/common/mock/tcpc_mock.c index dc3d11119d..a9bb12b356 100644 --- a/common/mock/tcpc_mock.c +++ b/common/mock/tcpc_mock.c @@ -220,10 +220,8 @@ const struct tcpm_drv mock_tcpc_driver = { .drp_toggle = &mock_drp_toggle, #endif .get_chip_info = &mock_get_chip_info, -#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &mock_set_snk_ctrl, .set_src_ctrl = &mock_set_src_ctrl, -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &mock_enter_low_power_mode, .wake_low_power_mode = &mock_wake_low_power_mode, diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index d025191c6d..2bcfab4a92 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -881,10 +881,8 @@ const struct tcpm_drv anx7447_tcpm_drv = { .drp_toggle = anx7447_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &tcpci_enter_low_power_mode, #endif diff --git a/driver/tcpm/mt6370.c b/driver/tcpm/mt6370.c index 100a4d9eeb..7f4cb5b3d3 100644 --- a/driver/tcpm/mt6370.c +++ b/driver/tcpm/mt6370.c @@ -211,10 +211,8 @@ const struct tcpm_drv mt6370_tcpm_drv = { .drp_toggle = &tcpci_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &mt6370_enter_low_power_mode, #endif diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c index 592a86929c..8b6690524c 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -231,7 +231,6 @@ static int nct38xx_tcpm_set_cc(int port, int pull) return tcpci_tcpm_set_cc(port, pull); } -#ifdef CONFIG_USB_PD_PPC static int nct38xx_tcpm_set_snk_ctrl(int port, int enable) { int rv; @@ -251,7 +250,6 @@ static int nct38xx_tcpm_set_snk_ctrl(int port, int enable) return tcpci_tcpm_set_snk_ctrl(port, enable); } -#endif static inline int tcpc_read_alert_no_lpm_exit(int port, int *val) { @@ -396,12 +394,10 @@ const struct tcpm_drv nct38xx_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tcpci_tcpc_drp_toggle, #endif -#ifdef CONFIG_USB_PD_PPC .get_snk_ctrl = &tcpci_tcpm_get_snk_ctrl, .set_snk_ctrl = &nct38xx_tcpm_set_snk_ctrl, .get_src_ctrl = &tcpci_tcpm_get_src_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif .get_chip_info = &tcpci_get_chip_info, #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &tcpci_enter_low_power_mode, diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index e270b91be4..212a7f10dd 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -981,11 +981,9 @@ const struct tcpm_drv ps8xxx_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = ps8xxx_tcpc_drp_toggle, #endif -#ifdef CONFIG_USB_PD_PPC + .get_chip_info = ps8xxx_get_chip_info, .set_snk_ctrl = tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = tcpci_tcpm_set_src_ctrl, -#endif - .get_chip_info = ps8xxx_get_chip_info, #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = ps8xxx_enter_low_power_mode, #endif diff --git a/driver/tcpm/rt1715.c b/driver/tcpm/rt1715.c index ed3d283bc9..7985ee95a3 100644 --- a/driver/tcpm/rt1715.c +++ b/driver/tcpm/rt1715.c @@ -251,11 +251,9 @@ const struct tcpm_drv rt1715_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tcpci_tcpc_drp_toggle, #endif -#ifdef CONFIG_USB_PD_PPC + .get_chip_info = &tcpci_get_chip_info, .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif - .get_chip_info = &tcpci_get_chip_info, #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &rt1715_enter_low_power_mode, #endif diff --git a/driver/tcpm/rt1718s.c b/driver/tcpm/rt1718s.c index cd32f85da4..2b5fb6068e 100644 --- a/driver/tcpm/rt1718s.c +++ b/driver/tcpm/rt1718s.c @@ -751,10 +751,8 @@ const struct tcpm_drv rt1718s_tcpm_drv = { .drp_toggle = &tcpci_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &rt1718s_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &rt1718s_enter_low_power_mode, #endif diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 42e7bb357a..a55db12e1c 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -604,7 +604,6 @@ int tcpci_tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity) ? MASK_SET : MASK_CLR); } -#ifdef CONFIG_USB_PD_PPC bool tcpci_tcpm_get_snk_ctrl(int port) { int rv; @@ -642,7 +641,6 @@ int tcpci_tcpm_set_src_ctrl(int port, int enable) return tcpc_write(port, TCPC_REG_COMMAND, cmd); } -#endif __maybe_unused int tcpci_tcpm_sop_prime_enable(int port, bool enable) { @@ -1863,12 +1861,10 @@ const struct tcpm_drv tcpci_tcpm_drv = { .drp_toggle = &tcpci_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USB_PD_PPC .get_snk_ctrl = &tcpci_tcpm_get_snk_ctrl, .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .get_src_ctrl = &tcpci_tcpm_get_src_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &tcpci_enter_low_power_mode, #endif diff --git a/driver/tcpm/tusb422.c b/driver/tcpm/tusb422.c index f2a4ec2fb3..6e07bce5e1 100644 --- a/driver/tcpm/tusb422.c +++ b/driver/tcpm/tusb422.c @@ -180,11 +180,9 @@ const struct tcpm_drv tusb422_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tusb422_tcpc_drp_toggle, #endif -#ifdef CONFIG_USB_PD_PPC + .get_chip_info = &tcpci_get_chip_info, .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, -#endif - .get_chip_info = &tcpci_get_chip_info, #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &tcpci_enter_low_power_mode, #endif diff --git a/include/driver/tcpm/tcpci.h b/include/driver/tcpm/tcpci.h index 6eebb074b0..559b75a14f 100644 --- a/include/driver/tcpm/tcpci.h +++ b/include/driver/tcpm/tcpci.h @@ -351,12 +351,10 @@ int tcpci_tcpm_mux_enter_low_power(const struct usb_mux *me); int tcpci_get_chip_info(int port, int live, struct ec_response_pd_chip_info_v1 *chip_info); int tcpci_get_vbus_voltage(int port, int *vbus); -#ifdef CONFIG_USB_PD_PPC bool tcpci_tcpm_get_snk_ctrl(int port); int tcpci_tcpm_set_snk_ctrl(int port, int enable); bool tcpci_tcpm_get_src_ctrl(int port); int tcpci_tcpm_set_src_ctrl(int port, int enable); -#endif int tcpci_tcpc_fast_role_swap_enable(int port, int enable); diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h index c0a08df300..8c77caffc0 100644 --- a/include/driver/tcpm/tcpm.h +++ b/include/driver/tcpm/tcpm.h @@ -278,7 +278,6 @@ static inline int tcpm_transmit(int port, enum tcpci_msg_type type, return tcpc_config[port].drv->transmit(port, type, header, data); } -#ifdef CONFIG_USB_PD_PPC static inline bool tcpm_get_snk_ctrl(int port) { return tcpc_config[port].drv->get_snk_ctrl ? @@ -305,7 +304,6 @@ static inline int tcpm_set_src_ctrl(int port, int enable) else return EC_ERROR_UNIMPLEMENTED; } -#endif static inline void tcpc_alert(int port) { diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index c104b3af8f..3d99e035f9 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -386,7 +386,6 @@ struct tcpm_drv { int (*get_chip_info)(int port, int live, struct ec_response_pd_chip_info_v1 *info); -#ifdef CONFIG_USB_PD_PPC /** * Request current sinking state of the TCPC * NOTE: this is most useful for PPCs that can not tell on their own @@ -426,7 +425,6 @@ struct tcpm_drv { * @return EC_SUCCESS or error */ int (*set_src_ctrl)(int port, int enable); -#endif #ifdef CONFIG_USB_PD_TCPC_LOW_POWER /** -- cgit v1.2.1