Skip to contentSkip to conversation

dt-bindings: iio: conversion of consumer drivers

PATCH In review Jonathan Cameron 5 participants 21 messages Oct 31, 2020 – Nov 28, 2020

Subsystems (5)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover dt-bindings: iio: conversion of consumer drivers

From: Jonathan Cameron <[email protected]>

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
Signature · 1 line
2.28.0
author maintainer
#1 lore raw

PATCH 1/10 dt-bindings:iio:iio-binding.txt Drop file as content now in dt-schema

From: Jonathan Cameron <[email protected]>

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

---
 .../devicetree/bindings/iio/iio-bindings.txt  | 102 ------------------
 1 file changed, 102 deletions(-)
Documentation/devicetree/bindings/iio/iio-bindings.txt deleted +0 -102
deleted file mode 100644
index aa63cac7323e..000000000000
@@ -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";
-	};
Signature · 1 line
2.28.0
author maintainer
#2 lore raw

PATCH 2/10 dt-bindings:iio:dac:dpot-dac: yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

---
 .../devicetree/bindings/iio/dac/dpot-dac.txt  | 41 ------------
 .../devicetree/bindings/iio/dac/dpot-dac.yaml | 64 +++++++++++++++++++
 2 files changed, 64 insertions(+), 41 deletions(-)
Documentation/devicetree/bindings/iio/dac/dpot-dac.txt deleted +0 -41
deleted file mode 100644
index fdf47a01bfef..000000000000
@@ -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";
-	};
Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.28.0
author maintainer
#3 lore raw

PATCH 3/10 dt-bindings:iio:potentiometer: give microchip,mcp4531 its own binding

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

---
 .../iio/potentiometer/microchip,mcp4531.yaml  | 116 ++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 128 ------------------
 2 files changed, 116 insertions(+), 128 deletions(-)
Documentation/devicetree/bindings/iio/potentiometer/microchip,mcp4531.yaml new file +116 -0
new file mode 100644
index 000000000000..5c4b9b9181ae
@@ -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 <[email protected]>
+
+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>;
+        };
+    };
+...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -128

134 lines not on this page · raw message

Signature · 1 line
2.28.0
author maintainer
#4 lore raw

PATCH 4/10 dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

---
 .../bindings/iio/adc/envelope-detector.txt    | 54 ------------
 .../bindings/iio/adc/envelope-detector.yaml   | 87 +++++++++++++++++++
 2 files changed, 87 insertions(+), 54 deletions(-)
Documentation/devicetree/bindings/iio/adc/envelope-detector.txt deleted +0 -54
deleted file mode 100644
index 27544bdd4478..000000000000
@@ -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";
-	};
Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.28.0
author maintainer
#5 lore raw

PATCH 5/10 dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

---
 .../iio/afe/current-sense-amplifier.txt       | 26 ---------
 .../iio/afe/current-sense-amplifier.yaml      | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt deleted +0 -26
deleted file mode 100644
index 821b61b8c542..000000000000
@@ -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>;
-};
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.28.0
maintainer
#6 lore raw

Re: [PATCH 05/10] dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.

Quoted 68 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

---
 .../iio/afe/current-sense-amplifier.txt       | 26 ---------
 .../iio/afe/current-sense-amplifier.yaml      | 55 +++++++++++++++++++
 2 files changed, 55 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt deleted +0 -26
deleted file mode 100644
index 821b61b8c542..000000000000
@@ -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>;
-};
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml new file +18 -0
new file mode 100644
index 000000000000..920bdd8d12d6
@@ -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 <[email protected]>
+
+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:

Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml new file +10 -0
+  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.

Quoted 30 lines
Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml new file +27 -0
+    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>;
+    };
+...
Signature · 1 line
2.28.0
author maintainer
#7 lore raw

PATCH 6/10 dt-bindings:iio:afe:current-sense-shunt: txt to yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Very simple binding. As such straight forward conversion.

---
 .../bindings/iio/afe/current-sense-shunt.txt  | 41 ------------
 .../bindings/iio/afe/current-sense-shunt.yaml | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 41 deletions(-)
Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt deleted +0 -41
deleted file mode 100644
index 0f67108a07b6..000000000000
@@ -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>;
-		};
-	};
-};
Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.28.0
author maintainer
#8 lore raw

PATCH 7/10 dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>
---
 .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 12 ----
 2 files changed, 64 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml new file +64 -0
new file mode 100644
index 000000000000..09e853c50c76
@@ -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 <[email protected]>
+  - Philippe Reynes <[email protected]>
+
+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>;
+        };
+    };
+...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -12
index d154ea97e30d..185e09e61e16 100644
@@ -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
Signature · 1 line
2.28.0
#9 lore raw

Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.

Hi Jonathan,

Jonathan Cameron <[email protected]> wrote on Sat, 31 Oct 2020 18:12:39 +0000:

Quoted 6 lines

From: Jonathan Cameron <[email protected]>

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.

Quoted 92 lines
Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>
---
 .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 12 ----
 2 files changed, 64 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml new file +64 -0
new file mode 100644
index 000000000000..09e853c50c76
@@ -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 <[email protected]>
+  - Philippe Reynes <[email protected]>
+
+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>;
+        };
+    };
+...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -5
index d154ea97e30d..185e09e61e16 100644
@@ -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

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 113

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -7
-          - 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

author maintainer
#10 lore raw

Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.

Quoted 10 lines · On Sun, 1 Nov 2020 14:25:57 +0100 Miquel Raynal <[email protected]>…

Hi Jonathan,

Jonathan Cameron <[email protected]> wrote on Sat, 31 Oct 2020 18:12:39 +0000:

Quoted 5 lines

From: Jonathan Cameron <[email protected]>

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)

Quoted 6 lines
Quoted 1 line

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

Quoted 106 lines
Quoted 93 lines
Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>
---
 .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 12 ----
 2 files changed, 64 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml new file +64 -0
new file mode 100644
index 000000000000..09e853c50c76
@@ -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 <[email protected]>
+  - Philippe Reynes <[email protected]>
+
+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>;
+        };
+    };
+...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -5
index d154ea97e30d..185e09e61e16 100644
@@ -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

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 113

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -7
-          - 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

author maintainer
#11 lore raw

Re: [PATCH 07/10] dt-bindings:iio:adc:maxim,max1027: Pull out to separate binding doc.

Quoted 33 lines · On Sun, 1 Nov 2020 20:33:04 +0000 Jonathan Cameron <[email protected]> wrote:
Quoted 10 lines · On Sun, 1 Nov 2020 14:25:57 +0100 Miquel Raynal <[email protected]>…

Hi Jonathan,

Jonathan Cameron <[email protected]> wrote on Sat, 31 Oct 2020 18:12:39 +0000:

Quoted 5 lines

From: Jonathan Cameron <[email protected]>

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)

Quoted 6 lines
Quoted 1 line

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.

Quoted 6 lines

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

Quoted 110 lines

Jonathan

Quoted 106 lines
Quoted 93 lines
Cc Miquel Raynal <[email protected]>
Cc Philippe Reynes <[email protected]>
---
 .../bindings/iio/adc/maxim,max1027.yaml       | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  | 12 ----
 2 files changed, 64 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/iio/adc/maxim,max1027.yaml new file +64 -0
new file mode 100644
index 000000000000..09e853c50c76
@@ -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 <[email protected]>
+  - Philippe Reynes <[email protected]>
+
+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>;
+        };
+    };
+...
Documentation/devicetree/bindings/trivial-devices.yaml +0 -5
index d154ea97e30d..185e09e61e16 100644
@@ -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

Documentation/devicetree/bindings/trivial-devices.yaml properties: · line 113

Quoted 10 lines
Documentation/devicetree/bindings/trivial-devices.yaml +0 -7
-          - 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

author maintainer
#12 lore raw

PATCH 8/10 dt-bindings:iio:afe:voltage-divider: txt to yaml conversion

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

---
 .../bindings/iio/afe/voltage-divider.txt      | 53 -----------
 .../bindings/iio/afe/voltage-divider.yaml     | 88 +++++++++++++++++++
 2 files changed, 88 insertions(+), 53 deletions(-)
Documentation/devicetree/bindings/iio/afe/voltage-divider.txt deleted +0 -53
deleted file mode 100644
index b452a8406107..000000000000
@@ -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>;
-	};
-};
Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.28.0
author maintainer
#13 lore raw

PATCH 9/10 dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

---
 .../bindings/iio/light/capella,cm3605.yaml    | 78 +++++++++++++++++++
 .../devicetree/bindings/iio/light/cm3605.txt  | 41 ----------
 2 files changed, 78 insertions(+), 41 deletions(-)
Documentation/devicetree/bindings/iio/light/capella,cm3605.yaml new file +78 -0
new file mode 100644
index 000000000000..001c99dbd14e
@@ -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 <[email protected]>
+
+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";
+    };
+...
Documentation/devicetree/bindings/iio/light/cm3605.txt deleted +0 -41

41 lines not on this page · raw message

Signature · 1 line
2.28.0
Reviewed-by on v1 9/10
#14 lore raw

Re: [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.

Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

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 <[email protected]>
S:      Maintained
F:      drivers/iio/light/cm*

Either way:

Yours,
Linus Walleij

author maintainer
#15 lore raw

Re: [PATCH 09/10] dt-bindings:iio:light:capella,cm3605: txt to yaml conversion.

Quoted 7 lines · On Wed, 4 Nov 2020 15:46:14 +0100 Linus Walleij <[email protected]>…
Quoted 5 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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

Quoted 6 lines
Quoted 2 lines

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?

Quoted 11 lines

CAPELLA MICROSYSTEMS LIGHT SENSOR DRIVER

M:      Kevin Tsai <[email protected]>
S:      Maintained
F:      drivers/iio/light/cm*

Either way:

Yours,
Linus Walleij

author maintainer
#16 lore raw

PATCH 10/10 dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

---
 .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
 .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
 2 files changed, 68 insertions(+), 33 deletions(-)
Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt deleted +0 -33
deleted file mode 100644
index f3ab02b0dd41..000000000000
@@ -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>;
-};
Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.28.0
Acked-by on v1 10/10
#17 lore raw

Re: [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.

Quoted 9 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

Quoted 121 lines
---
 .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
 .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
 2 files changed, 68 insertions(+), 33 deletions(-)
Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt deleted +0 -33
deleted file mode 100644
index f3ab02b0dd41..000000000000
@@ -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>;
-};
Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml new file +68 -1
new file mode 100644
index 000000000000..e4b5d890e8d5
@@ -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 <[email protected]>
+
+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

author maintainer
#18 lore raw

Re: [PATCH 10/10] dt-bindings:iio:potentiostat:ti,lmp91000: txt to yaml conversion.

Quoted 4 lines · On Sat, 31 Oct 2020 14:41:10 -0700 Matt Ranostay <[email protected]>…
Quoted 3 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Quoted 8 lines
Quoted 6 lines

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.

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

Quoted 122 lines
Quoted 122 lines
---
 .../bindings/iio/potentiostat/lmp91000.txt    | 33 ---------
 .../iio/potentiostat/ti,lmp91000.yaml         | 68 +++++++++++++++++++
 2 files changed, 68 insertions(+), 33 deletions(-)
Documentation/devicetree/bindings/iio/potentiostat/lmp91000.txt deleted +0 -33
deleted file mode 100644
index f3ab02b0dd41..000000000000
@@ -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>;
-};
Documentation/devicetree/bindings/iio/potentiostat/ti,lmp91000.yaml new file +68 -1
new file mode 100644
index 000000000000..e4b5d890e8d5
@@ -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 <[email protected]>
+
+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

maintainer Reviewed-by on the v1 series
#19 lore raw
In reply to Jonathan Cameron
Quoted 22 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

Quoted 11 lines

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,

author maintainer
#20 lore raw
Quoted 35 lines · On Tue, 3 Nov 2020 10:07:56 -0600 Rob Herring <[email protected]> wrote:
Quoted 22 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

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.

Quoted 11 lines

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.

Quoted 1 line

With the type references for properties with standard units dropped,

Done.

Quoted 2 lines

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

Jonathan