On Wed Jun 9, 2021 at 4:52 PM EDT, Jonathan Cameron wrote: > On Mon, 7 Jun 2021 10:47:18 -0400 > Liam Beguin <liambeguin@xxxxxxxxx> wrote: > > > From: Liam Beguin <lvb@xxxxxxxxxx> > > > > An ADC is often used to measure other quantities indirectly. This > > binding describe such a use case, the measurement of a temperature > > through an analog front end connected to a voltage channel. > > > > Signed-off-by: Liam Beguin <lvb@xxxxxxxxxx> > > --- > > .../iio/afe/temperature-sense-amplifier.yaml | 57 +++++++++++++++++++ > > MAINTAINERS | 1 + > > 2 files changed, 58 insertions(+) > > create mode 100644 Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml > > > > diff --git a/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml b/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml > > new file mode 100644 > > index 000000000000..08f97f052a91 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml > > @@ -0,0 +1,57 @@ > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iio/afe/temperature-sense-amplifier.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Temperature Sense Amplifier > > + > > +maintainers: > > + - Liam Beguin <lvb@xxxxxxxxxx> > > + > > +description: | > > + When an io-channel measures the output voltage of a temperature analog front > > + end such as an RTD (resistance thermometer) or a temperature to current > > + sensor, the interesting measurement is almost always the corresponding > > + temperature, not the voltage output. This binding describes such a circuit. > > Perhaps add something about this only covering the linear cases... > Okay, will do. > > + > > +properties: > > + compatible: > > + const: temperature-sense-amplifier > > + > > + io-channels: > > + maxItems: 1 > > + description: | > > + Channel node of a voltage io-channel. > > + > > + '#io-channel-cells': > > + const: 1 > > + > > + 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>. > > + > > + sense-offset-millicelsius: > > + description: Amplifier offset. The default is <0>. > > Whilst it may seem obvious I'd like to see a statement of > how these are used somewhere in here. > > temp_celcius = voltage * gain-mult / gain-div + offset > > Mainly because those familiar with the IIO usage of offset > would expect > (voltage + offset) * gain-mult/gain-div > > which doesn't make sense for this device but might leave > people confused! > You're right, I'll add an explicit statement of how these parameters are used. Thanks, Liam > > + > > +additionalProperties: false > > +required: > > + - compatible > > + - io-channels > > + > > +examples: > > + - | > > + pt1000_1: temperature-sensor { > > + compatible = "temperature-sense-amplifier"; > > + #io-channel-cells = <1>; > > + io-channels = <&temp_adc 3>; > > + > > + sense-gain-mult = <1000000>; > > + sense-gain-div = <3908>; > > + sense-offset-millicelsius = <(-255885)>; > > + }; > > +... > > diff --git a/MAINTAINERS b/MAINTAINERS > > index e679d422b472..4f7b4ee9f19b 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -8887,6 +8887,7 @@ L: linux-iio@xxxxxxxxxxxxxxx > > S: Maintained > > F: Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml > > F: Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml > > +F: Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml > > F: Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml > > F: drivers/iio/afe/iio-rescale.c > >