Re: [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111
From: Conor Dooley
Date: Wed Nov 18 2026 - 12:38:05 EST
On Wed, Nov 18, 2026 at 04:19:11PM +0200, Matti Vaittinen wrote:
> From: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
>
> ROHM BD79111 is very similar to the BD79112. Both are ADC/GPIO devices,
> where pins can be configured to be either used as GPIO or ADC inputs.
> ADCs are 12-bit SAR ADCs and GPIOs support input/output but not being IRQ
> sources.
>
> The main difference is amount of channels/GPIOs. The BD79112 has 32 pins
> for this use, the BD79111 has 16. Furthermore, the BD79111 data-sheet
> promises 0.5 MSPS sample rate with maximum of 10 MHz SPI clock, whereas
> the BD79112 data-sheet mentioned 1MSPS rate with maximum of 20 MHz SPI
> clock.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
>
> ---
>
> Note, I had to change the 'root-level' additionalProperties: false to
> unevaluatedProperties: false in order to allow the properties in the new
> allOf:
> - if:
> ...
>
> section. It seems to me this is what a few other bindings in IIO do, but
> I suppose it makes this "less strict". Well, since I am terrible with
> writing bindings, I'd better point this out and ask if it's ok, or if
> there are better way(s) to handle this?
I don't think you should have to do that though, since the children are
described in the same file.
If you instead retained the pattern properties section, and lowered the
restriction to channel@<any number> with reg with the max of 31 and in
the conditional section constrained reg to a max of 16 does it work
without the unevaluatedProperties change? We typically want properties
defined at the top level and constrained in conditional sections anyway.
Chees,
Conor.
> ---
> .../bindings/iio/adc/rohm,bd79112.yaml | 72 +++++++++++++------
> 1 file changed, 50 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml b/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml
> index aa8b07c3fac1..4f105124ee6f 100644
> --- a/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/rohm,bd79112.yaml
> @@ -4,18 +4,21 @@
> $id: http://devicetree.org/schemas/iio/adc/rohm,bd79112.yaml#
> $schema: http://devicetree.org/meta-schemas/core.yaml#
>
> -title: ROHM BD79112 ADC/GPO
> +title: ROHM BD79111 and BD79112 ADC/GPIO
>
> maintainers:
> - Matti Vaittinen <mazziesaccount@xxxxxxxxx>
>
> description: |
> - The ROHM BD79112 is a 12-bit, 32-channel, SAR ADC. ADC input pins can be
> - also configured as general purpose inputs/outputs. SPI should use MODE 3.
> + The ROHM BD79112 is a 12-bit, 32-channel, SAR ADC. The ROHM BD79111 is
> + a 12-bit, 16-channel, SAR ADC. ADC input pins can be also configured as
> + general purpose inputs/outputs. SPI should use MODE 3.
>
> properties:
> compatible:
> - const: rohm,bd79112
> + enum:
> + - rohm,bd79111
> + - rohm,bd79112
>
> reg:
> maxItems: 1
> @@ -37,23 +40,6 @@ properties:
> "#size-cells":
> const: 0
>
> -patternProperties:
> - "^channel@([0-9]|[12][0-9]|3[01])$":
> - type: object
> - $ref: /schemas/iio/adc/adc.yaml#
> - description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> -
> - properties:
> - reg:
> - description: AIN pin number
> - minimum: 0
> - maximum: 31
> -
> - required:
> - - reg
> -
> - additionalProperties: false
> -
> required:
> - compatible
> - reg
> @@ -62,7 +48,49 @@ required:
> - spi-cpha
> - spi-cpol
>
> -additionalProperties: false
> +unevaluatedProperties: false
> +
> +allOf:
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: rohm,bd79112
> + then:
> + patternProperties:
> + "^channel@([0-9]|[12][0-9]|3[01])$":
> + type: object
> + $ref: /schemas/iio/adc/adc.yaml#
> + description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> +
> + properties:
> + reg:
> + description: AIN pin number
> + minimum: 0
> + maximum: 31
> +
> + required:
> + - reg
> +
> + additionalProperties: false
> + else:
> + # BD79111 has only 16 channels
> + patternProperties:
> + "^channel@([0-9]|1[0-5])$":
> + type: object
> + $ref: /schemas/iio/adc/adc.yaml#
> + description: Represents ADC channel. Omitted channels' inputs are GPIOs.
> +
> + properties:
> + reg:
> + description: AIN pin number
> + minimum: 0
> + maximum: 15
> +
> + required:
> + - reg
> +
> + additionalProperties: false
>
> examples:
> - |
> --
> 2.56.1
>
Attachment:
signature.asc
Description: PGP signature