linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Liam Beguin" <liambeguin@gmail.com>
To: "Rob Herring" <robh@kernel.org>
Cc: <peda@axentia.se>, <jic23@kernel.org>, <lars@metafoo.de>,
	<pmeerw@pmeerw.net>, <linux-kernel@vger.kernel.org>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 10/10] dt-bindings: iio: afe: add bindings for temperature transducers
Date: Tue, 13 Jul 2021 00:20:57 -0400	[thread overview]
Message-ID: <CCRQ33B4B96F.3IX5IUAK24F49@shaak> (raw)
In-Reply-To: <20210712161156.GA2029104@robh.at.kernel.org>

On Mon Jul 12, 2021 at 12:11 PM EDT, Rob Herring wrote:
> On Tue, Jul 06, 2021 at 12:09:42PM -0400, Liam Beguin wrote:
> > From: Liam Beguin <lvb@xiphos.com>
> > 
> > An ADC is often used to measure other quantities indirectly.
> > This binding describe one case, the measurement of a temperature
> > through a temperature transducer (either voltage or current).
> > 
> > Signed-off-by: Liam Beguin <lvb@xiphos.com>
> > ---
> >  .../iio/afe/temperature-transducer.yaml       | 111 ++++++++++++++++++
> >  1 file changed, 111 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/afe/temperature-transducer.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/afe/temperature-transducer.yaml b/Documentation/devicetree/bindings/iio/afe/temperature-transducer.yaml
> > new file mode 100644
> > index 000000000000..b5a4fbfe75e4
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/afe/temperature-transducer.yaml
> > @@ -0,0 +1,111 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/afe/temperature-transducer.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Temperature Transducer
> > +
> > +maintainers:
> > +  - Liam Beguin <lvb@xiphos.com>
> > +
> > +description: |
> > +  A temperature transducer is a device that converts a thermal quantity
> > +  into any other physical quantity. This binding applies to temperature to
> > +  voltage (like the LTC2997), and temperature to current (like the AD590)
> > +  linear transducers.
> > +  In both cases these are assumed to be connected to a voltage ADC.
> > +
> > +  When an io-channel measures the output voltage of a temperature analog front
> > +  end such as a temperature transducer, the interesting measurement is almost
> > +  always the corresponding temperature, not the voltage output. This binding
> > +  describes such a circuit.
> > +
> > +  The general transfer function here is (using SI units)
> > +    V(T) = Rsense * Isense(T)
> > +    T = (Isense(T) / alpha) + offset
> > +    T = 1 / (Rsense * alpha) * (V + offset * Rsense * alpha)
> > +
> > +  When using a temperature to voltage transducer, Rsense is set to 1.
> > +
> > +  The following circuits show a temperature to current and a temperature to
> > +  voltage transducer that can be used with this binding.
> > +
> > +           VCC
> > +          -----
> > +            |
> > +        +---+---+
> > +        | AD590 |                               VCC
> > +        +---+---+                              -----
> > +            |                                    |
> > +            V proportional to T             +----+----+
> > +            |                          D+ --+         |
> > +            +---- Vout                      | LTC2997 +--- Vout
> > +            |                          D- --+         |
> > +        +---+----+                          +---------+
> > +        | Rsense |                               |
> > +        +---+----+                             -----
> > +            |                                   GND
> > +          -----
> > +           GND
> > +
> > +properties:
> > +  compatible:
> > +    const: temperature-transducer
> > +
> > +  io-channels:
> > +    maxItems: 1
> > +    description: |
> > +      Channel node of a voltage io-channel.
> > +
> > +  '#io-channel-cells':
> > +    const: 0

Hi Rob,

>
> This is a io-channel consumer and producer?
>

Yes, this is a consumer and a producer.
It consumes a single ADC channel and can be fed to something like hwmon.

> > +
> > +  sense-offset-millicelsius:
> > +    description: |
> > +      Temperature offset. The default is <0>.
> > +      This offset is commonly used to convert from Kelvins to degrees Celsius.
> > +      In that case, sense-offset-millicelsius would be set to <(-273150)>.
>
> default: 0
>
> > +
> > +  sense-resistor-ohms:
> > +    description: |
> > +      The sense resistor. Defaults to <1>.
> > +      Set sense-resistor-ohms to <1> when using a temperature to voltage
> > +      transducer.
>
> default: 1
>
> Though why would we set the value to 1 if the default is 1?
>

I can rephrase this. I meant to say that the default will make this
behave like a temperature to voltage transducer.

Liam

> > +
> > +  alpha-ppm-per-celsius:
> > +    description: |
> > +      Sometimes referred to as output gain, slope, or temperature coefficient.
> > +
> > +      alpha is expressed in parts per million which can be micro-amps per
> > +      degrees Celsius or micro-volts per degrees Celsius. The is the main
> > +      characteristic of a temperature transducer and should be stated in the
> > +      datasheet.
> > +
> > +additionalProperties: false
>
> Blank line here.
>
> > +required:
> > +  - compatible
> > +  - io-channels
> > +  - alpha-ppm-per-celsius
> > +
> > +examples:
> > +  - |
> > +    ad950: temperature-sensor-0 {
> > +        compatible = "temperature-transducer";
> > +        #io-channel-cells = <0>;
> > +        io-channels = <&temp_adc 3>;
> > +
> > +        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
> > +        sense-resistor-ohms = <8060>;
> > +        alpha-ppm-per-celsius = <1>; /* 1 uA/K */
> > +    };
> > +  - |
> > +    znq_tmp: temperature-sensor-1 {
> > +        compatible = "temperature-transducer";
> > +        #io-channel-cells = <0>;
> > +        io-channels = <&temp_adc 2>;
> > +
> > +        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
> > +        alpha-ppm-per-celsius = <4000>; /* 4 mV/K */
> > +    };
> > +...
> > -- 
> > 2.30.1.489.g328c10930387
> > 
> > 


      reply	other threads:[~2021-07-13  4:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 16:09 [PATCH v4 00/10] iio: afe: add temperature rescaling support Liam Beguin
2021-07-06 16:09 ` [PATCH v4 01/10] iio: inkern: apply consumer scale on IIO_VAL_INT cases Liam Beguin
2021-07-06 16:09 ` [PATCH v4 02/10] iio: inkern: apply consumer scale when no channel scale is available Liam Beguin
2021-07-06 16:09 ` [PATCH v4 03/10] iio: inkern: make a best effort on offset calculation Liam Beguin
2021-07-06 16:09 ` [PATCH v4 04/10] iio: afe: rescale: reduce risk of integer overflow Liam Beguin
2021-07-09 16:24   ` Peter Rosin
2021-07-09 19:22     ` Liam Beguin
2021-07-06 16:09 ` [PATCH v4 05/10] iio: afe: rescale: add INT_PLUS_{MICRO,NANO} support Liam Beguin
2021-07-09 16:29   ` Peter Rosin
2021-07-09 19:30     ` Liam Beguin
2021-07-10  8:14       ` Peter Rosin
2021-07-10 17:45         ` Liam Beguin
2021-07-06 16:09 ` [PATCH v4 06/10] iio: afe: rescale: add offset support Liam Beguin
2021-07-06 16:09 ` [PATCH v4 07/10] iio: afe: rescale: add RTD temperature sensor support Liam Beguin
2021-07-06 16:09 ` [PATCH v4 08/10] iio: afe: rescale: add temperature transducers Liam Beguin
2021-07-06 16:09 ` [PATCH v4 09/10] dt-bindings: iio: afe: add bindings for temperature-sense-rtd Liam Beguin
2021-07-12 16:08   ` Rob Herring
2021-07-06 16:09 ` [PATCH v4 10/10] dt-bindings: iio: afe: add bindings for temperature transducers Liam Beguin
2021-07-12 16:11   ` Rob Herring
2021-07-13  4:20     ` Liam Beguin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CCRQ33B4B96F.3IX5IUAK24F49@shaak \
    --to=liambeguin@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).