summaryrefslogtreecommitdiff
path: root/zephyr/shim
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-07-07 16:02:43 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-08 03:01:25 +0000
commit5ebc252cce3c6ab4e8ce69696162f93790c8f811 (patch)
tree792a0ffb4a5e4f3e67f942b8c7a6865baf5955eb /zephyr/shim
parent59ddcfc2cf71e0c0f72ce5db583f5536d1aa73c0 (diff)
downloadchrome-ec-5ebc252cce3c6ab4e8ce69696162f93790c8f811.tar.gz
ppc: add comma separator in ppc 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: Ife8651cc58f43cdd9e6f6088fd860dec4d03237a Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750555 Commit-Queue: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'zephyr/shim')
-rw-r--r--zephyr/shim/include/usbc/ppc_rt1739.h2
-rw-r--r--zephyr/shim/include/usbc/ppc_sn5s330.h2
-rw-r--r--zephyr/shim/include/usbc/ppc_syv682x.h2
-rw-r--r--zephyr/shim/src/ppc.c29
4 files changed, 16 insertions, 19 deletions
diff --git a/zephyr/shim/include/usbc/ppc_rt1739.h b/zephyr/shim/include/usbc/ppc_rt1739.h
index 19e169a436..f8788e505e 100644
--- a/zephyr/shim/include/usbc/ppc_rt1739.h
+++ b/zephyr/shim/include/usbc/ppc_rt1739.h
@@ -15,4 +15,4 @@
.frs_en = COND_CODE_1(DT_NODE_HAS_PROP(id, irq), \
(GPIO_SIGNAL(DT_PHANDLE(id, irq))), \
(0)), \
- },
+ }
diff --git a/zephyr/shim/include/usbc/ppc_sn5s330.h b/zephyr/shim/include/usbc/ppc_sn5s330.h
index 7ec9b434a8..cbf129cd99 100644
--- a/zephyr/shim/include/usbc/ppc_sn5s330.h
+++ b/zephyr/shim/include/usbc/ppc_sn5s330.h
@@ -10,4 +10,4 @@
#define PPC_CHIP_SN5S330(id) \
{ .i2c_port = I2C_PORT(DT_PHANDLE(id, port)), \
.i2c_addr_flags = DT_STRING_UPPER_TOKEN(id, i2c_addr_flags), \
- .drv = &sn5s330_drv },
+ .drv = &sn5s330_drv }
diff --git a/zephyr/shim/include/usbc/ppc_syv682x.h b/zephyr/shim/include/usbc/ppc_syv682x.h
index f177aebe8b..d45a9862f1 100644
--- a/zephyr/shim/include/usbc/ppc_syv682x.h
+++ b/zephyr/shim/include/usbc/ppc_syv682x.h
@@ -15,4 +15,4 @@
.frs_en = COND_CODE_1( \
DT_NODE_HAS_PROP(id, frs_en_gpio), \
(GPIO_SIGNAL(DT_PHANDLE(id, frs_en_gpio))), (0)), \
- },
+ }
diff --git a/zephyr/shim/src/ppc.c b/zephyr/shim/src/ppc.c
index 936367ca78..f301c50e09 100644
--- a/zephyr/shim/src/ppc.c
+++ b/zephyr/shim/src/ppc.c
@@ -26,25 +26,22 @@
#define PPC_CHIP_ELE_ALT(id, fn) [PPC_ID(id)] = fn(id)
+#define MAYBE_EMPTY(compat, type, config) \
+ COND_CODE_1(DT_HAS_STATUS_OKAY(compat), \
+ (DT_FOREACH_STATUS_OKAY_VARGS(compat, type, config)), \
+ (EMPTY))
+
/* Power Path Controller */
-struct ppc_config_t ppc_chips[] = {
- DT_FOREACH_STATUS_OKAY_VARGS(RT1739_PPC_COMPAT, PPC_CHIP_PRIM,
- PPC_CHIP_RT1739)
- DT_FOREACH_STATUS_OKAY_VARGS(SN5S330_COMPAT, PPC_CHIP_PRIM,
- PPC_CHIP_SN5S330)
- DT_FOREACH_STATUS_OKAY_VARGS(
- SYV682X_COMPAT, PPC_CHIP_PRIM, PPC_CHIP_SYV682X)
-};
+struct ppc_config_t ppc_chips[] = { LIST_DROP_EMPTY(
+ MAYBE_EMPTY(RT1739_PPC_COMPAT, PPC_CHIP_PRIM, PPC_CHIP_RT1739),
+ MAYBE_EMPTY(SN5S330_COMPAT, PPC_CHIP_PRIM, PPC_CHIP_SN5S330),
+ MAYBE_EMPTY(SYV682X_COMPAT, PPC_CHIP_PRIM, PPC_CHIP_SYV682X)) };
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* Alt Power Path Controllers */
-struct ppc_config_t ppc_chips_alt[] = {
- DT_FOREACH_STATUS_OKAY_VARGS(RT1739_PPC_COMPAT, PPC_CHIP_ALT,
- PPC_CHIP_RT1739)
- DT_FOREACH_STATUS_OKAY_VARGS(SN5S330_COMPAT, PPC_CHIP_ALT,
- PPC_CHIP_SN5S330)
- DT_FOREACH_STATUS_OKAY_VARGS(
- SYV682X_COMPAT, PPC_CHIP_ALT, PPC_CHIP_SYV682X)
-};
+struct ppc_config_t ppc_chips_alt[] = { LIST_DROP_EMPTY(
+ MAYBE_EMPTY(RT1739_PPC_COMPAT, PPC_CHIP_ALT, PPC_CHIP_RT1739),
+ MAYBE_EMPTY(SN5S330_COMPAT, PPC_CHIP_ALT, PPC_CHIP_SN5S330),
+ MAYBE_EMPTY(SYV682X_COMPAT, PPC_CHIP_ALT, PPC_CHIP_SYV682X)) };
#endif /* #if DT_HAS_COMPAT_STATUS_OKAY */