Merge tag 'efi_updates_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / Documentation / devicetree / bindings / iio / afe / voltage-divider.yaml
1 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/iio/afe/voltage-divider.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: Voltage divider
8
9 maintainers:
10   - Peter Rosin <peda@axentia.se>
11
12 description: |
13   When an io-channel measures the midpoint of a voltage divider, the
14   interesting voltage is often the voltage over the full resistance
15   of the divider. This binding describes the voltage divider in such
16   a curcuit.
17
18     Vin ----.
19             |
20          .-----.
21          |  R  |
22          '-----'
23             |
24             +---- Vout
25             |
26          .-----.
27          | Rout|
28          '-----'
29             |
30            GND
31
32
33 properties:
34   compatible:
35     const: voltage-divider
36
37   io-channels:
38     maxItems: 1
39     description: |
40       Channel node of a voltage io-channel.
41
42   output-ohms:
43     description:
44       Resistance Rout over which the output voltage is measured. See full-ohms.
45
46   full-ohms:
47     description:
48       Resistance R + Rout for the full divider. The io-channel is scaled by
49       the Rout / (R + Rout) quotient.
50
51 required:
52   - compatible
53   - io-channels
54   - output-ohms
55   - full-ohms
56
57 additionalProperties: false
58
59 examples:
60   - |
61     #include <dt-bindings/interrupt-controller/irq.h>
62     /*
63      * The system voltage is circa 12V, but divided down with a 22/222
64      * voltage divider (R = 200 Ohms, Rout = 22 Ohms) and fed to an ADC.
65      */
66     spi {
67         #address-cells = <1>;
68         #size-cells = <0>;
69         maxadc: adc@0 {
70             compatible = "maxim,max1027";
71             reg = <0>;
72             #io-channel-cells = <1>;
73             interrupt-parent = <&gpio5>;
74             interrupts = <15 IRQ_TYPE_EDGE_RISING>;
75             spi-max-frequency = <1000000>;
76         };
77     };
78     sysv {
79         compatible = "voltage-divider";
80         io-channels = <&maxadc 1>;
81
82         /* Scale the system voltage by 22/222 to fit the ADC range. */
83         output-ohms = <22>;
84         full-ohms = <222>; /* 200 + 22 */
85     };
86 ...