162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/iio/afe/temperature-transducer.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Temperature Transducer
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Liam Beguin <liambeguin@gmail.com>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cidescription: |
1362306a36Sopenharmony_ci  A temperature transducer is a device that converts a thermal quantity
1462306a36Sopenharmony_ci  into any other physical quantity. This binding applies to temperature to
1562306a36Sopenharmony_ci  voltage (like the LTC2997), and temperature to current (like the AD590)
1662306a36Sopenharmony_ci  linear transducers.
1762306a36Sopenharmony_ci  In both cases these are assumed to be connected to a voltage ADC.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci  When an io-channel measures the output voltage of a temperature analog front
2062306a36Sopenharmony_ci  end such as a temperature transducer, the interesting measurement is almost
2162306a36Sopenharmony_ci  always the corresponding temperature, not the voltage output. This binding
2262306a36Sopenharmony_ci  describes such a circuit.
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci  The general transfer function here is (using SI units)
2562306a36Sopenharmony_ci    V(T) = Rsense * Isense(T)
2662306a36Sopenharmony_ci    T = (Isense(T) / alpha) + offset
2762306a36Sopenharmony_ci    T = 1 / (Rsense * alpha) * (V + offset * Rsense * alpha)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci  When using a temperature to voltage transducer, Rsense is set to 1.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci  The following circuits show a temperature to current and a temperature to
3262306a36Sopenharmony_ci  voltage transducer that can be used with this binding.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci           VCC
3562306a36Sopenharmony_ci          -----
3662306a36Sopenharmony_ci            |
3762306a36Sopenharmony_ci        +---+---+
3862306a36Sopenharmony_ci        | AD590 |                               VCC
3962306a36Sopenharmony_ci        +---+---+                              -----
4062306a36Sopenharmony_ci            |                                    |
4162306a36Sopenharmony_ci            V proportional to T             +----+----+
4262306a36Sopenharmony_ci            |                          D+ --+         |
4362306a36Sopenharmony_ci            +---- Vout                      | LTC2997 +--- Vout
4462306a36Sopenharmony_ci            |                          D- --+         |
4562306a36Sopenharmony_ci        +---+----+                          +---------+
4662306a36Sopenharmony_ci        | Rsense |                               |
4762306a36Sopenharmony_ci        +---+----+                             -----
4862306a36Sopenharmony_ci            |                                   GND
4962306a36Sopenharmony_ci          -----
5062306a36Sopenharmony_ci           GND
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciproperties:
5362306a36Sopenharmony_ci  compatible:
5462306a36Sopenharmony_ci    const: temperature-transducer
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci  io-channels:
5762306a36Sopenharmony_ci    maxItems: 1
5862306a36Sopenharmony_ci    description: |
5962306a36Sopenharmony_ci      Channel node of a voltage io-channel.
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci  '#io-channel-cells':
6262306a36Sopenharmony_ci    const: 0
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci  sense-offset-millicelsius:
6562306a36Sopenharmony_ci    description: |
6662306a36Sopenharmony_ci      Temperature offset.
6762306a36Sopenharmony_ci      This offset is commonly used to convert from Kelvins to degrees Celsius.
6862306a36Sopenharmony_ci      In that case, sense-offset-millicelsius would be set to <(-273150)>.
6962306a36Sopenharmony_ci    default: 0
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci  sense-resistor-ohms:
7262306a36Sopenharmony_ci    description: |
7362306a36Sopenharmony_ci      The sense resistor.
7462306a36Sopenharmony_ci      By default sense-resistor-ohms cancels out the resistor making the
7562306a36Sopenharmony_ci      circuit behave like a temperature transducer.
7662306a36Sopenharmony_ci    default: 1
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci  alpha-ppm-per-celsius:
7962306a36Sopenharmony_ci    description: |
8062306a36Sopenharmony_ci      Sometimes referred to as output gain, slope, or temperature coefficient.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci      alpha is expressed in parts per million which can be micro-amps per
8362306a36Sopenharmony_ci      degrees Celsius or micro-volts per degrees Celsius. The is the main
8462306a36Sopenharmony_ci      characteristic of a temperature transducer and should be stated in the
8562306a36Sopenharmony_ci      datasheet.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciadditionalProperties: false
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_cirequired:
9062306a36Sopenharmony_ci  - compatible
9162306a36Sopenharmony_ci  - io-channels
9262306a36Sopenharmony_ci  - alpha-ppm-per-celsius
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciexamples:
9562306a36Sopenharmony_ci  - |
9662306a36Sopenharmony_ci    ad950: temperature-sensor-0 {
9762306a36Sopenharmony_ci        compatible = "temperature-transducer";
9862306a36Sopenharmony_ci        #io-channel-cells = <0>;
9962306a36Sopenharmony_ci        io-channels = <&temp_adc 3>;
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
10262306a36Sopenharmony_ci        sense-resistor-ohms = <8060>;
10362306a36Sopenharmony_ci        alpha-ppm-per-celsius = <1>; /* 1 uA/K */
10462306a36Sopenharmony_ci    };
10562306a36Sopenharmony_ci  - |
10662306a36Sopenharmony_ci    znq_tmp: temperature-sensor-1 {
10762306a36Sopenharmony_ci        compatible = "temperature-transducer";
10862306a36Sopenharmony_ci        #io-channel-cells = <0>;
10962306a36Sopenharmony_ci        io-channels = <&temp_adc 2>;
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
11262306a36Sopenharmony_ci        alpha-ppm-per-celsius = <4000>; /* 4 mV/K */
11362306a36Sopenharmony_ci    };
11462306a36Sopenharmony_ci...
115