diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2022-05-23 13:59:38 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-26 23:13:57 +0000 |
commit | 24dcbaf1a255324feb8f473972ba6dcc28468ae2 (patch) | |
tree | e6932517cad926adf0ed063f5f9d625bd622d4fd /common | |
parent | e7ba53ffc045ec6a152674e15e48d51a09d675d6 (diff) | |
download | chrome-ec-24dcbaf1a255324feb8f473972ba6dcc28468ae2.tar.gz |
TCPMv2: Add support for combination of PPC & non-PPC ports
Some PD/TCPC chips have integrated power path control, this CL allows
having combination of chips with discrete PPC and integrated PPC in
same board. By checking board level function to see if board's port
has PPC or not, logic decides to call PPC functions.
BUG=none
BRANCH=none
TEST=Tested on ADL-RVP, CCGXX with integrated PPC &
NCT3808 with discrete SN5S330 PPC combo works.
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Change-Id: I5289f41664c9c5bf6c4966c9dcf79274cebe8c2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146212
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usbc_ppc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/usbc_ppc.c b/common/usbc_ppc.c index 0281ceaf64..f6c7f6876d 100644 --- a/common/usbc_ppc.c +++ b/common/usbc_ppc.c @@ -40,6 +40,11 @@ int ppc_err_prints(const char *string, int port, int error) #endif } +__overridable bool board_port_has_ppc(int port) +{ + return true; +} + /* Simple wrappers to dispatch to the drivers. */ int ppc_init(int port) @@ -47,6 +52,9 @@ int ppc_init(int port) int rv = EC_ERROR_UNIMPLEMENTED; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; @@ -87,6 +95,9 @@ int ppc_set_polarity(int port, int polarity) int rv = EC_ERROR_UNIMPLEMENTED; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; @@ -105,6 +116,9 @@ int ppc_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp) int rv = EC_ERROR_UNIMPLEMENTED; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; @@ -140,6 +154,9 @@ int ppc_set_sbu(int port, int enable) int rv = EC_ERROR_UNIMPLEMENTED; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; @@ -159,6 +176,9 @@ int ppc_set_vconn(int port, int enable) int rv = EC_ERROR_UNIMPLEMENTED; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; @@ -177,6 +197,9 @@ int ppc_dev_is_connected(int port, enum ppc_device_role dev) int rv = EC_SUCCESS; const struct ppc_config_t *ppc; + if (!board_port_has_ppc(port)) + return EC_SUCCESS; + if ((port < 0) || (port >= ppc_cnt)) { CPRINTS("%s(%d) Invalid port!", __func__, port); return EC_ERROR_INVAL; |