mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@linux.dev>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Matti Vaittinen <matti.vaittinen@linux.dev>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	"Radu Sabau" <radu.sabau@analog.com>,
	"Janani Sunil" <janani.sunil@analog.com>,
	"Salih Erim" <salih.erim@amd.com>,
	"Jishnu Prakash" <jishnu.prakash@oss.qualcomm.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Jakub Szczudlo" <jakubszczudlo40@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] dt-bindings: iio: Support ROHM BD79111
Date: Wed, 18 Nov 2026 16:19:11 +0200	[thread overview]
Message-ID: <f69b996cc07fad1712871fb8b0436c71abd435b9.1795009599.git.mazziesaccount@gmail.com> (raw)
In-Reply-To: <cover.1795009599.git.mazziesaccount@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4096 bytes --]

From: Matti Vaittinen <mazziesaccount@gmail.com>

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@gmail.com>

---

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?
---
 .../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@gmail.com>
 
 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-11-18 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:18 [PATCH 0/2] Support ROHM BD79111 ADC/GPIO Matti Vaittinen
2026-11-18 14:19 ` Matti Vaittinen [this message]
2026-11-18 14:19 ` [PATCH 2/2] iio: adc: rohm-bd79112: Support ROHM BD79111 Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f69b996cc07fad1712871fb8b0436c71abd435b9.1795009599.git.mazziesaccount@gmail.com \
    --to=matti.vaittinen@linux.dev \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jakubszczudlo40@gmail.com \
    --cc=janani.sunil@analog.com \
    --cc=jic23@kernel.org \
    --cc=jishnu.prakash@oss.qualcomm.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=radu.sabau@analog.com \
    --cc=robh@kernel.org \
    --cc=salih.erim@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®