summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2021-12-29 17:04:17 +1100
committerCommit Bot <commit-bot@chromium.org>2021-12-31 00:50:03 +0000
commit77df6d0fdf7e3b844a034f32fc93904a87825d81 (patch)
tree1fd1757775015013bf176e52a98a02d5108f10fd
parentf956457f58ec6db287f75e190066a9f7ebf44c87 (diff)
downloadchrome-ec-77df6d0fdf7e3b844a034f32fc93904a87825d81.tar.gz
zephyr/dts: don't require irq for pi3usb9201
The shim driver for pi3usb9201 appears to have been designed to gracefully handle the absence of an irq property, but they way it was written still required its presence. The IRQ sometimes needs to be omitted when a board shares the BC1.2 IRQ with some other device, so mark the property as optional and fix the driver to still compile when it's not present. BUG=b:211693800 TEST=zmake buildall BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I293a4e88b9a2e5006141654afd9e667fd3f8ecdc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3360322 Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r--zephyr/dts/bindings/usbc/pericom,pi3usb9201.yaml1
-rw-r--r--zephyr/shim/src/bc12_pi3usb9201.c10
2 files changed, 4 insertions, 7 deletions
diff --git a/zephyr/dts/bindings/usbc/pericom,pi3usb9201.yaml b/zephyr/dts/bindings/usbc/pericom,pi3usb9201.yaml
index d72fa20a47..41e1501684 100644
--- a/zephyr/dts/bindings/usbc/pericom,pi3usb9201.yaml
+++ b/zephyr/dts/bindings/usbc/pericom,pi3usb9201.yaml
@@ -11,7 +11,6 @@ properties:
irq:
type: phandles
- required: true
description: |
GPIO interrupt from BC1.2
diff --git a/zephyr/shim/src/bc12_pi3usb9201.c b/zephyr/shim/src/bc12_pi3usb9201.c
index a55b6f394b..d6bf679ef8 100644
--- a/zephyr/shim/src/bc12_pi3usb9201.c
+++ b/zephyr/shim/src/bc12_pi3usb9201.c
@@ -30,12 +30,10 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
};
#define BC12_GPIO_ENABLE_INTERRUPT(inst) \
- do { \
- if (DT_INST_NODE_HAS_PROP(inst, irq)) { \
- gpio_enable_interrupt( \
- GPIO_SIGNAL(DT_INST_PHANDLE(inst, irq))); \
- } \
- } while (0);
+ IF_ENABLED(DT_INST_NODE_HAS_PROP(inst, irq), \
+ (gpio_enable_interrupt( \
+ GPIO_SIGNAL(DT_INST_PHANDLE(inst, irq)))) \
+ );
static void bc12_enable_irqs(void)
{