[PATCH 02/18] dt-bindings: iio: adc: ad4170-4: Restrict channel inputs to valid codes

From: Janani Sunil

Date: Thu Dec 03 2026 - 10:21:07 EST


single-channel and common-mode-channel select the CHANNEL_MAPn AINP_N
and AINM_N inputs just like diff-channels does, but they are not
constrained at all, so any number passes validation. Likewise, the
adi,excitation-pin properties accept codes 9 to 16, which
CURRENT_SOURCEn I_OUT_PIN marks reserved.

Apply the diff-channels constraints to single-channel and
common-mode-channel: AIN0 to AIN8 and the special inputs 17 to 29, with
no DAC output on devices without an integrated DAC. Restrict the
excitation pins to AIN0 to AIN8 and GPIO0 to GPIO3.

Fixes: 1b3cee41235b ("dt-bindings: iio: adc: Add AD4170-4")
Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
---
.../devicetree/bindings/iio/adc/adi,ad4170-4.yaml | 34 +++++++++++++++++-----
1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4170-4.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4170-4.yaml
index ef5ca2ed8210..90ca4e39c216 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad4170-4.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad4170-4.yaml
@@ -153,6 +153,14 @@ allOf:
anyOf:
- maximum: 19
- minimum: 21
+ single-channel:
+ anyOf:
+ - maximum: 19
+ - minimum: 21
+ common-mode-channel:
+ anyOf:
+ - maximum: 19
+ - minimum: 21

# Only AD4170-4 can be clocked by an external crystal. The other devices
# have no XTAL1 and XTAL2 pins.
@@ -283,6 +291,20 @@ patternProperties:
enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29]

+ single-channel:
+ description:
+ Positive input of a pseudo-differential channel. Uses the same input
+ numbers as diff-channels.
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29]
+
+ common-mode-channel:
+ description:
+ Negative input of a pseudo-differential channel. Uses the same input
+ numbers as diff-channels.
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29]
+
adi,reference-select:
description: |
Select the reference source to use when converting on the
@@ -323,8 +345,7 @@ patternProperties:
Analog input to apply excitation current to while the channel
is active.
$ref: /schemas/types.yaml#/definitions/uint32
- minimum: 0
- maximum: 20
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20]
default: 0

adi,excitation-pin-1:
@@ -332,8 +353,7 @@ patternProperties:
Analog input to apply excitation current to while the channel
is active.
$ref: /schemas/types.yaml#/definitions/uint32
- minimum: 0
- maximum: 20
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20]
default: 0

adi,excitation-pin-2:
@@ -341,8 +361,7 @@ patternProperties:
Analog input to apply excitation current to while the channel
is active.
$ref: /schemas/types.yaml#/definitions/uint32
- minimum: 0
- maximum: 20
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20]
default: 0

adi,excitation-pin-3:
@@ -350,8 +369,7 @@ patternProperties:
Analog input to apply excitation current to while the channel
is active.
$ref: /schemas/types.yaml#/definitions/uint32
- minimum: 0
- maximum: 20
+ enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 17, 18, 19, 20]
default: 0

adi,excitation-current-0-microamp:

--
2.43.0