diff options
-rw-r--r-- | zephyr/shim/include/usbc/tcpc_ccgxxf.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/tcpc_fusb302.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/tcpc_it8xxx2.h | 11 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/tcpc_nct38xx.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/tcpc_ps8xxx.h | 8 | ||||
-rw-r--r-- | zephyr/shim/include/usbc/tcpci.h | 8 | ||||
-rw-r--r-- | zephyr/shim/src/tcpc.c | 33 |
7 files changed, 43 insertions, 35 deletions
diff --git a/zephyr/shim/include/usbc/tcpc_ccgxxf.h b/zephyr/shim/include/usbc/tcpc_ccgxxf.h index db2dbe10fc..e19220d40e 100644 --- a/zephyr/shim/include/usbc/tcpc_ccgxxf.h +++ b/zephyr/shim/include/usbc/tcpc_ccgxxf.h @@ -8,7 +8,7 @@ #define CCGXXF_TCPC_COMPAT cypress_ccgxxf -#define TCPC_CONFIG_CCGXXF(id) \ +#define TCPC_CONFIG_CCGXXF(id) \ { \ .bus_type = EC_BUS_TYPE_I2C, \ .i2c_info = { \ @@ -17,5 +17,5 @@ id, i2c_addr_flags), \ }, \ .drv = &ccgxxf_tcpm_drv, \ - .flags = TCPC_FLAGS_TCPCI_REV2_0, \ - } + .flags = TCPC_FLAGS_TCPCI_REV2_0, \ + }, diff --git a/zephyr/shim/include/usbc/tcpc_fusb302.h b/zephyr/shim/include/usbc/tcpc_fusb302.h index d9f80a2ac6..5333361929 100644 --- a/zephyr/shim/include/usbc/tcpc_fusb302.h +++ b/zephyr/shim/include/usbc/tcpc_fusb302.h @@ -8,7 +8,7 @@ #define FUSB302_TCPC_COMPAT fairchild_fusb302 -#define TCPC_CONFIG_FUSB302(id) \ +#define TCPC_CONFIG_FUSB302(id) \ { \ .bus_type = EC_BUS_TYPE_I2C, \ .i2c_info = { \ @@ -16,5 +16,5 @@ .addr_flags = DT_STRING_UPPER_TOKEN( \ id, i2c_addr_flags), \ }, \ - .drv = &fusb302_tcpm_drv, \ - } + .drv = &fusb302_tcpm_drv, \ + }, diff --git a/zephyr/shim/include/usbc/tcpc_it8xxx2.h b/zephyr/shim/include/usbc/tcpc_it8xxx2.h index 9ec7d05a8a..f8f77a6d18 100644 --- a/zephyr/shim/include/usbc/tcpc_it8xxx2.h +++ b/zephyr/shim/include/usbc/tcpc_it8xxx2.h @@ -8,8 +8,9 @@ #define IT8XXX2_TCPC_COMPAT ite_it8xxx2_tcpc -#define TCPC_CONFIG_IT8XXX2(id) \ - { \ - .bus_type = EC_BUS_TYPE_EMBEDDED, .drv = &it8xxx2_tcpm_drv, \ - .flags = 0, \ - } +#define TCPC_CONFIG_IT8XXX2(id) \ + { \ + .bus_type = EC_BUS_TYPE_EMBEDDED, \ + .drv = &it8xxx2_tcpm_drv, \ + .flags = 0, \ + }, diff --git a/zephyr/shim/include/usbc/tcpc_nct38xx.h b/zephyr/shim/include/usbc/tcpc_nct38xx.h index 2dc6d32286..377e19e63d 100644 --- a/zephyr/shim/include/usbc/tcpc_nct38xx.h +++ b/zephyr/shim/include/usbc/tcpc_nct38xx.h @@ -11,7 +11,7 @@ #define NCT38XX_TCPC_COMPAT nuvoton_nct38xx -#define TCPC_CONFIG_NCT38XX(id) \ +#define TCPC_CONFIG_NCT38XX(id) \ { \ .bus_type = EC_BUS_TYPE_I2C, \ .i2c_info = { \ @@ -20,8 +20,8 @@ id, i2c_addr_flags), \ }, \ .drv = &nct38xx_tcpm_drv, \ - .flags = DT_PROP(id, tcpc_flags), \ - } + .flags = DT_PROP(id, tcpc_flags), \ + }, /** * @brief Get the NCT38XX GPIO device from the TCPC port enumeration diff --git a/zephyr/shim/include/usbc/tcpc_ps8xxx.h b/zephyr/shim/include/usbc/tcpc_ps8xxx.h index ca121fbde2..379b041e8e 100644 --- a/zephyr/shim/include/usbc/tcpc_ps8xxx.h +++ b/zephyr/shim/include/usbc/tcpc_ps8xxx.h @@ -8,8 +8,8 @@ #define PS8XXX_COMPAT parade_ps8xxx -#define TCPC_CONFIG_PS8XXX(id) \ - { \ +#define TCPC_CONFIG_PS8XXX(id) \ + { \ .bus_type = EC_BUS_TYPE_I2C, \ .i2c_info = { \ .port = I2C_PORT(DT_PHANDLE(id, port)), \ @@ -17,5 +17,5 @@ id, i2c_addr_flags), \ }, \ .drv = &ps8xxx_tcpm_drv, \ - .flags = DT_PROP(id, tcpc_flags), \ - } + .flags = DT_PROP(id, tcpc_flags), \ + }, diff --git a/zephyr/shim/include/usbc/tcpci.h b/zephyr/shim/include/usbc/tcpci.h index 17d535e04f..f65b6b7717 100644 --- a/zephyr/shim/include/usbc/tcpci.h +++ b/zephyr/shim/include/usbc/tcpci.h @@ -9,12 +9,12 @@ #define TCPCI_COMPAT cros_ec_tcpci -#define TCPC_CONFIG_TCPCI(id) \ - { \ +#define TCPC_CONFIG_TCPCI(id) \ + { \ .bus_type = EC_BUS_TYPE_I2C, \ .i2c_info = { \ .port = I2C_PORT(DT_PHANDLE(id, port)), \ .addr_flags = DT_PROP(id, i2c_addr_flags), \ }, \ - .drv = &tcpci_tcpm_drv, \ - } + .drv = &tcpci_tcpm_drv, \ + }, diff --git a/zephyr/shim/src/tcpc.c b/zephyr/shim/src/tcpc.c index a3598cafc4..aef3a05b3c 100644 --- a/zephyr/shim/src/tcpc.c +++ b/zephyr/shim/src/tcpc.c @@ -27,18 +27,25 @@ #define MAYBE_CONST \ COND_CODE_1(CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG, (), (const)) -#define MAYBE_EMPTY(compat, config) \ - COND_CODE_1( \ - DT_HAS_STATUS_OKAY(compat), \ - (DT_FOREACH_STATUS_OKAY_VARGS(compat, TCPC_CONFIG, config)), \ - (EMPTY)) - -MAYBE_CONST struct tcpc_config_t tcpc_config[] = { LIST_DROP_EMPTY( - MAYBE_EMPTY(CCGXXF_TCPC_COMPAT, TCPC_CONFIG_CCGXXF), - MAYBE_EMPTY(FUSB302_TCPC_COMPAT, TCPC_CONFIG_FUSB302), - MAYBE_EMPTY(IT8XXX2_TCPC_COMPAT, TCPC_CONFIG_IT8XXX2), - MAYBE_EMPTY(PS8XXX_COMPAT, TCPC_CONFIG_PS8XXX), - MAYBE_EMPTY(NCT38XX_TCPC_COMPAT, TCPC_CONFIG_NCT38XX), - MAYBE_EMPTY(TCPCI_COMPAT, TCPC_CONFIG_TCPCI)) }; +MAYBE_CONST struct tcpc_config_t tcpc_config[] = { + DT_FOREACH_STATUS_OKAY_VARGS(CCGXXF_TCPC_COMPAT, TCPC_CONFIG, + TCPC_CONFIG_CCGXXF) + DT_FOREACH_STATUS_OKAY_VARGS(FUSB302_TCPC_COMPAT, TCPC_CONFIG, + TCPC_CONFIG_FUSB302) + DT_FOREACH_STATUS_OKAY_VARGS(IT8XXX2_TCPC_COMPAT, + TCPC_CONFIG, + TCPC_CONFIG_IT8XXX2) + DT_FOREACH_STATUS_OKAY_VARGS(PS8XXX_COMPAT, + TCPC_CONFIG, + TCPC_CONFIG_PS8XXX) + DT_FOREACH_STATUS_OKAY_VARGS( + NCT38XX_TCPC_COMPAT, + TCPC_CONFIG, + TCPC_CONFIG_NCT38XX) + DT_FOREACH_STATUS_OKAY_VARGS( + TCPCI_COMPAT, + TCPC_CONFIG, + TCPC_CONFIG_TCPCI) +}; #endif /* DT_HAS_COMPAT_STATUS_OKAY */ |