devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Iain Hunter <drhunter95@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: iain@hunterembedded.co.uk, Iain Hunter <drhunter95@gmail.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 1/2] Add binding for ti,adc1018. It allows selection of channel as a Device Tree property
Date: Fri, 31 Dec 2021 13:19:15 +0000	[thread overview]
Message-ID: <20211231131951.1245508-1-drhunter95@gmail.com> (raw)

New binding file uses the adc.yaml to define channel selection 

Signed-off-by: Iain Hunter <drhunter95@gmail.com>
---
 .../bindings/iio/adc/ti,ads1018.yaml          | 126 ++++++++++++++++++
 1 file changed, 126 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1018.yaml

diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1018.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1018.yaml
new file mode 100644
index 000000000000..a65fee9d83dd
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1018.yaml
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads1018.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI ADS1018 4 channel I2C analog to digital converter
+
+maintainers:
+  - Iain Hunter <iain@hunterembedded.co.uk>
+
+description: |
+  Datasheet at: https://www.ti.com/lit/gpn/ads1018
+  Supports both single ended and differential channels.
+
+properties:
+  compatible:
+    const: ti,ads1018
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  "#io-channel-cells":
+    const: 1
+
+  spi-max-frequency: true
+  spi-cpol: true
+  spi-cpha: true
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - spi-cpha
+
+additionalProperties: false
+
+patternProperties:
+  "^channel@([0-3])$":
+    $ref: "adc.yaml"
+    type: object
+
+    properties:
+      reg:
+        description: |
+            Must be 0, actual channel selected in ti,adc-channels for single ended
+            or ti-adc-channels-diff for differential
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0]
+
+      ti,adc-channels:
+        description: |
+          List of single-ended channels muxed for this ADC. It can have up to 4
+          channels numbered 0-3
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+        deprecated: true
+
+      ti,adc-diff-channels:
+        description: |
+          List of differential channels muxed for this ADC between the pins vinp
+          and vinn. The 4 possible options are:
+          vinp=0, vinn=1
+          vinp=0, vinn=3
+          vinp=1, vinn=3
+          vinp=2, vinn=3
+
+          They are listed in a pair <vinp vinn>.
+
+          Note: At least one of "ti,adc-channels" or "ti,adc-diff-channels" is
+          required.
+        $ref: /schemas/types.yaml#/definitions/uint32-matrix
+        items:
+          items:
+            - description: |
+                "vinp" indicates positive input number
+              minimum: 0
+              maximum: 2
+            - description: |
+                "vinn" indicates negative input number
+              minimum: 1
+              maximum: 3
+
+
+    required:
+      - reg
+
+examples:
+  - |
+    // example on SPI1 with single ended channel 1
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@1 {
+            compatible = "ti,ads1018";
+            reg = <0x0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            spi-cpha;
+            ti,adc-channels = <1>;
+        };
+    };
+  - |
+    // example on SPI0 with differential between inputs 0 and 3
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@0 {
+            compatible = "ti,ads1018";
+            reg = <0x0>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            spi-cpha;
+            ti,adc-diff-channels = <0 3>;
+        };
+    };
+
+...
-- 
2.25.1


             reply	other threads:[~2021-12-31 13:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 13:19 Iain Hunter [this message]
2022-01-01 22:01 ` [PATCH v4 1/2] Add binding for ti,adc1018. It allows selection of channel as a Device Tree property Rob Herring
2022-01-04 15:53 ` Rob Herring
2022-01-09 11:17 ` Jonathan Cameron
2022-01-09 14:29   ` iain
2022-01-09 16:49     ` Jonathan Cameron

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=20211231131951.1245508-1-drhunter95@gmail.com \
    --to=drhunter95@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=iain@hunterembedded.co.uk \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).