linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org, Rob Herring <robh+dt@kernel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers
Date: Sun, 11 Oct 2020 17:30:30 +0100	[thread overview]
Message-ID: <20201011163031.240708-2-jic23@kernel.org> (raw)
In-Reply-To: <20201011163031.240708-1-jic23@kernel.org>

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

This can be used via $ref by bindings that are consumers of the
channels provided by IIO devices.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 .../devicetree/bindings/iio/iio-bindings.txt  | 53 -----------------
 .../devicetree/bindings/iio/iio-consumer.yaml | 59 +++++++++++++++++++
 2 files changed, 59 insertions(+), 53 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt
index aa63cac7323e..cfaed2b54fa9 100644
--- a/Documentation/devicetree/bindings/iio/iio-bindings.txt
+++ b/Documentation/devicetree/bindings/iio/iio-bindings.txt
@@ -47,56 +47,3 @@ Example for a configuration with trigger:
 		};
 	};
 
-==IIO consumers==
-
-Required properties:
-io-channels:	List of phandle and IIO specifier pairs, one pair
-		for each IIO input to the device. Note: if the
-		IIO provider specifies '0' for #io-channel-cells,
-		then only the phandle portion of the pair will appear.
-
-Optional properties:
-io-channel-names:
-		List of IIO input name strings sorted in the same
-		order as the io-channels property. Consumers drivers
-		will use io-channel-names to match IIO input names
-		with IIO specifiers.
-io-channel-ranges:
-		Empty property indicating that child nodes can inherit named
-		IIO channels from this node. Useful for bus nodes to provide
-		and IIO channel to their children.
-
-For example:
-
-	device {
-		io-channels = <&adc 1>, <&ref 0>;
-		io-channel-names = "vcc", "vdd";
-	};
-
-This represents a device with two IIO inputs, named "vcc" and "vdd".
-The vcc channel is connected to output 1 of the &adc device, and the
-vdd channel is connected to output 0 of the &ref device.
-
-==Example==
-
-	adc: max1139@35 {
-		compatible = "maxim,max1139";
-		reg = <0x35>;
-		#io-channel-cells = <1>;
-	};
-
-	...
-
-	iio-hwmon {
-		compatible = "iio-hwmon";
-		io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
-			<&adc 3>, <&adc 4>, <&adc 5>,
-			<&adc 6>, <&adc 7>, <&adc 8>,
-			<&adc 9>;
-	};
-
-	some_consumer {
-		compatible = "some-consumer";
-		io-channels = <&adc 10>, <&adc 11>;
-		io-channel-names = "adc1", "adc2";
-	};
diff --git a/Documentation/devicetree/bindings/iio/iio-consumer.yaml b/Documentation/devicetree/bindings/iio/iio-consumer.yaml
new file mode 100644
index 000000000000..5f28cc29edce
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/iio-consumer.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/iio-consumer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic IIO consumer-bindings
+
+maintainers:
+  - Jonathan Cameron <jic23@kernel.org>
+
+description:
+  This binding describes generic properties a consumer of the channels
+  provided by an IIO device may use.
+
+  As well, direct readings of channels on an IIO Device, an IIO device
+  can provide services to consumer devices. Thes are in the form of
+  channel readings and properties.  For example, an ADC might provide
+  3 channels to an analog accelerometer so that an accelerometer
+  driver can use them to read the voltages that correspond to the
+  accelerations on the 3 axis and apply appropriate calibration to
+  provide useful outputs.
+
+properties:
+  io-channels:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: >
+      List of phandle and IIO specifier pairs, one pair
+      for each IIO input to the device. Note: if the
+      IIO provider specifies '0' for #io-channel-cells,
+      then only the phandle portion of the pair will appear.
+
+  io-channel-names:
+    $ref: /schemas/types.yaml#/definitions/string-array
+    description: >
+      List of names associated with a given IIO channel by the consumer
+      device.  An example for an analog accelerometer would be "accel_x".
+      Consumers drivers will use io-channel-names to locate the correct
+      phandle based reference in io-channels.
+
+  io-channel-ranges:
+    type: boolean
+    description: >
+      Empty property indicating that child nodes can inherit named
+      IIO channels from this node. Useful for bus nodes to provide
+      and IIO channel to their children.
+
+additionalProperties: true
+
+examples:
+ - |
+   iio-hwmon {
+       compatible = "iio-hwmon";
+       io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
+                     <&adc 3>, <&adc 4>, <&adc 5>,
+                     <&adc 6>, <&adc 7>, <&adc 8>,
+                     <&adc 9>;
+   };
+...
\ No newline at end of file
-- 
2.28.0


  reply	other threads:[~2020-10-11 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-11 16:30 [PATCH 0/2] dt-bindings:iio:consumer yaml bindings Jonathan Cameron
2020-10-11 16:30 ` Jonathan Cameron [this message]
2020-10-12 13:30   ` [PATCH 1/2] dt-bindings:iio:iio-consumer add yaml binding for IIO consumers Rob Herring
2020-10-11 16:30 ` [PATCH 2/2] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron
2020-10-11 20:35   ` Peter Rosin

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=20201011163031.240708-2-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=linux-iio@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).