summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-07-07 14:25:39 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-08 03:01:18 +0000
commitf3ee256dc0ca5b8c74b7dacad18c20e22fe180b4 (patch)
tree58abb6ce459e82d480bd9f6003be95c6daa28ef7
parenta2abb573b512400ff6f2f93e2af2851aa1dd3281 (diff)
downloadchrome-ec-f3ee256dc0ca5b8c74b7dacad18c20e22fe180b4.tar.gz
tcpc: add comma separator in tcpc shim for a better format
Move the comma from header to the dts binding. BUG=none TEST=zmake --goma testall --clobber BRANCH=none Change-Id: Ic5ee1a8b83bc9690354546402cc74f097176fe36 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750550 Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--zephyr/shim/include/usbc/tcpc_ccgxxf.h2
-rw-r--r--zephyr/shim/include/usbc/tcpc_fusb302.h2
-rw-r--r--zephyr/shim/include/usbc/tcpc_it8xxx2.h2
-rw-r--r--zephyr/shim/include/usbc/tcpc_nct38xx.h2
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx.h2
-rw-r--r--zephyr/shim/include/usbc/tcpci.h2
-rw-r--r--zephyr/shim/src/tcpc.c33
7 files changed, 19 insertions, 26 deletions
diff --git a/zephyr/shim/include/usbc/tcpc_ccgxxf.h b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
index 0825007100..3671aa96f1 100644
--- a/zephyr/shim/include/usbc/tcpc_ccgxxf.h
+++ b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
@@ -18,4 +18,4 @@
}, \
.drv = &ccgxxf_tcpm_drv, \
.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 74532767d0..39ff776803 100644
--- a/zephyr/shim/include/usbc/tcpc_fusb302.h
+++ b/zephyr/shim/include/usbc/tcpc_fusb302.h
@@ -17,4 +17,4 @@
id, i2c_addr_flags), \
}, \
.drv = &fusb302_tcpm_drv, \
- },
+ }
diff --git a/zephyr/shim/include/usbc/tcpc_it8xxx2.h b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
index f8f77a6d18..82893c2978 100644
--- a/zephyr/shim/include/usbc/tcpc_it8xxx2.h
+++ b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
@@ -13,4 +13,4 @@
.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 cf71122589..dd3716f085 100644
--- a/zephyr/shim/include/usbc/tcpc_nct38xx.h
+++ b/zephyr/shim/include/usbc/tcpc_nct38xx.h
@@ -21,7 +21,7 @@
}, \
.drv = &nct38xx_tcpm_drv, \
.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 379b041e8e..bfe20eb6a5 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
@@ -18,4 +18,4 @@
}, \
.drv = &ps8xxx_tcpm_drv, \
.flags = DT_PROP(id, tcpc_flags), \
- },
+ }
diff --git a/zephyr/shim/include/usbc/tcpci.h b/zephyr/shim/include/usbc/tcpci.h
index f65b6b7717..1247eb8d01 100644
--- a/zephyr/shim/include/usbc/tcpci.h
+++ b/zephyr/shim/include/usbc/tcpci.h
@@ -17,4 +17,4 @@
.addr_flags = DT_PROP(id, i2c_addr_flags), \
}, \
.drv = &tcpci_tcpm_drv, \
- },
+ }
diff --git a/zephyr/shim/src/tcpc.c b/zephyr/shim/src/tcpc.c
index aef3a05b3c..a3598cafc4 100644
--- a/zephyr/shim/src/tcpc.c
+++ b/zephyr/shim/src/tcpc.c
@@ -27,25 +27,18 @@
#define MAYBE_CONST \
COND_CODE_1(CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG, (), (const))
-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)
-};
+#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)) };
#endif /* DT_HAS_COMPAT_STATUS_OKAY */