dt-bindings: iio: afe: add binding for voltage-divider
authorPeter Rosin <peda@axentia.se>
Mon, 23 Apr 2018 21:08:07 +0000 (23:08 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 28 Apr 2018 17:00:21 +0000 (18:00 +0100)
An ADC is often used to measure other quantities indirectly. This
binding describe one cases, a "big" voltage measured with the help
of a voltage divider.

Signed-off-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Documentation/devicetree/bindings/iio/afe/voltage-divider.txt [new file with mode: 0644]
MAINTAINERS

diff --git a/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt b/Documentation/devicetree/bindings/iio/afe/voltage-divider.txt
new file mode 100644 (file)
index 0000000..b452a84
--- /dev/null
@@ -0,0 +1,53 @@
+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>;
+       };
+};
index d3052bd4a75290530ec4bdc842a16e935e477723..35987f60649b4578cebf214fb80414e15dec3305 100644 (file)
@@ -6903,6 +6903,7 @@ M:        Peter Rosin <peda@axentia.se>
 L:     linux-iio@vger.kernel.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/iio/afe/current-sense-shunt.txt
+F:     Documentation/devicetree/bindings/iio/afe/voltage-divider.txt
 
 IKANOS/ADI EAGLE ADSL USB DRIVER
 M:     Matthieu Castet <castet.matthieu@free.fr>