devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers
@ 2020-10-31 18:12 Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 01/10] dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema Jonathan Cameron
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron

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

Firstly drop the old text file as the consumer binding (and the other
parts of that file) are under review for inclusion in the dt-schema external
repo.

This only converts consumers that happen to also be IIO drivers.
Others may get done as part of SoC binding conversions or I may do a lot
of them at somepoint.

A few of the examples in existing text files used providers that were
documented in trivial-bindings.yaml which does not allow for
#io-channel-cells. I have pulled those out to their own files as part
of this patch set.

The iio-mux binding is not done as that has some dependencies and will
form part of some future patch set.

There is no explicit dependency in here on any other sets, but some
noise will occur in trivial-bindings.yaml if applied in a different
order to I happen to have them sets locally.

Jonathan Cameron (10):
  dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema
  dt-bindings:iio:dac:dpot-dac: yaml conversion.
  dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding
  dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.
  dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.
  dt-bindings:iio:afe:current-sense-shunt: txt to yaml conversion. 
  dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
  dt-bindings:iio:afe:voltage-divider: txt to yaml conversion
  dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
  dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.

 .../bindings/iio/adc/envelope-detector.txt    |  54 -------
 .../bindings/iio/adc/envelope-detector.yaml   |  87 +++++++++++
 .../bindings/iio/adc/maxim,max1027.yaml       |  64 ++++++++
 .../iio/afe/current-sense-amplifier.txt       |  26 ----
 .../iio/afe/current-sense-amplifier.yaml      |  55 +++++++
 .../bindings/iio/afe/current-sense-shunt.txt  |  41 -----
 .../bindings/iio/afe/current-sense-shunt.yaml |  65 ++++++++
 .../bindings/iio/afe/voltage-divider.txt      |  53 -------
 .../bindings/iio/afe/voltage-divider.yaml     |  88 +++++++++++
 .../devicetree/bindings/iio/dac/dpot-dac.txt  |  41 -----
 .../devicetree/bindings/iio/dac/dpot-dac.yaml |  64 ++++++++
 .../devicetree/bindings/iio/iio-bindings.txt  | 102 -------------
 .../bindings/iio/light/capella,cm3605.yaml    |  78 ++++++++++
 .../devicetree/bindings/iio/light/cm3605.txt  |  41 -----
 .../iio/potentiometer/microchip,mcp4531.yaml  | 116 +++++++++++++++
 .../bindings/iio/potentiostat/lmp91000.txt    |  33 -----
 .../iio/potentiostat/ti,lmp91000.yaml         |  68 +++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 140 ------------------
 18 files changed, 685 insertions(+), 531 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/adc/envelope-detector.txt
 create mode 100644 Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml
 create mode 100644 Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt
 create mode 100644 Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt
 create mode 100644 Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/afe/voltage-divider.txt
 create mode 100644 Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
 create mode 100644 Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/iio-bindings.txt
 create mode 100644 Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/light/cm3605.txt
 create mode 100644 Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4531.yaml
 delete mode 100644 Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
 create mode 100644 Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml

-- 
2.28.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/10] dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 02/10] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron

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

File contained generic IIO wide bindings.
Now part of the external dt-schema repository.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 .../devicetree/bindings/iio/iio-bindings.txt  | 102 ------------------
 1 file changed, 102 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/iio-bindings.txt b/Documentation/devicetree/bindings/iio/iio-bindings.txt
deleted file mode 100644
index aa63cac7323e..000000000000
--- a/Documentation/devicetree/bindings/iio/iio-bindings.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-This binding is derived from clock bindings, and based on suggestions
-from Lars-Peter Clausen [1].
-
-Sources of IIO channels can be represented by any node in the device
-tree. Those nodes are designated as IIO providers. IIO consumer
-nodes use a phandle and IIO specifier pair to connect IIO provider
-outputs to IIO inputs. Similar to the gpio specifiers, an IIO
-specifier is an array of one or more cells identifying the IIO
-output on a device. The length of an IIO specifier is defined by the
-value of a #io-channel-cells property in the IIO provider node.
-
-[1] https://marc.info/?l=linux-iio&m=135902119507483&w=2
-
-==IIO providers==
-
-Required properties:
-#io-channel-cells: Number of cells in an IIO specifier; Typically 0 for nodes
-		   with a single IIO output and 1 for nodes with multiple
-		   IIO outputs.
-
-Optional properties:
-label:		   A symbolic name for the device.
-
-
-Example for a simple configuration with no trigger:
-
-	adc: voltage-sensor@35 {
-		compatible = "maxim,max1139";
-		reg = <0x35>;
-		#io-channel-cells = <1>;
-		label = "voltage_feedback_group1";
-	};
-
-Example for a configuration with trigger:
-
-	adc@35 {
-		compatible = "some-vendor,some-adc";
-		reg = <0x35>;
-
-		adc1: iio-device@0 {
-			#io-channel-cells = <1>;
-			/* other properties */
-		};
-		adc2: iio-device@1 {
-			#io-channel-cells = <1>;
-			/* other properties */
-		};
-	};
-
-==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";
-	};
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/10] dt-bindings:iio:dac:dpot-dac: yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 01/10] dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 03/10] dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding Jonathan Cameron
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

Txt to yaml format conversion.  I dropped the example section
describing the measurement ADC, as that isn't strictly part
of this binding.

Uses the new dt-schema/schema/iio/iio-consumer.yaml schema.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../devicetree/bindings/iio/dac/dpot-dac.txt  | 41 ------------
 .../devicetree/bindings/iio/dac/dpot-dac.yaml | 64 +++++++++++++++++++
 2 files changed, 64 insertions(+), 41 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt b/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
deleted file mode 100644
index fdf47a01bfef..000000000000
--- a/Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Bindings for DAC emulation using a digital potentiometer
-
-It is assumed that the dpot is used as a voltage divider between the
-current dpot wiper setting and the maximum resistance of the dpot. The
-divided voltage is provided by a vref regulator.
-
-                  .------.
-   .-----------.  |      |
-   | vref      |--'    .---.
-   | regulator |--.    |   |
-   '-----------'  |    | d |
-                  |    | p |
-                  |    | o |  wiper
-                  |    | t |<---------+
-                  |    |   |
-                  |    '---'       dac output voltage
-                  |      |
-                  '------+------------+
-
-Required properties:
-- compatible: Should be "dpot-dac"
-- vref-supply: The regulator supplying the voltage divider.
-- io-channels: Channel node of the dpot to be used for the voltage division.
-- io-channel-names: Should be "dpot".
-
-Example:
-
-	&i2c {
-		dpot: mcp4651-503@28 {
-			compatible = "microchip,mcp4651-503";
-			reg = <0x28>;
-			#io-channel-cells = <1>;
-		};
-	};
-
-	dac {
-		compatible = "dpot-dac";
-		vref-supply = <&reg_3v3>;
-		io-channels = <&dpot 0>;
-		io-channel-names = "dpot";
-	};
diff --git a/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml
new file mode 100644
index 000000000000..6a7ca8e432d1
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/dpot-dac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: DAC emulation using a digital potentiometer
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  It is assumed that the dpot is used as a voltage divider between the
+  current dpot wiper setting and the maximum resistance of the dpot. The
+  divided voltage is provided by a vref regulator.
+
+                  .------.
+   .-----------.  |      |
+   | vref      |--'    .---.
+   | regulator |--.    |   |
+   '-----------'  |    | d |
+                  |    | p |
+                  |    | o |  wiper
+                  |    | t |<---------+
+                  |    |   |
+                  |    '---'       dac output voltage
+                  |      |
+                  '------+------------+
+
+properties:
+  compatible:
+    const: dpot-dac
+
+  vref-supply:
+    description: Regulator supplying the voltage divider.
+
+  io-channels:
+    maxItems: 1
+    description: |
+      Channel node of the dpot to be used for the voltage division.
+
+  io-channel-names:
+    const: dpot
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - vref-supply
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    dac {
+        compatible = "dpot-dac";
+        vref-supply = <&reg_3v3>;
+        io-channels = <&dpot 0>;
+        io-channel-names = "dpot";
+    };
+...
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/10] dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 01/10] dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 02/10] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 04/10] dt-bindings:iio:adc:envelope-detector: txt to yaml conversion Jonathan Cameron
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

We use this part in an example for the envelope detector. That showed
that we need to allow for the #io-channel-cells property which
trivial-devices.yaml does not.

It doesn't make sense to add that property to trivial-devices as
it only applies for those devices that can provide some sort of
DAC or ADC service to another device driver.  Hence solution will
be to pull some IIO devices out to have their own file on a case
by case basis.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../iio/potentiometer/microchip,mcp4531.yaml  | 116 ++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 128 ------------------
 2 files changed, 116 insertions(+), 128 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4531.yaml b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4531.yaml
new file mode 100644
index 000000000000..5c4b9b9181ae
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4531.yaml
@@ -0,0 +1,116 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/potentiometer/microchip,mcp4531.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip mcp4531 and similar potentiometers.
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  Family of I2C digital potentiometer
+  Datasheets at:
+  * volatile https://ww1.microchip.com/downloads/en/DeviceDoc/22096b.pdf
+  * non-volatile https://ww1.microchip.com/downloads/en/DeviceDoc/22107B.pdf
+  Part numbers as follows: mcp4ABC-XXX where
+  A =   5 (1 wiper), 6 (2 wipers)
+  B =   3 (7-bit, volatile), 4 (7-bit, non-volatile),
+        5 (8-bit, volatile), 6 (8-bit, non-volatile),
+  C:    1 (potentiometer), 2 (rheostat)
+  XXX = 502 (5 kOhms), 103 (10 kOhms), 503 (50 kOhms), 104 (100 kOhms)
+
+properties:
+  compatible:
+    enum:
+        # Ordering reflects part number + range, so 502 < 103 etc
+      - microchip,mcp4531-502
+      - microchip,mcp4531-103
+      - microchip,mcp4531-503
+      - microchip,mcp4531-104
+      - microchip,mcp4532-502
+      - microchip,mcp4532-103
+      - microchip,mcp4532-503
+      - microchip,mcp4532-104
+      - microchip,mcp4541-502
+      - microchip,mcp4541-103
+      - microchip,mcp4541-503
+      - microchip,mcp4541-104
+      - microchip,mcp4542-502
+      - microchip,mcp4542-103
+      - microchip,mcp4542-503
+      - microchip,mcp4542-104
+      - microchip,mcp4551-502
+      - microchip,mcp4551-103
+      - microchip,mcp4551-503
+      - microchip,mcp4551-104
+      - microchip,mcp4552-502
+      - microchip,mcp4552-103
+      - microchip,mcp4552-503
+      - microchip,mcp4552-104
+      - microchip,mcp4561-502
+      - microchip,mcp4561-103
+      - microchip,mcp4561-503
+      - microchip,mcp4561-104
+      - microchip,mcp4562-502
+      - microchip,mcp4562-103
+      - microchip,mcp4562-503
+      - microchip,mcp4562-104
+      - microchip,mcp4631-502
+      - microchip,mcp4631-103
+      - microchip,mcp4631-503
+      - microchip,mcp4631-104
+      - microchip,mcp4632-502
+      - microchip,mcp4632-103
+      - microchip,mcp4632-503
+      - microchip,mcp4632-104
+      - microchip,mcp4641-502
+      - microchip,mcp4641-103
+      - microchip,mcp4641-503
+      - microchip,mcp4641-104
+      - microchip,mcp4642-502
+      - microchip,mcp4642-103
+      - microchip,mcp4642-503
+      - microchip,mcp4642-104
+      - microchip,mcp4651-502
+      - microchip,mcp4651-103
+      - microchip,mcp4651-503
+      - microchip,mcp4651-104
+      - microchip,mcp4652-502
+      - microchip,mcp4652-103
+      - microchip,mcp4652-503
+      - microchip,mcp4652-104
+      - microchip,mcp4661-502
+      - microchip,mcp4661-103
+      - microchip,mcp4661-503
+      - microchip,mcp4661-104
+      - microchip,mcp4662-502
+      - microchip,mcp4662-103
+      - microchip,mcp4662-503
+      - microchip,mcp4662-104
+
+  reg:
+    maxItems: 1
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        dpot: dpot@28 {
+            compatible = "microchip,mcp4651-104";
+            reg = <0x28>;
+            #io-channel-cells = <1>;
+        };
+    };
+...
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index cb4fd8f29675..d154ea97e30d 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -186,134 +186,6 @@ properties:
           - microchip,mcp4019-503
             # Microchip 7-bit Single I2C Digital POT (100k)
           - microchip,mcp4019-104
-            # Microchip 7-bit Single I2C Digital Potentiometer (5k)
-          - microchip,mcp4531-502
-            # Microchip 7-bit Single I2C Digital Potentiometer (10k)
-          - microchip,mcp4531-103
-            # Microchip 7-bit Single I2C Digital Potentiometer (50k)
-          - microchip,mcp4531-503
-            # Microchip 7-bit Single I2C Digital Potentiometer (100k)
-          - microchip,mcp4531-104
-            # Microchip 7-bit Single I2C Digital Potentiometer (5k)
-          - microchip,mcp4532-502
-            # Microchip 7-bit Single I2C Digital Potentiometer (10k)
-          - microchip,mcp4532-103
-            # Microchip 7-bit Single I2C Digital Potentiometer (50k)
-          - microchip,mcp4532-503
-            # Microchip 7-bit Single I2C Digital Potentiometer (100k)
-          - microchip,mcp4532-104
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4541-502
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4541-103
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4541-503
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4541-104
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4542-502
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4542-103
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4542-503
-            # Microchip 7-bit Single I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4542-104
-            # Microchip 8-bit Single I2C Digital Potentiometer (5k)
-          - microchip,mcp4551-502
-            # Microchip 8-bit Single I2C Digital Potentiometer (10k)
-          - microchip,mcp4551-103
-            # Microchip 8-bit Single I2C Digital Potentiometer (50k)
-          - microchip,mcp4551-503
-            # Microchip 8-bit Single I2C Digital Potentiometer (100k)
-          - microchip,mcp4551-104
-            # Microchip 8-bit Single I2C Digital Potentiometer (5k)
-          - microchip,mcp4552-502
-            # Microchip 8-bit Single I2C Digital Potentiometer (10k)
-          - microchip,mcp4552-103
-            # Microchip 8-bit Single I2C Digital Potentiometer (50k)
-          - microchip,mcp4552-503
-            # Microchip 8-bit Single I2C Digital Potentiometer (100k)
-          - microchip,mcp4552-104
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4561-502
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4561-103
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4561-503
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4561-104
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4562-502
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4562-103
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4562-503
-            # Microchip 8-bit Single I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4562-104
-            # Microchip 7-bit Dual I2C Digital Potentiometer (5k)
-          - microchip,mcp4631-502
-            # Microchip 7-bit Dual I2C Digital Potentiometer (10k)
-          - microchip,mcp4631-103
-            # Microchip 7-bit Dual I2C Digital Potentiometer (50k)
-          - microchip,mcp4631-503
-            # Microchip 7-bit Dual I2C Digital Potentiometer (100k)
-          - microchip,mcp4631-104
-            # Microchip 7-bit Dual I2C Digital Potentiometer (5k)
-          - microchip,mcp4632-502
-            # Microchip 7-bit Dual I2C Digital Potentiometer (10k)
-          - microchip,mcp4632-103
-            # Microchip 7-bit Dual I2C Digital Potentiometer (50k)
-          - microchip,mcp4632-503
-            # Microchip 7-bit Dual I2C Digital Potentiometer (100k)
-          - microchip,mcp4632-104
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4641-502
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4641-103
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4641-503
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4641-104
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4642-502
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4642-103
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4642-503
-            # Microchip 7-bit Dual I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4642-104
-            # Microchip 8-bit Dual I2C Digital Potentiometer (5k)
-          - microchip,mcp4651-502
-            # Microchip 8-bit Dual I2C Digital Potentiometer (10k)
-          - microchip,mcp4651-103
-            # Microchip 8-bit Dual I2C Digital Potentiometer (50k)
-          - microchip,mcp4651-503
-            # Microchip 8-bit Dual I2C Digital Potentiometer (100k)
-          - microchip,mcp4651-104
-            # Microchip 8-bit Dual I2C Digital Potentiometer (5k)
-          - microchip,mcp4652-502
-            # Microchip 8-bit Dual I2C Digital Potentiometer (10k)
-          - microchip,mcp4652-103
-            # Microchip 8-bit Dual I2C Digital Potentiometer (50k)
-          - microchip,mcp4652-503
-            # Microchip 8-bit Dual I2C Digital Potentiometer (100k)
-          - microchip,mcp4652-104
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4661-502
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4661-103
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4661-503
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4661-104
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (5k)
-          - microchip,mcp4662-502
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (10k)
-          - microchip,mcp4662-103
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (50k)
-          - microchip,mcp4662-503
-            # Microchip 8-bit Dual I2C Digital Potentiometer with NV Memory (100k)
-          - microchip,mcp4662-104
             # PWM Fan Speed Controller With Fan Fault Detection
           - microchip,tc654
             # PWM Fan Speed Controller With Fan Fault Detection
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/10] dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (2 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 03/10] dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: " Jonathan Cameron
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

Straight forward format conversion.  The example in here is fun in
that it has 2 separate provider / consumer pairs.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../bindings/iio/adc/envelope-detector.txt    | 54 ------------
 .../bindings/iio/adc/envelope-detector.yaml   | 87 +++++++++++++++++++
 2 files changed, 87 insertions(+), 54 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/envelope-detector.txt b/Documentation/devicetree/bindings/iio/adc/envelope-detector.txt
deleted file mode 100644
index 27544bdd4478..000000000000
--- a/Documentation/devicetree/bindings/iio/adc/envelope-detector.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-Bindings for ADC envelope detector using a DAC and a comparator
-
-The DAC is used to find the peak level of an alternating voltage input
-signal by a binary search using the output of a comparator wired to
-an interrupt pin. Like so:
-                          _
-                         | \
-    input +------>-------|+ \
-                         |   \
-           .-------.     |    }---.
-           |       |     |   /    |
-           |    dac|-->--|- /     |
-           |       |     |_/      |
-           |       |              |
-           |       |              |
-           |    irq|------<-------'
-           |       |
-           '-------'
-
-Required properties:
-- compatible: Should be "axentia,tse850-envelope-detector"
-- io-channels: Channel node of the dac to be used for comparator input.
-- io-channel-names: Should be "dac".
-- interrupt specification for one client interrupt,
-  see ../../interrupt-controller/interrupts.txt for details.
-- interrupt-names: Should be "comp".
-
-Example:
-
-	&i2c {
-		dpot: mcp4651-104@28 {
-			compatible = "microchip,mcp4651-104";
-			reg = <0x28>;
-			#io-channel-cells = <1>;
-		};
-	};
-
-	dac: dac {
-		compatible = "dpot-dac";
-		vref-supply = <&reg_3v3>;
-		io-channels = <&dpot 0>;
-		io-channel-names = "dpot";
-		#io-channel-cells = <1>;
-	};
-
-	envelope-detector {
-		compatible = "axentia,tse850-envelope-detector";
-		io-channels = <&dac 0>;
-		io-channel-names = "dac";
-
-		interrupt-parent = <&gpio>;
-		interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
-		interrupt-names = "comp";
-	};
diff --git a/Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml b/Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml
new file mode 100644
index 000000000000..6048be936aba
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/envelope-detector.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ADC envelope detector using a DAC and a comparator
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  The DAC is used to find the peak level of an alternating voltage input
+  signal by a binary search using the output of a comparator wired to
+  an interrupt pin. Like so:
+                          _
+                         | \
+    input +------>-------|+ \
+                         |   \
+           .-------.     |    }---.
+           |       |     |   /    |
+           |    dac|-->--|- /     |
+           |       |     |_/      |
+           |       |              |
+           |       |              |
+           |    irq|------<-------'
+           |       |
+           '-------'
+
+properties:
+  compatible:
+    const: axentia,tse850-envelope-detector
+
+  io-channels:
+    maxItems: 1
+    description: Channel node of the dac to be used for comparator input.
+
+  io-channel-names:
+    const: dac
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    const: comp
+
+required:
+  - compatible
+  - io-channels
+  - io-channel-names
+  - interrupts
+  - interrupt-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        dpot: dpot@28 {
+            compatible = "microchip,mcp4651-104";
+            reg = <0x28>;
+            #io-channel-cells = <1>;
+        };
+    };
+
+    dac: dac {
+        compatible = "dpot-dac";
+        vref-supply = <&reg_3v3>;
+        io-channels = <&dpot 0>;
+        io-channel-names = "dpot";
+        #io-channel-cells = <1>;
+    };
+
+    envelope-detector {
+        compatible = "axentia,tse850-envelope-detector";
+        io-channels = <&dac 0>;
+        io-channel-names = "dac";
+
+        interrupt-parent = <&gpio>;
+        interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+        interrupt-names = "comp";
+    };
+...
+
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (3 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 04/10] dt-bindings:iio:adc:envelope-detector: txt to yaml conversion Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-11-03 15:55   ` Rob Herring
  2020-10-31 18:12 ` [PATCH 06/10] dt-bindings:iio:afe:current-sense-shunt: " Jonathan Cameron
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

Note this includes a fix in the example where we had *-mul instead of
*-mult.  The binding doc and driver agree that it should be *-mult

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../iio/afe/current-sense-amplifier.txt       | 26 ---------
 .../iio/afe/current-sense-amplifier.yaml      | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt
deleted file mode 100644
index 821b61b8c542..000000000000
--- a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Current Sense Amplifier
-=======================
-
-When an io-channel measures the output voltage from a current sense
-amplifier, the interesting measurement is almost always the current
-through the sense resistor, not the voltage output. This binding
-describes such a current sense circuit.
-
-Required properties:
-- compatible : "current-sense-amplifier"
-- io-channels : Channel node of a voltage io-channel.
-- sense-resistor-micro-ohms : The sense resistance in microohms.
-
-Optional properties:
-- sense-gain-mult: Amplifier gain multiplier. The default is <1>.
-- sense-gain-div: Amplifier gain divider. The default is <1>.
-
-Example:
-
-sysi {
-	compatible = "current-sense-amplifier";
-	io-channels = <&tiadc 0>;
-
-	sense-resistor-micro-ohms = <20000>;
-	sense-gain-mul = <50>;
-};
diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
new file mode 100644
index 000000000000..920bdd8d12d6
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/afe/current-sense-amplifier.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Current Sense Amplifier
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  When an io-channel measures the output voltage from a current sense
+  amplifier, the interesting measurement is almost always the current
+  through the sense resistor, not the voltage output. This binding
+  describes such a current sense circuit.
+
+properties:
+  compatible:
+    const: current-sense-amplifier
+
+  io-channels:
+    maxItems: 1
+    description: |
+      Channel node of a voltage io-channel.
+
+  sense-resistor-micro-ohms:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: The sense resistance.
+
+  sense-gain-mult:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Amplifier gain multiplier. The default is <1>.
+
+  sense-gain-div:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Amplifier gain divider. The default is <1>.
+
+required:
+  - compatible
+  - io-channels
+  - sense-resistor-micro-ohms
+
+additionalProperties: false
+
+examples:
+  - |
+    sysi {
+        compatible = "current-sense-amplifier";
+        io-channels = <&tiadc 0>;
+
+        sense-resistor-micro-ohms = <20000>;
+        sense-gain-mult = <50>;
+    };
+...
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/10] dt-bindings:iio:afe:current-sense-shunt: txt to yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (4 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: " Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc Jonathan Cameron
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

Very simple binding. As such straight forward conversion.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../bindings/iio/afe/current-sense-shunt.txt  | 41 ------------
 .../bindings/iio/afe/current-sense-shunt.yaml | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 41 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt b/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt
deleted file mode 100644
index 0f67108a07b6..000000000000
--- a/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Current Sense Shunt
-===================
-
-When an io-channel measures the voltage over a current sense shunt,
-the interesting measurement is almost always the current through the
-shunt, not the voltage over it. This binding describes such a current
-sense circuit.
-
-Required properties:
-- compatible : "current-sense-shunt"
-- io-channels : Channel node of a voltage io-channel.
-- shunt-resistor-micro-ohms : The shunt resistance in microohms.
-
-Example:
-The system current is measured by measuring the voltage over a
-3.3 ohms shunt resistor.
-
-sysi {
-	compatible = "current-sense-shunt";
-	io-channels = <&tiadc 0>;
-
-	/* Divide the voltage by 3300000/1000000 (or 3.3) for the current. */
-	shunt-resistor-micro-ohms = <3300000>;
-};
-
-&i2c {
-	tiadc: adc@48 {
-		compatible = "ti,ads1015";
-		reg = <0x48>;
-		#io-channel-cells = <1>;
-
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		channel@0 { /* IN0,IN1 differential */
-			reg = <0>;
-			ti,gain = <1>;
-			ti,datarate = <4>;
-		};
-	};
-};
diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml b/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml
new file mode 100644
index 000000000000..2f18409c64e3
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/afe/current-sense-shunt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Current Sense Shunt
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  When an io-channel measures the voltage over a current sense shunt,
+  the interesting measurement is almost always the current through the
+  shunt, not the voltage over it. This binding describes such a current
+  sense circuit.
+
+properties:
+  compatible:
+    const: current-sense-shunt
+
+  io-channels:
+    maxItems: 1
+    description: |
+      Channel node of a voltage io-channel.
+
+  shunt-resistor-micro-ohms:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: The shunt resistance.
+
+required:
+  - compatible
+  - io-channels
+  - shunt-resistor-micro-ohms
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        tiadc: adc@48 {
+            compatible = "ti,ads1015";
+            reg = <0x48>;
+            #io-channel-cells = <1>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            channel@0 { /* IN0,IN1 differential */
+                reg = <0>;
+                ti,gain = <1>;
+                ti,datarate = <4>;
+            };
+        };
+    };
+    sysi {
+        compatible = "current-sense-shunt";
+        io-channels = <&tiadc 0>;
+
+        /* Divide the voltage by 3300000/1000000 (or 3.3) for the current. */
+        shunt-resistor-micro-ohms = <3300000>;
+    };
+...
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (5 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 06/10] dt-bindings:iio:afe:current-sense-shunt: " Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-11-01 13:25   ` Miquel Raynal
  2020-10-31 18:12 ` [PATCH 08/10] dt-bindings:iio:afe:voltage-divider: txt to yaml conversion Jonathan Cameron
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree
  Cc: Jonathan Cameron, Miquel Raynal, Philippe Reynes

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

The afe/voltage-divider.yaml example uses this device with 2 properties
not provided by trivial-devices.yaml (spi-max-frequency and #io-channel-cells)

Solve that by creating a more specific binding doc.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Philippe Reynes <tremyfr@yahoo.fr>
---
 .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 12 ----
 2 files changed, 64 insertions(+), 12 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
new file mode 100644
index 000000000000..09e853c50c76
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/maxim,max1027.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX1027 and similar ADCs
+
+maintainers:
+  - Miquel Raynal <miquel.raynal@bootlin.com>
+  - Philippe Reynes <tremyfr@yahoo.fr>
+
+description: |
+  300ks/s SPI ADCs with temperature sensors.
+
+properties:
+  compatible:
+    enum:
+        # 10-bit 8 channels
+      - maxim,max1027
+        # 10-bit 12 channels
+      - maxim,max1029
+        # 10-bit 16 channels
+      - maxim,max1031
+         # 12-bit 8 channels
+      - maxim,max1227
+         # 12-bit 12 channels
+      - maxim,max1229
+         # 12-bit 16 channels
+      - maxim,max1231
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  spi-max-frequency: true
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+       #address-cells = <1>;
+       #size-cells = <0>;
+        maxadc: adc@0 {
+            compatible = "maxim,max1027";
+            reg = <0>;
+            #io-channel-cells = <1>;
+            interrupt-parent = <&gpio5>;
+            interrupts = <15 IRQ_TYPE_EDGE_RISING>;
+            spi-max-frequency = <1000000>;
+        };
+    };
+...
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index d154ea97e30d..185e09e61e16 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -108,18 +108,6 @@ properties:
           - isil,isl68137
             # 5 Bit Programmable, Pulse-Width Modulator
           - maxim,ds1050
-            # 10-bit 8 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1027
-            # 10-bit 12 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1029
-            # 10-bit 16 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1031
-            # 12-bit 8 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1227
-            # 12-bit 12 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1229
-            # 12-bit 16 channels 300ks/s SPI ADC with temperature sensor
-          - maxim,max1231
             # Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
           - maxim,max1237
             # PECI-to-I2C translator for PECI-to-SMBus/I2C protocol conversion
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/10] dt-bindings:iio:afe:voltage-divider: txt to yaml conversion
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (6 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 18:12 ` [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: " Jonathan Cameron
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Peter Rosin

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

Simple binding so straight forward conversion, though did require
adding a separate binding document for the max1027 to reflect
its abilities to provide channels to consumers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Peter Rosin <peda@axentia.se>
---
 .../bindings/iio/afe/voltage-divider.txt      | 53 -----------
 .../bindings/iio/afe/voltage-divider.yaml     | 88 +++++++++++++++++++
 2 files changed, 88 insertions(+), 53 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt b/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt
deleted file mode 100644
index b452a8406107..000000000000
--- a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Voltage divider
-===============
-
-When an io-channel measures the midpoint of a voltage divider, the
-interesting voltage is often the voltage over the full resistance
-of the divider. This binding describes the voltage divider in such
-a curcuit.
-
-    Vin ----.
-            |
-         .-----.
-         |  R  |
-         '-----'
-            |
-            +---- Vout
-            |
-         .-----.
-         | Rout|
-         '-----'
-            |
-           GND
-
-Required properties:
-- compatible : "voltage-divider"
-- io-channels : Channel node of a voltage io-channel measuring Vout.
-- output-ohms : Resistance Rout over which the output voltage is measured.
-	        See full-ohms.
-- full-ohms : Resistance R + Rout for the full divider. The io-channel
-	      is scaled by the Rout / (R + Rout) quotient.
-
-Example:
-The system voltage is circa 12V, but divided down with a 22/222
-voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC.
-
-sysv {
-	compatible = "voltage-divider";
-	io-channels = <&maxadc 1>;
-
-	/* Scale the system voltage by 22/222 to fit the ADC range. */
-	output-ohms = <22>;
-	full-ohms = <222>; /* 200 + 22 */
-};
-
-&spi {
-	maxadc: adc@0 {
-		compatible = "maxim,max1027";
-		reg = <0>;
-		#io-channel-cells = <1>;
-		interrupt-parent = <&gpio5>;
-		interrupts = <15 IRQ_TYPE_EDGE_RISING>;
-		spi-max-frequency = <1000000>;
-	};
-};
diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
new file mode 100644
index 000000000000..fefce8c9f6dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
@@ -0,0 +1,88 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/afe/voltage-divider.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Voltage divider
+
+maintainers:
+  - Peter Rosin <peda@axentia.se>
+
+description: |
+  When an io-channel measures the midpoint of a voltage divider, the
+  interesting voltage is often the voltage over the full resistance
+  of the divider. This binding describes the voltage divider in such
+  a curcuit.
+
+    Vin ----.
+            |
+         .-----.
+         |  R  |
+         '-----'
+            |
+            +---- Vout
+            |
+         .-----.
+         | Rout|
+         '-----'
+            |
+           GND
+
+
+properties:
+  compatible:
+    const: voltage-divider
+
+  io-channels:
+    maxItems: 1
+    description: |
+      Channel node of a voltage io-channel.
+
+  output-ohms:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Resistance Rout over which the output voltage is measured. See full-ohms.
+
+  full-ohms:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Resistance R + Rout for the full divider. The io-channel is scaled by
+      the Rout / (R + Rout) quotient.
+
+required:
+  - compatible
+  - io-channels
+  - output-ohms
+  - full-ohms
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    /*
+     * The system voltage is circa 12V, but divided down with a 22/222
+     * voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC.
+     */
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        maxadc: adc@0 {
+            compatible = "maxim,max1027";
+            reg = <0>;
+            #io-channel-cells = <1>;
+            interrupt-parent = <&gpio5>;
+            interrupts = <15 IRQ_TYPE_EDGE_RISING>;
+            spi-max-frequency = <1000000>;
+        };
+    };
+    sysv {
+        compatible = "voltage-divider";
+        io-channels = <&maxadc 1>;
+
+        /* Scale the system voltage by 22/222 to fit the ADC range. */
+        output-ohms = <22>;
+        full-ohms = <222>; /* 200 + 22 */
+    };
+...
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (7 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 08/10] dt-bindings:iio:afe:voltage-divider: txt to yaml conversion Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-11-04 14:46   ` Linus Walleij
  2020-10-31 18:12 ` [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: " Jonathan Cameron
  2020-11-03 16:07 ` [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Rob Herring
  10 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Linus Walleij

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

Simple conversion using the new iio-consumers.yaml binding in the
dt-schema.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 .../bindings/iio/light/capella,cm3605.yaml    | 78 +++++++++++++++++++
 .../devicetree/bindings/iio/light/cm3605.txt  | 41 ----------
 2 files changed, 78 insertions(+), 41 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml b/Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml
new file mode 100644
index 000000000000..001c99dbd14e
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/light/capella,cm3605.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title:
+  Capella Microsystems CM3605 Ambient Light and Short Distance Proximity Sensor
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+description: |
+  The CM3605 is an entirely analog part. However, it requires quite a bit of
+  software logic to interface a host operating system.
+
+  This ALS and proximity sensor was one of the very first deployed in mobile
+  handsets, notably it is used in the very first Nexus One Android phone from
+  2010.
+
+properties:
+  compatible:
+    const: capella,cm3605
+
+  aset-gpios:
+    maxItems: 1
+    description:
+      ASET line (drive low to activate the ALS, should be flagged
+      GPIO_ACTIVE_LOW)
+
+  interrupts:
+    maxItems: 1
+    description:
+      Connected to the POUT (proximity sensor out) line. The edge
+      detection must be set to IRQ_TYPE_EDGE_BOTH so as to detect
+      movements toward and away from the proximity sensor.
+
+  io-channels:
+    maxItems: 1
+    description:
+      ADC channel used for converting the voltage from AOUT to a digital
+      representation.
+
+  io-channel-names:
+    const: aout
+
+  vdd-supply: true
+
+  capella,aset-resistance-ohms:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [50000, 100000, 300000, 600000]
+    description: >
+      Sensitivity calibration resistance. Note that calibration curves
+      are only provided for specific allowed values. Default: 100 kOhms.
+
+required:
+  - compatible
+  - aset-gpios
+  - interrupts
+  - io-channels
+  - io-channel-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+    light-sensor {
+        compatible = "capella,cm3605";
+        vdd-supply = <&foo_reg>;
+        aset-gpios = <&foo_gpio 1 GPIO_ACTIVE_LOW>;
+        capella,aset-resistance-ohms = <100000>;
+        interrupts = <1 IRQ_TYPE_EDGE_BOTH>;
+        io-channels = <&adc 0x01>;
+        io-channel-names = "aout";
+    };
+...
diff --git a/Documentation/devicetree/bindings/iio/light/cm3605.txt b/Documentation/devicetree/bindings/iio/light/cm3605.txt
deleted file mode 100644
index 56331a79f9ab..000000000000
--- a/Documentation/devicetree/bindings/iio/light/cm3605.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-Capella Microsystems CM3605
-Ambient Light and Short Distance Proximity Sensor
-
-The CM3605 is an entirely analog part which however require quite a bit of
-software logic to interface a host operating system.
-
-This ALS and proximity sensor was one of the very first deployed in mobile
-handsets, notably it is used in the very first Nexus One Android phone from
-2010.
-
-Required properties:
-- compatible: must be: "capella,cm3605"
-- aset-gpios: GPIO line controlling the ASET line (drive low
-  to activate the ALS, should be flagged GPIO_ACTIVE_LOW)
-- interrupts: the IRQ line (such as a GPIO) that is connected to
-  the POUT (proximity sensor out) line. The edge detection must
-  be set to IRQ_TYPE_EDGE_BOTH so as to detect movements toward
-  and away from the proximity sensor.
-- io-channels: the ADC channel used for converting the voltage from
-  AOUT to a digital representation.
-- io-channel-names: must be "aout"
-
-Optional properties:
-- vdd-supply: regulator supplying VDD power to the component.
-- capella,aset-resistance-ohms: the sensitivity calibration resistance,
-  in Ohms. Valid values are: 50000, 100000, 300000 and 600000,
-  as these are the resistance values that we are supplied with
-  calibration curves for. If not supplied, 100 kOhm will be assumed
-  but it is strongly recommended to supply this.
-
-Example:
-
-cm3605 {
-	compatible = "capella,cm3605";
-	vdd-supply = <&foo_reg>;
-	aset-gpios = <&foo_gpio 1 GPIO_ACTIVE_LOW>;
-	capella,aset-resistance-ohms = <100000>;
-	interrupts = <1 IRQ_TYPE_EDGE_BOTH>;
-	io-channels = <&adc 0x01>;
-	io-channel-names = "aout";
-};
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (8 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: " Jonathan Cameron
@ 2020-10-31 18:12 ` Jonathan Cameron
  2020-10-31 21:41   ` Matt Ranostay
  2020-11-03 16:07 ` [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Rob Herring
  10 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2020-10-31 18:12 UTC (permalink / raw)
  To: linux-iio, Rob Herring, devicetree; +Cc: Jonathan Cameron, Matt Ranostay

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

There were a few parts of the example that did not conform to the
binding description and would not have worked with the Linux driver
as a result.  Fixed them whilst doing this conversion.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
---
 .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
 .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
 2 files changed, 68 insertions(+), 33 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt b/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
deleted file mode 100644
index f3ab02b0dd41..000000000000
--- a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-* Texas Instruments LMP91000 series of potentiostats
-
-LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
-LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
-
-Required properties:
-
-  - compatible: should be one of the following:
-                 "ti,lmp91000"
-                 "ti,lmp91002"
-  - reg: the I2C address of the device
-  - io-channels: the phandle of the iio provider
-
-  - ti,external-tia-resistor: if the property ti,tia-gain-ohm is not defined this
-    needs to be set to signal that an external resistor value is being used.
-
-Optional properties:
-
-  - ti,tia-gain-ohm: ohm value of the internal resistor for the transimpedance
-    amplifier. Must be 2750, 3500, 7000, 14000, 35000, 120000, or 350000 ohms.
-
-  - ti,rload-ohm: ohm value of the internal resistor load applied to the gas
-    sensor. Must be 10, 33, 50, or 100 (default) ohms.
-
-Example:
-
-lmp91000@48 {
-	compatible = "ti,lmp91000";
-	reg = <0x48>;
-	ti,tia-gain-ohm = <7500>;
-	ti,rload = <100>;
-	io-channels = <&adc>;
-};
diff --git a/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
new file mode 100644
index 000000000000..e4b5d890e8d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/potentiostat/ti,lmp91000.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments LMP91000 series of potentiostats with I2C control
+
+maintainers:
+  - Matt Ranostay <matt.ranostay@konsulko.com>
+
+description: |
+  Typically used as a signal conditioner for chemical sensors.
+  LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
+  LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
+
+properties:
+  compatible:
+    enum:
+      - ti,lmp91000
+      - ti,lmp91002
+
+  reg:
+    maxItems: 1
+
+  io-channels:
+    maxItems: 1
+
+  ti,external-tia-resistor:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      If the property ti,tia-gain-ohm is not defined this needs to be set to
+      signal that an external resistor value is being used.
+
+  ti,tia-gain-ohm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [2750, 3500, 7000, 14000, 35000, 120000, 350000]
+    description:
+      Internal resistor for the transimpedance amplifier.
+
+  ti,rload-ohm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [10, 33, 50, 100]
+    description:
+      Internal resistor load applied to the gas sensor.
+      Default 100 Ohms.
+
+required:
+  - compatible
+  - reg
+  - io-channels
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        lmp91000@48 {
+            compatible = "ti,lmp91000";
+            reg = <0x48>;
+            ti,tia-gain-ohm = <7000>;
+            ti,rload-ohm = <100>;
+            io-channels = <&adc>;
+        };
+    };
+...
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.
  2020-10-31 18:12 ` [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: " Jonathan Cameron
@ 2020-10-31 21:41   ` Matt Ranostay
  2020-11-28 17:56     ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Matt Ranostay @ 2020-10-31 21:41 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: open list:IIO SUBSYSTEM AND DRIVERS, Rob Herring, devicetree,
	Jonathan Cameron

On Sat, Oct 31, 2020 at 11:15 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> There were a few parts of the example that did not conform to the
> binding description and would not have worked with the Linux driver
> as a result.  Fixed them whilst doing this conversion.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Matt Ranostay <matt.ranostay@konsulko.com>

Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

> ---
>  .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
>  .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
>  2 files changed, 68 insertions(+), 33 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt b/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
> deleted file mode 100644
> index f3ab02b0dd41..000000000000
> --- a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -* Texas Instruments LMP91000 series of potentiostats
> -
> -LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
> -LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
> -
> -Required properties:
> -
> -  - compatible: should be one of the following:
> -                 "ti,lmp91000"
> -                 "ti,lmp91002"
> -  - reg: the I2C address of the device
> -  - io-channels: the phandle of the iio provider
> -
> -  - ti,external-tia-resistor: if the property ti,tia-gain-ohm is not defined this
> -    needs to be set to signal that an external resistor value is being used.
> -
> -Optional properties:
> -
> -  - ti,tia-gain-ohm: ohm value of the internal resistor for the transimpedance
> -    amplifier. Must be 2750, 3500, 7000, 14000, 35000, 120000, or 350000 ohms.
> -
> -  - ti,rload-ohm: ohm value of the internal resistor load applied to the gas
> -    sensor. Must be 10, 33, 50, or 100 (default) ohms.
> -
> -Example:
> -
> -lmp91000@48 {
> -       compatible = "ti,lmp91000";
> -       reg = <0x48>;
> -       ti,tia-gain-ohm = <7500>;
> -       ti,rload = <100>;
> -       io-channels = <&adc>;
> -};
> diff --git a/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
> new file mode 100644
> index 000000000000..e4b5d890e8d5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/potentiostat/ti,lmp91000.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Texas Instruments LMP91000 series of potentiostats with I2C control
> +
> +maintainers:
> +  - Matt Ranostay <matt.ranostay@konsulko.com>
> +
> +description: |
> +  Typically used as a signal conditioner for chemical sensors.
> +  LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
> +  LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,lmp91000
> +      - ti,lmp91002
> +
> +  reg:
> +    maxItems: 1
> +
> +  io-channels:
> +    maxItems: 1
> +
> +  ti,external-tia-resistor:
> +    $ref: /schemas/types.yaml#/definitions/flag
> +    description:
> +      If the property ti,tia-gain-ohm is not defined this needs to be set to
> +      signal that an external resistor value is being used.
> +
> +  ti,tia-gain-ohm:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [2750, 3500, 7000, 14000, 35000, 120000, 350000]
> +    description:
> +      Internal resistor for the transimpedance amplifier.
> +
> +  ti,rload-ohm:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [10, 33, 50, 100]
> +    description:
> +      Internal resistor load applied to the gas sensor.
> +      Default 100 Ohms.
> +
> +required:
> +  - compatible
> +  - reg
> +  - io-channels
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        lmp91000@48 {
> +            compatible = "ti,lmp91000";
> +            reg = <0x48>;
> +            ti,tia-gain-ohm = <7000>;
> +            ti,rload-ohm = <100>;
> +            io-channels = <&adc>;
> +        };
> +    };
> +...
> --
> 2.28.0
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
  2020-10-31 18:12 ` [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc Jonathan Cameron
@ 2020-11-01 13:25   ` Miquel Raynal
  2020-11-01 20:33     ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Miquel Raynal @ 2020-11-01 13:25 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Rob Herring, devicetree, Jonathan Cameron, Philippe Reynes

Hi Jonathan,

Jonathan Cameron <jic23@kernel.org> wrote on Sat, 31 Oct 2020 18:12:39
+0000:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The afe/voltage-divider.yaml example uses this device with 2 properties
> not provided by trivial-devices.yaml (spi-max-frequency and #io-channel-cells)
> 
> Solve that by creating a more specific binding doc.

I don't know #io-channel-cells but spi-max-frequency is very common and
is related to the fact that this device is a SPI device (hence, a SPI
subnode), IMHO it has nothing to do with trivial-devices.yaml
description.

> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Philippe Reynes <tremyfr@yahoo.fr>
> ---
>  .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
>  .../devicetree/bindings/trivial-devices.yaml  | 12 ----
>  2 files changed, 64 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> new file mode 100644
> index 000000000000..09e853c50c76
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> @@ -0,0 +1,64 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/adc/maxim,max1027.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim MAX1027 and similar ADCs
> +
> +maintainers:
> +  - Miquel Raynal <miquel.raynal@bootlin.com>
> +  - Philippe Reynes <tremyfr@yahoo.fr>
> +
> +description: |
> +  300ks/s SPI ADCs with temperature sensors.
> +
> +properties:
> +  compatible:
> +    enum:
> +        # 10-bit 8 channels
> +      - maxim,max1027
> +        # 10-bit 12 channels
> +      - maxim,max1029
> +        # 10-bit 16 channels
> +      - maxim,max1031
> +         # 12-bit 8 channels
> +      - maxim,max1227
> +         # 12-bit 12 channels
> +      - maxim,max1229
> +         # 12-bit 16 channels
> +      - maxim,max1231
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  spi-max-frequency: true
> +
> +  "#io-channel-cells":
> +    const: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    spi {
> +       #address-cells = <1>;
> +       #size-cells = <0>;
> +        maxadc: adc@0 {
> +            compatible = "maxim,max1027";
> +            reg = <0>;
> +            #io-channel-cells = <1>;
> +            interrupt-parent = <&gpio5>;
> +            interrupts = <15 IRQ_TYPE_EDGE_RISING>;
> +            spi-max-frequency = <1000000>;
> +        };
> +    };
> +...
> diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> index d154ea97e30d..185e09e61e16 100644
> --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> @@ -108,18 +108,6 @@ properties:
>            - isil,isl68137
>              # 5 Bit Programmable, Pulse-Width Modulator
>            - maxim,ds1050
> -            # 10-bit 8 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1027
> -            # 10-bit 12 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1029
> -            # 10-bit 16 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1031
> -            # 12-bit 8 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1227
> -            # 12-bit 12 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1229
> -            # 12-bit 16 channels 300ks/s SPI ADC with temperature sensor
> -          - maxim,max1231
>              # Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
>            - maxim,max1237
>              # PECI-to-I2C translator for PECI-to-SMBus/I2C protocol conversion

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
  2020-11-01 13:25   ` Miquel Raynal
@ 2020-11-01 20:33     ` Jonathan Cameron
  2020-11-28 17:47       ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Jonathan Cameron @ 2020-11-01 20:33 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: linux-iio, Rob Herring, devicetree, Jonathan Cameron, Philippe Reynes

On Sun, 1 Nov 2020 14:25:57 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Jonathan,
> 
> Jonathan Cameron <jic23@kernel.org> wrote on Sat, 31 Oct 2020 18:12:39
> +0000:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > The afe/voltage-divider.yaml example uses this device with 2 properties
> > not provided by trivial-devices.yaml (spi-max-frequency and #io-channel-cells)
> > 
> > Solve that by creating a more specific binding doc.  
> 
> I don't know #io-channel-cells but spi-max-frequency is very common and
> is related to the fact that this device is a SPI device (hence, a SPI
> subnode), IMHO it has nothing to do with trivial-devices.yaml
> description.

There may be some logic to adding spi-max-frequency to the allowed properties
of devices listed in trivial-devices.  Right now it's not there so you will
get warnings if you check a dts file that has it in for bindings described
by that file.  I've been lazy here, but ideally we also want to document
a maximum for this property.  In this case, it should be 10000000 (10MHz).
I'll add that to this binding either in v2, or whilst applying.

The io-channel-cells, is specific to devices proving analog channel measurement
services that other bindings can make use of.  (typically ADCs and DACs).
Currently only applies to IIO bindings for ADCs and DACs.
It specifies how many parameters are needed as part of the phandle to identify
a channel.

Given most of trivial devices don't fall into that category, we need to do
a separate binding where it's known to be used anyway.

As a side note.. I just noticed these devices have reference voltage pins.
At somepoint (not necessarily now) we should look at adding appropriate regulator
bindings.

Jonathan

> 
> > 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Cc: Philippe Reynes <tremyfr@yahoo.fr>
> > ---
> >  .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
> >  .../devicetree/bindings/trivial-devices.yaml  | 12 ----
> >  2 files changed, 64 insertions(+), 12 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> > new file mode 100644
> > index 000000000000..09e853c50c76
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> > @@ -0,0 +1,64 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/adc/maxim,max1027.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Maxim MAX1027 and similar ADCs
> > +
> > +maintainers:
> > +  - Miquel Raynal <miquel.raynal@bootlin.com>
> > +  - Philippe Reynes <tremyfr@yahoo.fr>
> > +
> > +description: |
> > +  300ks/s SPI ADCs with temperature sensors.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +        # 10-bit 8 channels
> > +      - maxim,max1027
> > +        # 10-bit 12 channels
> > +      - maxim,max1029
> > +        # 10-bit 16 channels
> > +      - maxim,max1031
> > +         # 12-bit 8 channels
> > +      - maxim,max1227
> > +         # 12-bit 12 channels
> > +      - maxim,max1229
> > +         # 12-bit 16 channels
> > +      - maxim,max1231
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  spi-max-frequency: true
> > +
> > +  "#io-channel-cells":
> > +    const: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +    spi {
> > +       #address-cells = <1>;
> > +       #size-cells = <0>;
> > +        maxadc: adc@0 {
> > +            compatible = "maxim,max1027";
> > +            reg = <0>;
> > +            #io-channel-cells = <1>;
> > +            interrupt-parent = <&gpio5>;
> > +            interrupts = <15 IRQ_TYPE_EDGE_RISING>;
> > +            spi-max-frequency = <1000000>;
> > +        };
> > +    };
> > +...
> > diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> > index d154ea97e30d..185e09e61e16 100644
> > --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> > +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> > @@ -108,18 +108,6 @@ properties:
> >            - isil,isl68137
> >              # 5 Bit Programmable, Pulse-Width Modulator
> >            - maxim,ds1050
> > -            # 10-bit 8 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1027
> > -            # 10-bit 12 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1029
> > -            # 10-bit 16 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1031
> > -            # 12-bit 8 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1227
> > -            # 12-bit 12 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1229
> > -            # 12-bit 16 channels 300ks/s SPI ADC with temperature sensor
> > -          - maxim,max1231
> >              # Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
> >            - maxim,max1237
> >              # PECI-to-I2C translator for PECI-to-SMBus/I2C protocol conversion  
> 
> Thanks,
> Miquèl


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.
  2020-10-31 18:12 ` [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: " Jonathan Cameron
@ 2020-11-03 15:55   ` Rob Herring
  0 siblings, 0 replies; 21+ messages in thread
From: Rob Herring @ 2020-11-03 15:55 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, devicetree, Jonathan Cameron, Peter Rosin

On Sat, Oct 31, 2020 at 06:12:37PM +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Note this includes a fix in the example where we had *-mul instead of
> *-mult.  The binding doc and driver agree that it should be *-mult
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Peter Rosin <peda@axentia.se>
> ---
>  .../iio/afe/current-sense-amplifier.txt       | 26 ---------
>  .../iio/afe/current-sense-amplifier.yaml      | 55 +++++++++++++++++++
>  2 files changed, 55 insertions(+), 26 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt
> deleted file mode 100644
> index 821b61b8c542..000000000000
> --- a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -Current Sense Amplifier
> -=======================
> -
> -When an io-channel measures the output voltage from a current sense
> -amplifier, the interesting measurement is almost always the current
> -through the sense resistor, not the voltage output. This binding
> -describes such a current sense circuit.
> -
> -Required properties:
> -- compatible : "current-sense-amplifier"
> -- io-channels : Channel node of a voltage io-channel.
> -- sense-resistor-micro-ohms : The sense resistance in microohms.
> -
> -Optional properties:
> -- sense-gain-mult: Amplifier gain multiplier. The default is <1>.
> -- sense-gain-div: Amplifier gain divider. The default is <1>.
> -
> -Example:
> -
> -sysi {
> -	compatible = "current-sense-amplifier";
> -	io-channels = <&tiadc 0>;
> -
> -	sense-resistor-micro-ohms = <20000>;
> -	sense-gain-mul = <50>;
> -};
> diff --git a/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
> new file mode 100644
> index 000000000000..920bdd8d12d6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/afe/current-sense-amplifier.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Current Sense Amplifier
> +
> +maintainers:
> +  - Peter Rosin <peda@axentia.se>
> +
> +description: |
> +  When an io-channel measures the output voltage from a current sense
> +  amplifier, the interesting measurement is almost always the current
> +  through the sense resistor, not the voltage output. This binding
> +  describes such a current sense circuit.
> +
> +properties:
> +  compatible:
> +    const: current-sense-amplifier
> +
> +  io-channels:
> +    maxItems: 1
> +    description: |
> +      Channel node of a voltage io-channel.
> +
> +  sense-resistor-micro-ohms:
> +    $ref: /schemas/types.yaml#/definitions/uint32

Don't need a type for props with unit suffix.

> +    description: The sense resistance.
> +
> +  sense-gain-mult:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Amplifier gain multiplier. The default is <1>.
> +
> +  sense-gain-div:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Amplifier gain divider. The default is <1>.
> +
> +required:
> +  - compatible
> +  - io-channels
> +  - sense-resistor-micro-ohms
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    sysi {
> +        compatible = "current-sense-amplifier";
> +        io-channels = <&tiadc 0>;
> +
> +        sense-resistor-micro-ohms = <20000>;
> +        sense-gain-mult = <50>;
> +    };
> +...
> -- 
> 2.28.0
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers
  2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
                   ` (9 preceding siblings ...)
  2020-10-31 18:12 ` [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: " Jonathan Cameron
@ 2020-11-03 16:07 ` Rob Herring
  2020-11-28 17:57   ` Jonathan Cameron
  10 siblings, 1 reply; 21+ messages in thread
From: Rob Herring @ 2020-11-03 16:07 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, devicetree, Jonathan Cameron

On Sat, Oct 31, 2020 at 06:12:32PM +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Firstly drop the old text file as the consumer binding (and the other
> parts of that file) are under review for inclusion in the dt-schema external
> repo.
> 
> This only converts consumers that happen to also be IIO drivers.
> Others may get done as part of SoC binding conversions or I may do a lot
> of them at somepoint.
> 
> A few of the examples in existing text files used providers that were
> documented in trivial-bindings.yaml which does not allow for
> #io-channel-cells. I have pulled those out to their own files as part
> of this patch set.
> 
> The iio-mux binding is not done as that has some dependencies and will
> form part of some future patch set.
> 
> There is no explicit dependency in here on any other sets, but some
> noise will occur in trivial-bindings.yaml if applied in a different
> order to I happen to have them sets locally.
> 
> Jonathan Cameron (10):
>   dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema
>   dt-bindings:iio:dac:dpot-dac: yaml conversion.
>   dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding
>   dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.
>   dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.
>   dt-bindings:iio:afe:current-sense-shunt: txt to yaml conversion. 
>   dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
>   dt-bindings:iio:afe:voltage-divider: txt to yaml conversion
>   dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
>   dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.

With the type references for properties with standard units dropped,

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
  2020-10-31 18:12 ` [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: " Jonathan Cameron
@ 2020-11-04 14:46   ` Linus Walleij
  2020-11-08 16:00     ` Jonathan Cameron
  0 siblings, 1 reply; 21+ messages in thread
From: Linus Walleij @ 2020-11-04 14:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Jonathan Cameron

On Sat, Oct 31, 2020 at 7:15 PM Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Simple conversion using the new iio-consumers.yaml binding in the
> dt-schema.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>

FWIW Kevin Tsai has listed himself to maintain all Capella
drivers, also this one, so maybe he should be added as
binding maintainer as well?

CAPELLA MICROSYSTEMS LIGHT SENSOR DRIVER
M:      Kevin Tsai <ktsai@capellamicro.com>
S:      Maintained
F:      drivers/iio/light/cm*

Either way:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
  2020-11-04 14:46   ` Linus Walleij
@ 2020-11-08 16:00     ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-11-08 16:00 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-iio, Rob Herring,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	Jonathan Cameron, Kevin Tsai

On Wed, 4 Nov 2020 15:46:14 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Sat, Oct 31, 2020 at 7:15 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Simple conversion using the new iio-consumers.yaml binding in the
> > dt-schema.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>  
> 
> FWIW Kevin Tsai has listed himself to maintain all Capella
> drivers, also this one, so maybe he should be added as
> binding maintainer as well?
Sure.  +cc Kevin.

Kevin. Do youmind being listed as maintainer for this binding?

> 
> CAPELLA MICROSYSTEMS LIGHT SENSOR DRIVER
> M:      Kevin Tsai <ktsai@capellamicro.com>
> S:      Maintained
> F:      drivers/iio/light/cm*
> 
> Either way:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Yours,
> Linus Walleij


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
  2020-11-01 20:33     ` Jonathan Cameron
@ 2020-11-28 17:47       ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-11-28 17:47 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: linux-iio, Rob Herring, devicetree, Jonathan Cameron, Philippe Reynes

On Sun, 1 Nov 2020 20:33:04 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sun, 1 Nov 2020 14:25:57 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > Hi Jonathan,
> > 
> > Jonathan Cameron <jic23@kernel.org> wrote on Sat, 31 Oct 2020 18:12:39
> > +0000:
> >   
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > 
> > > The afe/voltage-divider.yaml example uses this device with 2 properties
> > > not provided by trivial-devices.yaml (spi-max-frequency and #io-channel-cells)
> > > 
> > > Solve that by creating a more specific binding doc.    
> > 
> > I don't know #io-channel-cells but spi-max-frequency is very common and
> > is related to the fact that this device is a SPI device (hence, a SPI
> > subnode), IMHO it has nothing to do with trivial-devices.yaml
> > description.  
> 
> There may be some logic to adding spi-max-frequency to the allowed properties
> of devices listed in trivial-devices.  Right now it's not there so you will
> get warnings if you check a dts file that has it in for bindings described
> by that file.  I've been lazy here, but ideally we also want to document
> a maximum for this property.  In this case, it should be 10000000 (10MHz).
> I'll add that to this binding either in v2, or whilst applying.
> 
> The io-channel-cells, is specific to devices proving analog channel measurement
> services that other bindings can make use of.  (typically ADCs and DACs).
> Currently only applies to IIO bindings for ADCs and DACs.
> It specifies how many parameters are needed as part of the phandle to identify
> a channel.
> 
> Given most of trivial devices don't fall into that category, we need to do
> a separate binding where it's known to be used anyway.
> 
> As a side note.. I just noticed these devices have reference voltage pins.
> At somepoint (not necessarily now) we should look at adding appropriate regulator
> bindings.

Applied with the addition of 10000000 maximum for spi-max-frequency.

thanks,

Jonathan

> 
> Jonathan
> 
> >   
> > > 
> > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > > Cc: Philippe Reynes <tremyfr@yahoo.fr>
> > > ---
> > >  .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
> > >  .../devicetree/bindings/trivial-devices.yaml  | 12 ----
> > >  2 files changed, 64 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> > > new file mode 100644
> > > index 000000000000..09e853c50c76
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml
> > > @@ -0,0 +1,64 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/iio/adc/maxim,max1027.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Maxim MAX1027 and similar ADCs
> > > +
> > > +maintainers:
> > > +  - Miquel Raynal <miquel.raynal@bootlin.com>
> > > +  - Philippe Reynes <tremyfr@yahoo.fr>
> > > +
> > > +description: |
> > > +  300ks/s SPI ADCs with temperature sensors.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +        # 10-bit 8 channels
> > > +      - maxim,max1027
> > > +        # 10-bit 12 channels
> > > +      - maxim,max1029
> > > +        # 10-bit 16 channels
> > > +      - maxim,max1031
> > > +         # 12-bit 8 channels
> > > +      - maxim,max1227
> > > +         # 12-bit 12 channels
> > > +      - maxim,max1229
> > > +         # 12-bit 16 channels
> > > +      - maxim,max1231
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > > +  spi-max-frequency: true
> > > +
> > > +  "#io-channel-cells":
> > > +    const: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    #include <dt-bindings/interrupt-controller/irq.h>
> > > +    spi {
> > > +       #address-cells = <1>;
> > > +       #size-cells = <0>;
> > > +        maxadc: adc@0 {
> > > +            compatible = "maxim,max1027";
> > > +            reg = <0>;
> > > +            #io-channel-cells = <1>;
> > > +            interrupt-parent = <&gpio5>;
> > > +            interrupts = <15 IRQ_TYPE_EDGE_RISING>;
> > > +            spi-max-frequency = <1000000>;
> > > +        };
> > > +    };
> > > +...
> > > diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> > > index d154ea97e30d..185e09e61e16 100644
> > > --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> > > +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> > > @@ -108,18 +108,6 @@ properties:
> > >            - isil,isl68137
> > >              # 5 Bit Programmable, Pulse-Width Modulator
> > >            - maxim,ds1050
> > > -            # 10-bit 8 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1027
> > > -            # 10-bit 12 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1029
> > > -            # 10-bit 16 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1031
> > > -            # 12-bit 8 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1227
> > > -            # 12-bit 12 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1229
> > > -            # 12-bit 16 channels 300ks/s SPI ADC with temperature sensor
> > > -          - maxim,max1231
> > >              # Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
> > >            - maxim,max1237
> > >              # PECI-to-I2C translator for PECI-to-SMBus/I2C protocol conversion    
> > 
> > Thanks,
> > Miquèl  
> 


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.
  2020-10-31 21:41   ` Matt Ranostay
@ 2020-11-28 17:56     ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-11-28 17:56 UTC (permalink / raw)
  To: Matt Ranostay
  Cc: open list:IIO SUBSYSTEM AND DRIVERS, Rob Herring, devicetree,
	Jonathan Cameron

On Sat, 31 Oct 2020 14:41:10 -0700
Matt Ranostay <matt.ranostay@konsulko.com> wrote:

> On Sat, Oct 31, 2020 at 11:15 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > There were a few parts of the example that did not conform to the
> > binding description and would not have worked with the Linux driver
> > as a result.  Fixed them whilst doing this conversion.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Matt Ranostay <matt.ranostay@konsulko.com>  
> 
> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>

Note I couldn't drop the type markings for the resistance properties here
because the dt-schema uses ohms and these are ohm.

An unfortunate bit of legacy we'll need to maintain I guess.

Jonathan

> 
> > ---
> >  .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
> >  .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
> >  2 files changed, 68 insertions(+), 33 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt b/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
> > deleted file mode 100644
> > index f3ab02b0dd41..000000000000
> > --- a/Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt
> > +++ /dev/null
> > @@ -1,33 +0,0 @@
> > -* Texas Instruments LMP91000 series of potentiostats
> > -
> > -LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
> > -LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
> > -
> > -Required properties:
> > -
> > -  - compatible: should be one of the following:
> > -                 "ti,lmp91000"
> > -                 "ti,lmp91002"
> > -  - reg: the I2C address of the device
> > -  - io-channels: the phandle of the iio provider
> > -
> > -  - ti,external-tia-resistor: if the property ti,tia-gain-ohm is not defined this
> > -    needs to be set to signal that an external resistor value is being used.
> > -
> > -Optional properties:
> > -
> > -  - ti,tia-gain-ohm: ohm value of the internal resistor for the transimpedance
> > -    amplifier. Must be 2750, 3500, 7000, 14000, 35000, 120000, or 350000 ohms.
> > -
> > -  - ti,rload-ohm: ohm value of the internal resistor load applied to the gas
> > -    sensor. Must be 10, 33, 50, or 100 (default) ohms.
> > -
> > -Example:
> > -
> > -lmp91000@48 {
> > -       compatible = "ti,lmp91000";
> > -       reg = <0x48>;
> > -       ti,tia-gain-ohm = <7500>;
> > -       ti,rload = <100>;
> > -       io-channels = <&adc>;
> > -};
> > diff --git a/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
> > new file mode 100644
> > index 000000000000..e4b5d890e8d5
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml
> > @@ -0,0 +1,68 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/potentiostat/ti,lmp91000.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Texas Instruments LMP91000 series of potentiostats with I2C control
> > +
> > +maintainers:
> > +  - Matt Ranostay <matt.ranostay@konsulko.com>
> > +
> > +description: |
> > +  Typically used as a signal conditioner for chemical sensors.
> > +  LMP91000: https://www.ti.com/lit/ds/symlink/lmp91000.pdf
> > +  LMP91002: https://www.ti.com/lit/ds/symlink/lmp91002.pdf
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - ti,lmp91000
> > +      - ti,lmp91002
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  io-channels:
> > +    maxItems: 1
> > +
> > +  ti,external-tia-resistor:
> > +    $ref: /schemas/types.yaml#/definitions/flag
> > +    description:
> > +      If the property ti,tia-gain-ohm is not defined this needs to be set to
> > +      signal that an external resistor value is being used.
> > +
> > +  ti,tia-gain-ohm:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [2750, 3500, 7000, 14000, 35000, 120000, 350000]
> > +    description:
> > +      Internal resistor for the transimpedance amplifier.
> > +
> > +  ti,rload-ohm:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [10, 33, 50, 100]
> > +    description:
> > +      Internal resistor load applied to the gas sensor.
> > +      Default 100 Ohms.
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - io-channels
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +        lmp91000@48 {
> > +            compatible = "ti,lmp91000";
> > +            reg = <0x48>;
> > +            ti,tia-gain-ohm = <7000>;
> > +            ti,rload-ohm = <100>;
> > +            io-channels = <&adc>;
> > +        };
> > +    };
> > +...
> > --
> > 2.28.0
> >  


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers
  2020-11-03 16:07 ` [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Rob Herring
@ 2020-11-28 17:57   ` Jonathan Cameron
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Cameron @ 2020-11-28 17:57 UTC (permalink / raw)
  To: Rob Herring; +Cc: linux-iio, devicetree, Jonathan Cameron

On Tue, 3 Nov 2020 10:07:56 -0600
Rob Herring <robh@kernel.org> wrote:

> On Sat, Oct 31, 2020 at 06:12:32PM +0000, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > 
> > Firstly drop the old text file as the consumer binding (and the other
> > parts of that file) are under review for inclusion in the dt-schema external
> > repo.
> > 
> > This only converts consumers that happen to also be IIO drivers.
> > Others may get done as part of SoC binding conversions or I may do a lot
> > of them at somepoint.
> > 
> > A few of the examples in existing text files used providers that were
> > documented in trivial-bindings.yaml which does not allow for
> > #io-channel-cells. I have pulled those out to their own files as part
> > of this patch set.
> > 
> > The iio-mux binding is not done as that has some dependencies and will
> > form part of some future patch set.
> > 
> > There is no explicit dependency in here on any other sets, but some
> > noise will occur in trivial-bindings.yaml if applied in a different
> > order to I happen to have them sets locally.
> > 
> > Jonathan Cameron (10):
> >   dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema
> >   dt-bindings:iio:dac:dpot-dac: yaml conversion.
> >   dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding
> >   dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.
> >   dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.
> >   dt-bindings:iio:afe:current-sense-shunt: txt to yaml conversion. 
> >   dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.
> >   dt-bindings:iio:afe:voltage-divider: txt to yaml conversion
> >   dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.
> >   dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.  
> 
> With the type references for properties with standard units dropped,

Done.

> 
> Reviewed-by: Rob Herring <robh@kernel.org>

Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to do their magic.
Thanks,

Jonathan

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-11-28 22:24 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 18:12 [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Jonathan Cameron
2020-10-31 18:12 ` [PATCH 01/10] dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema Jonathan Cameron
2020-10-31 18:12 ` [PATCH 02/10] dt-bindings:iio:dac:dpot-dac: yaml conversion Jonathan Cameron
2020-10-31 18:12 ` [PATCH 03/10] dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding Jonathan Cameron
2020-10-31 18:12 ` [PATCH 04/10] dt-bindings:iio:adc:envelope-detector: txt to yaml conversion Jonathan Cameron
2020-10-31 18:12 ` [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: " Jonathan Cameron
2020-11-03 15:55   ` Rob Herring
2020-10-31 18:12 ` [PATCH 06/10] dt-bindings:iio:afe:current-sense-shunt: " Jonathan Cameron
2020-10-31 18:12 ` [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc Jonathan Cameron
2020-11-01 13:25   ` Miquel Raynal
2020-11-01 20:33     ` Jonathan Cameron
2020-11-28 17:47       ` Jonathan Cameron
2020-10-31 18:12 ` [PATCH 08/10] dt-bindings:iio:afe:voltage-divider: txt to yaml conversion Jonathan Cameron
2020-10-31 18:12 ` [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: " Jonathan Cameron
2020-11-04 14:46   ` Linus Walleij
2020-11-08 16:00     ` Jonathan Cameron
2020-10-31 18:12 ` [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: " Jonathan Cameron
2020-10-31 21:41   ` Matt Ranostay
2020-11-28 17:56     ` Jonathan Cameron
2020-11-03 16:07 ` [PATCH 00/10] dt-bindings: iio: conversion of consumer drivers Rob Herring
2020-11-28 17:57   ` Jonathan Cameron

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).