Skip to contentSkip to conversation

dt-bindings: iio: adc: ti,adc081c: Document the binding

PATCH In review Samuel Holland 3 participants 8 messages Nov 25, 2022 – Dec 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: iio: adc: ti,adc081c: Document the binding

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +55 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - vref-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@52 {
+            compatible = "ti,adc081c";
+            reg = <0x52>;
+            vref-supply = <&reg_2p5v>;
+        };
+    };
+...
Signature · 1 line
2.37.4
#1 lore raw
Quoted 46 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +28 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+

Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml line 38

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +10 -0
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg

Why not requiring io-channel-cells? If it is an IIO ADC provider, you need the cells, right?

Best regards,
Krzysztof

maintainer
#2 lore raw
Quoted 52 lines · On Sun, 27 Nov 2022 13:51:19 +0100 Krzysztof Kozlowski…
Quoted 51 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +33 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +5 -0
+    const: 1
+
+required:
+  - compatible
+  - reg  

Why not requiring io-channel-cells? If it is an IIO ADC provider, you need the cells, right?

Only if anyone is using it as a provider. If it's purely being used via IIO then there are no consumers registered.

So historically I've left it up to those defining the binding to decide if they think #io-channel-cells should be required or optional.

It gets a bit non obvious with some of the more complex special ADCs on whether they will ever be consumed. This one is generic, so quite likely it will be.

Jonathan

Quoted 4 lines

Best regards,
Krzysztof

#3 lore raw
Quoted 64 lines · Jonathan Cameron
Quoted 52 lines · On Sun, 27 Nov 2022 13:51:19 +0100 Krzysztof Kozlowski…
Quoted 51 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +33 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +5 -0
+    const: 1
+
+required:
+  - compatible
+  - reg  

Why not requiring io-channel-cells? If it is an IIO ADC provider, you need the cells, right?

Quoted 8 lines

Only if anyone is using it as a provider. If it's purely being used via IIO then there are no consumers registered.

So historically I've left it up to those defining the binding to decide if they think #io-channel-cells should be required or optional.

It gets a bit non obvious with some of the more complex special ADCs on whether they will ever be consumed. This one is generic, so quite likely it will be.

I kept #io-channel-cells optional because there are already a handful of boards using ti,adc081c without it.

On the board I am adding (Clockwork DevTerm), the ADC is used a temperature sensor for a thermal printer. So whether or not the ADC is used as an OF provider depends on how the printer driver gets implemented.

Regards,
Samuel

#4 lore raw
Quoted 74 lines · Samuel Holland
Quoted 64 lines · Jonathan Cameron
Quoted 52 lines · On Sun, 27 Nov 2022 13:51:19 +0100 Krzysztof Kozlowski…
Quoted 51 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +33 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +5 -0
+    const: 1
+
+required:
+  - compatible
+  - reg  

Why not requiring io-channel-cells? If it is an IIO ADC provider, you need the cells, right?

Quoted 8 lines

Only if anyone is using it as a provider. If it's purely being used via IIO then there are no consumers registered.

So historically I've left it up to those defining the binding to decide if they think #io-channel-cells should be required or optional.

It gets a bit non obvious with some of the more complex special ADCs on whether they will ever be consumed. This one is generic, so quite likely it will be.

Quoted 6 lines

I kept #io-channel-cells optional because there are already a handful of boards using ti,adc081c without it.

On the board I am adding (Clockwork DevTerm), the ADC is used a temperature sensor for a thermal printer. So whether or not the ADC is used as an OF provider depends on how the printer driver gets implemented.

Thanks, it's fine.

Best regards,
Krzysztof

#5 lore raw
In reply to Jonathan Cameron
Quoted 64 lines · Jonathan Cameron
Quoted 52 lines · On Sun, 27 Nov 2022 13:51:19 +0100 Krzysztof Kozlowski…
Quoted 51 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

 .../bindings/iio/adc/ti,adc081c.yaml          | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +33 -0
new file mode 100644
index 000000000000..caaad777580c
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,adc081c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI Single-channel I2C ADCs
+
+maintainers:
+  - Jonathan Cameron <[email protected]>
+  - Lars-Peter Clausen <[email protected]>
+
+description: |
+  Single-channel ADC supporting 8, 10, or 12-bit samples and high/low alerts.
+
+properties:
+  compatible:
+    enum:
+      - ti,adc081c
+      - ti,adc101c
+      - ti,adc121c
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vref-supply:
+    description:
+      Regulator for the combined power supply and voltage reference
+
+  "#io-channel-cells":
Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml line 38

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,adc081c.yaml new file +5 -0
+    const: 1
+
+required:
+  - compatible
+  - reg  

Why not requiring io-channel-cells? If it is an IIO ADC provider, you need the cells, right?

Quoted 8 lines

Only if anyone is using it as a provider. If it's purely being used via IIO then there are no consumers registered.

So historically I've left it up to those defining the binding to decide if they think #io-channel-cells should be required or optional.

It gets a bit non obvious with some of the more complex special ADCs on whether they will ever be consumed. This one is generic, so quite likely it will be.

I remember I asked some time ago and got the same answer... need to write it down into my notes :)

Best regards,
Krzysztof

Reviewed-by on v1 1/1
#6 lore raw
In reply to Samuel Holland
Quoted 8 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

---

Best regards,
Krzysztof

maintainer
#7 lore raw
Quoted 6 lines · On Sun, 27 Nov 2022 22:09:52 +0100 Krzysztof Kozlowski…
Quoted 5 lines · Samuel Holland

Linux has a driver for these ADCs at drivers/iio/adc/ti-adc081c.c, but the compatible strings were undocumented. Add a binding for them. The hardware has an alert interrupt output, but existing ti,adc081c users do not provide the 'interrupts' property, so leave it as optional.

Quoted 6 lines
Quoted 3 lines

---

Applied, but now we are so close to merge window, I'm queuing things for 6.3. Obviously wouldn't really matter for this, but it is too late for other things in my tree to get enough time in linux-next etc.

Jonathan

Quoted 4 lines

Best regards,
Krzysztof