diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2021-04-15 12:20:51 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-20 02:04:31 +0000 |
commit | a6f791ada46d9dbcbaf334672fafca8da9535834 (patch) | |
tree | de56182e26364c7d45b43719ef1e2cdfcbd564f4 | |
parent | 748deb2db0ecc013c04c72768fd99467d5ddec6f (diff) | |
download | chrome-ec-a6f791ada46d9dbcbaf334672fafca8da9535834.tar.gz |
TCPC: Cleanup: Enable PPC from PD or Power MUX
Some PD chips have integrated SRC FET and control the SRC/SINK FET
from GPIOs hence cleaned up the code to enable Power Path Control
from either from PD or from Power MUX.
BUG=none
BRANCH=none
TEST=make buildall -j
Change-Id: I77f96b681fd2e5fca35bce425e4bd5ec87d5ccfd
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2828980
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/mock/tcpc_mock.c | 2 | ||||
-rw-r--r-- | driver/tcpm/anx7447.c | 2 | ||||
-rw-r--r-- | driver/tcpm/mt6370.c | 2 | ||||
-rw-r--r-- | driver/tcpm/nct38xx.c | 4 | ||||
-rw-r--r-- | driver/tcpm/ps8xxx.c | 2 | ||||
-rw-r--r-- | driver/tcpm/rt1715.c | 2 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 6 | ||||
-rw-r--r-- | driver/tcpm/tusb422.c | 2 | ||||
-rw-r--r-- | include/config.h | 10 | ||||
-rw-r--r-- | include/driver/tcpm/tcpm.h | 2 | ||||
-rw-r--r-- | include/usb_pd_tcpm.h | 2 | ||||
-rw-r--r-- | zephyr/Kconfig.usbc | 8 |
12 files changed, 33 insertions, 11 deletions
diff --git a/common/mock/tcpc_mock.c b/common/mock/tcpc_mock.c index d47aab729b..d000133a2a 100644 --- a/common/mock/tcpc_mock.c +++ b/common/mock/tcpc_mock.c @@ -214,7 +214,7 @@ const struct tcpm_drv mock_tcpc_driver = { .drp_toggle = &mock_drp_toggle, #endif .get_chip_info = &mock_get_chip_info, -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &mock_set_snk_ctrl, .set_src_ctrl = &mock_set_src_ctrl, #endif diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index 2f679193ec..9458ee8c94 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -825,7 +825,7 @@ const struct tcpm_drv anx7447_tcpm_drv = { .drp_toggle = anx7447_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif diff --git a/driver/tcpm/mt6370.c b/driver/tcpm/mt6370.c index 2adaac1901..100a4d9eeb 100644 --- a/driver/tcpm/mt6370.c +++ b/driver/tcpm/mt6370.c @@ -211,7 +211,7 @@ const struct tcpm_drv mt6370_tcpm_drv = { .drp_toggle = &tcpci_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c index 061af3662d..5d2be3ad2f 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -172,6 +172,7 @@ 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; @@ -191,6 +192,7 @@ static int nct38xx_tcpm_set_snk_ctrl(int port, int enable) return tcpci_tcpm_set_snk_ctrl(port, enable); } +#endif static void nct38xx_tcpc_alert(int port) { @@ -271,7 +273,7 @@ const struct tcpm_drv nct38xx_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tcpci_tcpc_drp_toggle, #endif -#ifdef CONFIG_USBC_PPC +#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, diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c index dfcede84e2..14581a346b 100644 --- a/driver/tcpm/ps8xxx.c +++ b/driver/tcpm/ps8xxx.c @@ -730,7 +730,7 @@ const struct tcpm_drv ps8xxx_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &ps8xxx_tcpc_drp_toggle, #endif -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif diff --git a/driver/tcpm/rt1715.c b/driver/tcpm/rt1715.c index 4e557d7808..ed3d283bc9 100644 --- a/driver/tcpm/rt1715.c +++ b/driver/tcpm/rt1715.c @@ -251,7 +251,7 @@ const struct tcpm_drv rt1715_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tcpci_tcpc_drp_toggle, #endif -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 24a24d45df..64707c67df 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -574,7 +574,7 @@ int tcpci_tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity) ? MASK_SET : MASK_CLR); } -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC int tcpci_tcpm_get_snk_ctrl(int port, bool *sinking) { int rv; @@ -1780,8 +1780,10 @@ const struct tcpm_drv tcpci_tcpm_drv = { .drp_toggle = &tcpci_tcpc_drp_toggle, #endif .get_chip_info = &tcpci_get_chip_info, -#ifdef CONFIG_USBC_PPC +#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 diff --git a/driver/tcpm/tusb422.c b/driver/tcpm/tusb422.c index 7910b8b2de..f2a4ec2fb3 100644 --- a/driver/tcpm/tusb422.c +++ b/driver/tcpm/tusb422.c @@ -180,7 +180,7 @@ const struct tcpm_drv tusb422_tcpm_drv = { #ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE .drp_toggle = &tusb422_tcpc_drp_toggle, #endif -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC .set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl, .set_src_ctrl = &tcpci_tcpm_set_src_ctrl, #endif diff --git a/include/config.h b/include/config.h index 71a5724cf7..c381ae6bd3 100644 --- a/include/config.h +++ b/include/config.h @@ -4322,6 +4322,9 @@ /* Enable PCIE tunneling if Thunderbolt-Compatible mode is enabled*/ #undef CONFIG_USB_PD_PCIE_TUNNELING +/* Enable Power Path Control from PD */ +#undef CONFIG_USB_PD_PPC + /* * The following two macros are ASCII text strings that matches what appears * in the USB-IF Product Registration form for this device. These macros are @@ -5535,6 +5538,13 @@ #define CONFIG_USBC_PPC #endif /* "has a PPC" */ +/* Following chips use Power Path Control information from TCPC chip */ +#if defined(CONFIG_USBC_PPC_AOZ1380) || \ + defined(CONFIG_USBC_PPC_NX20P3481) || \ + defined(CONFIG_USBC_PPC_NX20P3483) +#define CONFIG_USB_PD_PPC +#endif + /* The TI SN5S330 supports VCONN and needs to be informed of CC polarity */ #if defined(CONFIG_USBC_PPC_SN5S330) #define CONFIG_USBC_PPC_POLARITY diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h index 7965684017..901f44a26a 100644 --- a/include/driver/tcpm/tcpm.h +++ b/include/driver/tcpm/tcpm.h @@ -254,7 +254,7 @@ static inline int tcpm_transmit(int port, enum tcpm_transmit_type type, return tcpc_config[port].drv->transmit(port, type, header, data); } -#ifdef CONFIG_USBC_PPC +#ifdef CONFIG_USB_PD_PPC static inline int tcpm_get_snk_ctrl(int port, bool *sinking) { int rv = EC_ERROR_UNIMPLEMENTED; diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index df195d1832..a814c2b7af 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -367,7 +367,7 @@ struct tcpm_drv { int (*get_chip_info)(int port, int live, struct ec_response_pd_chip_info_v1 *info); -#ifdef CONFIG_USBC_PPC +#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 diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc index fd5c7dc319..408249fae8 100644 --- a/zephyr/Kconfig.usbc +++ b/zephyr/Kconfig.usbc @@ -860,6 +860,14 @@ config PLATFORM_EC_CONSOLE_CMD_PPC_DUMP if PLATFORM_EC_USB_PD_TCPM_TCPCI +config PLATFORM_EC_USB_PD_PPC + bool "Enable Power Path Control from PD" + default n + help + Some PD chips have integrated SRC FET and control the SRC/SINK FET + from internal GPIOs. Enable this if the Power Path Control is + controlled by the PD chip without EC GPIOs. + config PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG bool "Type-C Port Controller runtime config" default y |