Voltage divider
Schema identifier ($id): "http://devicetree.org/schemas/iio/afe/voltage-divider.yaml#"
Schema dialect ($schema): "http://devicetree.org/meta-schemas/core.yaml#"
Maintainers (maintainers): "Peter Rosin <peda@axentia.se>"
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 circuit.
Vin ----.
|
.-----.
| R |
'-----'
|
+---- Vout
|
.-----.
| Rout|
'-----'
|
GND
Properties and child nodes (properties) #
compatible — required here #
Exact value (const): "voltage-divider"
io-channels — required here #
Maximum number of items (maxItems): 1
Channel node of a voltage io-channel.
#io-channel-cells — not listed as required here #
In addition to consuming the measurement services of a voltage output channel, the voltage divider can act as a provider of measurement services to other devices. This is particularly useful in scenarios wherein an ADC has an analog frontend, such as a voltage divider, and then consuming its raw value isn't interesting. In this case, the voltage before the divider is desired.
Exact value (const): 1
output-ohms — required here #
Resistance Rout over which the output voltage is measured. See full-ohms.
full-ohms — required here #
Resistance R + Rout for the full divider. The io-channel is scaled by the Rout / (R + Rout) quotient.
Required in this object (required): "compatible", "io-channels", "output-ohms", "full-ohms"
Properties not matched by properties or patternProperties in this schema (additionalProperties) #
false
Not allowed by this rule.
Examples (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 */
};
Source notes #
Annotations retained from the schema source
Line 1: SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)