1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/iio/afe/temperature-transducer.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Temperature Transducer
8
9maintainers:
10  - Liam Beguin <liambeguin@gmail.com>
11
12description: |
13  A temperature transducer is a device that converts a thermal quantity
14  into any other physical quantity. This binding applies to temperature to
15  voltage (like the LTC2997), and temperature to current (like the AD590)
16  linear transducers.
17  In both cases these are assumed to be connected to a voltage ADC.
18
19  When an io-channel measures the output voltage of a temperature analog front
20  end such as a temperature transducer, the interesting measurement is almost
21  always the corresponding temperature, not the voltage output. This binding
22  describes such a circuit.
23
24  The general transfer function here is (using SI units)
25    V(T) = Rsense * Isense(T)
26    T = (Isense(T) / alpha) + offset
27    T = 1 / (Rsense * alpha) * (V + offset * Rsense * alpha)
28
29  When using a temperature to voltage transducer, Rsense is set to 1.
30
31  The following circuits show a temperature to current and a temperature to
32  voltage transducer that can be used with this binding.
33
34           VCC
35          -----
36            |
37        +---+---+
38        | AD590 |                               VCC
39        +---+---+                              -----
40            |                                    |
41            V proportional to T             +----+----+
42            |                          D+ --+         |
43            +---- Vout                      | LTC2997 +--- Vout
44            |                          D- --+         |
45        +---+----+                          +---------+
46        | Rsense |                               |
47        +---+----+                             -----
48            |                                   GND
49          -----
50           GND
51
52properties:
53  compatible:
54    const: temperature-transducer
55
56  io-channels:
57    maxItems: 1
58    description: |
59      Channel node of a voltage io-channel.
60
61  '#io-channel-cells':
62    const: 0
63
64  sense-offset-millicelsius:
65    description: |
66      Temperature offset.
67      This offset is commonly used to convert from Kelvins to degrees Celsius.
68      In that case, sense-offset-millicelsius would be set to <(-273150)>.
69    default: 0
70
71  sense-resistor-ohms:
72    description: |
73      The sense resistor.
74      By default sense-resistor-ohms cancels out the resistor making the
75      circuit behave like a temperature transducer.
76    default: 1
77
78  alpha-ppm-per-celsius:
79    description: |
80      Sometimes referred to as output gain, slope, or temperature coefficient.
81
82      alpha is expressed in parts per million which can be micro-amps per
83      degrees Celsius or micro-volts per degrees Celsius. The is the main
84      characteristic of a temperature transducer and should be stated in the
85      datasheet.
86
87additionalProperties: false
88
89required:
90  - compatible
91  - io-channels
92  - alpha-ppm-per-celsius
93
94examples:
95  - |
96    ad950: temperature-sensor-0 {
97        compatible = "temperature-transducer";
98        #io-channel-cells = <0>;
99        io-channels = <&temp_adc 3>;
100
101        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
102        sense-resistor-ohms = <8060>;
103        alpha-ppm-per-celsius = <1>; /* 1 uA/K */
104    };
105  - |
106    znq_tmp: temperature-sensor-1 {
107        compatible = "temperature-transducer";
108        #io-channel-cells = <0>;
109        io-channels = <&temp_adc 2>;
110
111        sense-offset-millicelsius = <(-273150)>; /* Kelvin to degrees Celsius */
112        alpha-ppm-per-celsius = <4000>; /* 4 mV/K */
113    };
114...
115