[PATCH v2 1/4] dt-bindings: iio: hmc425a: add conditional GPIO array size constraints

From: Dumitru Ceclan
Date: Wed Jan 10 2024 - 10:39:00 EST


ADRF5740 and HMC540S have a 4 bit parallel interface.
Update ctr-gpios description and min/maxItems values depending on the
matched compatible to correctly reflect the hardware properties.

Signed-off-by: Dumitru Ceclan <mitrutzceclan@xxxxxxxxx>
---
.../bindings/iio/amplifiers/adi,hmc425a.yaml | 33 +++++++++++++++++--
1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml b/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml
index 67de9d4e3a1d..a434cb8ddcc9 100644
--- a/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml
+++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml
@@ -33,11 +33,38 @@ properties:

ctrl-gpios:
description:
- Must contain an array of 6 GPIO specifiers, referring to the GPIO pins
- connected to the control pins V1-V6.
- minItems: 6
+ Must contain an array of GPIO specifiers, referring to the GPIO pins
+ connected to the control pins.
+ ADRF5740 - 4 GPIO connected to D2-D5
+ HMC540S - 4 GPIO connected to V1-V4
+ HMC425A - 6 GPIO connected to V1-V6
+ minItems: 1
maxItems: 6

+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: adi,hmc425a
+ then:
+ properties:
+ ctrl-gpios:
+ minItems: 6
+ maxItems: 6
+ - if:
+ properties:
+ compatible:
+ contains:
+ anyOf:
+ - const: adi,adrf5740
+ - const: adi,hmc540s
+ then:
+ properties:
+ ctrl-gpios:
+ minItems: 4
+ maxItems: 4
+
required:
- compatible
- ctrl-gpios
--
2.42.0