summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2023-03-21 08:44:29 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-23 22:14:12 +0000
commit66dc56dc229c5abddd18296ddfad0e7f69218799 (patch)
tree772af2aa51e94b2d794fe6c68caf00a85d1101be
parentcee5e5c78ba84adb5a13b1f1e0209006ddd004d0 (diff)
downloadchrome-ec-66dc56dc229c5abddd18296ddfad0e7f69218799.tar.gz
zephyr: tcpc: cleanup TCPC chip macro
Move the separator from each individual TCPC chip macro. This allows the same macro to be used outside an array definition. BUG=b:274126703 BRANCH=none TEST=zmake compare-builds -a Change-Id: Iabc8af8d0a5c32c4a24535c98b3d676083d7efb2 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4356026 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Madhu 🌱 <mparuchuri@google.com> Commit-Queue: caveh jalali <caveh@chromium.org> Tested-by: Madhu 🌱 <mparuchuri@google.com>
-rw-r--r--zephyr/shim/include/usbc/tcpc_anx7447.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_anx7447_emul.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_ccgxxf.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_fusb302.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_generic_emul.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_it8xxx2.h11
-rw-r--r--zephyr/shim/include/usbc/tcpc_nct38xx.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h6
-rw-r--r--zephyr/shim/include/usbc/tcpc_raa489000.h8
-rw-r--r--zephyr/shim/include/usbc/tcpc_rt1718s.h6
-rw-r--r--zephyr/shim/include/usbc/tcpci.h10
-rw-r--r--zephyr/shim/src/tcpc.c2
13 files changed, 53 insertions, 32 deletions
diff --git a/zephyr/shim/include/usbc/tcpc_anx7447.h b/zephyr/shim/include/usbc/tcpc_anx7447.h
index 53312cd0ea..f8abb3760e 100644
--- a/zephyr/shim/include/usbc/tcpc_anx7447.h
+++ b/zephyr/shim/include/usbc/tcpc_anx7447.h
@@ -9,7 +9,8 @@
#define ANX7447_TCPC_COMPAT analogix_anx7447_tcpc
-#define TCPC_CONFIG_ANX7447(id) \
+/* clang-format off */
+#define TCPC_CONFIG_ANX7447(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -19,4 +20,5 @@
.drv = &anx7447_tcpm_drv, \
.flags = DT_PROP(id, tcpc_flags), \
.irq_gpio = GPIO_DT_SPEC_GET_OR(id, irq_gpios, {}), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_anx7447_emul.h b/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
index be39ee36d9..51ef11416d 100644
--- a/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
@@ -9,7 +9,8 @@
#define ANX7447_EMUL_COMPAT cros_anx7447_tcpc_emul
-#define TCPC_CONFIG_ANX7447_EMUL(id) \
+/* clang-format off */
+#define TCPC_CONFIG_ANX7447_EMUL(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -18,4 +19,5 @@
}, \
.drv = &anx7447_tcpm_drv, \
.irq_gpio = GPIO_DT_SPEC_GET_OR(id, irq_gpios, {}), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_ccgxxf.h b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
index d28033e053..cb41d3a60e 100644
--- a/zephyr/shim/include/usbc/tcpc_ccgxxf.h
+++ b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
@@ -9,7 +9,8 @@
#define CCGXXF_TCPC_COMPAT cypress_ccgxxf
-#define TCPC_CONFIG_CCGXXF(id) \
+/* clang-format off */
+#define TCPC_CONFIG_CCGXXF(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -24,4 +25,5 @@
DT_NODE_HAS_PROP(id, int_pin), \
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT)))), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_fusb302.h b/zephyr/shim/include/usbc/tcpc_fusb302.h
index 6989dbd21e..36533ffc19 100644
--- a/zephyr/shim/include/usbc/tcpc_fusb302.h
+++ b/zephyr/shim/include/usbc/tcpc_fusb302.h
@@ -10,7 +10,8 @@
#define FUSB302_TCPC_COMPAT fairchild_fusb302
-#define TCPC_CONFIG_FUSB302(id) \
+/* clang-format off */
+#define TCPC_CONFIG_FUSB302(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -24,7 +25,8 @@
DT_NODE_HAS_PROP(id, int_pin), \
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT)))), \
- },
+ }
+/* clang-format on */
DT_FOREACH_STATUS_OKAY(FUSB302_TCPC_COMPAT,
TCPC_VERIFY_NO_FLAGS_ACTIVE_ALERT_HIGH)
diff --git a/zephyr/shim/include/usbc/tcpc_generic_emul.h b/zephyr/shim/include/usbc/tcpc_generic_emul.h
index 95905b6818..bbb85f9829 100644
--- a/zephyr/shim/include/usbc/tcpc_generic_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_generic_emul.h
@@ -9,7 +9,8 @@
#define TCPCI_EMUL_COMPAT cros_tcpci_generic_emul
-#define TCPC_CONFIG_TCPCI_EMUL(id) \
+/* clang-format off */
+#define TCPC_CONFIG_TCPCI_EMUL(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -23,4 +24,5 @@
DT_NODE_HAS_PROP(id, int_pin), \
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT)))), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_it8xxx2.h b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
index b9084782e0..aa36d0c39e 100644
--- a/zephyr/shim/include/usbc/tcpc_it8xxx2.h
+++ b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
@@ -9,9 +9,8 @@
#define IT8XXX2_TCPC_COMPAT ite_it8xxx2_usbpd
-#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 797993750c..b1b0d07b4d 100644
--- a/zephyr/shim/include/usbc/tcpc_nct38xx.h
+++ b/zephyr/shim/include/usbc/tcpc_nct38xx.h
@@ -12,7 +12,8 @@
#define NCT38XX_TCPC_COMPAT nuvoton_nct38xx
-#define TCPC_CONFIG_NCT38XX(id) \
+/* clang-format off */
+#define TCPC_CONFIG_NCT38XX(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -27,7 +28,8 @@
DT_NODE_HAS_PROP(id, int_pin), \
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT)))), \
- },
+ }
+/* clang-format on */
/**
* @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 621d4ab016..6e9d572eda 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
@@ -10,7 +10,8 @@
#define PS8XXX_COMPAT parade_ps8xxx
-#define TCPC_CONFIG_PS8XXX(id) \
+/* clang-format off */
+#define TCPC_CONFIG_PS8XXX(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -26,6 +27,7 @@
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT))) \
), \
- },
+ }
+/* clang-format on */
DT_FOREACH_STATUS_OKAY(PS8XXX_COMPAT, TCPC_VERIFY_NO_FLAGS_ACTIVE_ALERT_HIGH)
diff --git a/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h b/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
index 09a31b9598..7a1f773a24 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
@@ -9,7 +9,8 @@
#define PS8XXX_EMUL_COMPAT cros_ps8xxx_emul
-#define TCPC_CONFIG_PS8XXX_EMUL(id) \
+/* clang-format off */
+#define TCPC_CONFIG_PS8XXX_EMUL(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -23,4 +24,5 @@
DT_NODE_HAS_PROP(id, int_pin), \
(GPIO_SIGNAL(DT_PHANDLE(id, int_pin))), \
(GPIO_LIMIT)))), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_raa489000.h b/zephyr/shim/include/usbc/tcpc_raa489000.h
index 47e7706ae1..c721da5ea4 100644
--- a/zephyr/shim/include/usbc/tcpc_raa489000.h
+++ b/zephyr/shim/include/usbc/tcpc_raa489000.h
@@ -9,13 +9,15 @@
#define RAA489000_TCPC_COMPAT renesas_raa489000
-#define TCPC_CONFIG_RAA489000(id) \
+/* clang-format off */
+#define TCPC_CONFIG_RAA489000(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
.port = I2C_PORT_BY_DEV(id), \
.addr_flags = DT_REG_ADDR(id), \
}, \
- .drv = &raa489000_tcpm_drv, \
+ .drv = &raa489000_tcpm_drv, \
.flags = DT_PROP(id, tcpc_flags), \
- },
+ }
+/* clang-format on */
diff --git a/zephyr/shim/include/usbc/tcpc_rt1718s.h b/zephyr/shim/include/usbc/tcpc_rt1718s.h
index 489e00a144..198939175b 100644
--- a/zephyr/shim/include/usbc/tcpc_rt1718s.h
+++ b/zephyr/shim/include/usbc/tcpc_rt1718s.h
@@ -10,7 +10,8 @@
#define RT1718S_TCPC_COMPAT richtek_rt1718s_tcpc
-#define TCPC_CONFIG_RT1718S(id) \
+/* clang-format off */
+#define TCPC_CONFIG_RT1718S(id) \
{ \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
@@ -20,7 +21,8 @@
.drv = &rt1718s_tcpm_drv, \
.flags = DT_PROP(id, tcpc_flags), \
.irq_gpio = GPIO_DT_SPEC_GET_OR(id, irq_gpios, {}), \
- },
+ }
+/* clang-format on */
DT_FOREACH_STATUS_OKAY(RT1718S_TCPC_COMPAT,
TCPC_VERIFY_NO_FLAGS_ACTIVE_ALERT_HIGH)
diff --git a/zephyr/shim/include/usbc/tcpci.h b/zephyr/shim/include/usbc/tcpci.h
index 15cea4b332..6ca2af410e 100644
--- a/zephyr/shim/include/usbc/tcpci.h
+++ b/zephyr/shim/include/usbc/tcpci.h
@@ -9,12 +9,14 @@
#define TCPCI_COMPAT cros_ec_tcpci
-#define TCPC_CONFIG_TCPCI(id) \
- { \
+/* clang-format off */
+#define TCPC_CONFIG_TCPCI(id) \
+ { \
.bus_type = EC_BUS_TYPE_I2C, \
.i2c_info = { \
.port = I2C_PORT_BY_DEV(id), \
.addr_flags = DT_REG_ADDR(id), \
}, \
- .drv = &tcpci_tcpm_drv, \
- },
+ .drv = &tcpci_tcpm_drv, \
+ }
+/* clang-format on */
diff --git a/zephyr/shim/src/tcpc.c b/zephyr/shim/src/tcpc.c
index 98a3cd880b..1deb808505 100644
--- a/zephyr/shim/src/tcpc.c
+++ b/zephyr/shim/src/tcpc.c
@@ -34,7 +34,7 @@ LOG_MODULE_REGISTER(tcpc, CONFIG_GPIO_LOG_LEVEL);
#if DT_HAS_TCPC
#define TCPC_CHIP_ENTRY(usbc_id, tcpc_id, config_fn) \
- [USBC_PORT_NEW(usbc_id)] = config_fn(tcpc_id)
+ [USBC_PORT_NEW(usbc_id)] = config_fn(tcpc_id),
#define CHECK_COMPAT(compat, usbc_id, tcpc_id, config_fn) \
COND_CODE_1(DT_NODE_HAS_COMPAT(tcpc_id, compat), \