1# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/thermal/qcom-spmi-adc-tm5.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Qualcomm's SPMI PMIC ADC Thermal Monitoring
8maintainers:
9  - Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
10
11properties:
12  compatible:
13    enum:
14      - qcom,spmi-adc-tm5
15      - qcom,spmi-adc-tm5-gen2
16      - qcom,adc-tm7 # Incomplete / subject to change
17
18  reg:
19    maxItems: 1
20
21  interrupts:
22    maxItems: 1
23
24  "#thermal-sensor-cells":
25    const: 1
26    description:
27      Number of cells required to uniquely identify the thermal sensors. Since
28      we have multiple sensors this is set to 1
29
30  "#address-cells":
31    const: 1
32
33  "#size-cells":
34    const: 0
35
36  qcom,avg-samples:
37    $ref: /schemas/types.yaml#/definitions/uint32
38    description: Number of samples to be used for measurement.
39            Not applicable for Gen2 ADC_TM peripheral.
40    enum:
41      - 1
42      - 2
43      - 4
44      - 8
45      - 16
46    default: 1
47
48  qcom,decimation:
49    $ref: /schemas/types.yaml#/definitions/uint32
50    description: This parameter is used to decrease ADC sampling rate.
51            Quicker measurements can be made by reducing decimation ratio.
52            Not applicable for Gen2 ADC_TM peripheral.
53    enum:
54      - 250
55      - 420
56      - 840
57    default: 840
58
59patternProperties:
60  "^([-a-z0-9]*)@[0-7]$":
61    type: object
62    description:
63      Represent one thermal sensor.
64
65    properties:
66      reg:
67        description: Specify the sensor channel. There are 8 channels in PMIC5's ADC TM
68        minimum: 0
69        maximum: 7
70
71      io-channels:
72        description:
73          From common IIO binding. Used to pipe PMIC ADC channel to thermal monitor
74
75      qcom,ratiometric:
76        $ref: /schemas/types.yaml#/definitions/flag
77        description:
78          Channel calibration type.
79          If this property is specified VADC will use the VDD reference
80          (1.875V) and GND for channel calibration. If property is not found,
81          channel will be calibrated with 0V and 1.25V reference channels,
82          also known as absolute calibration.
83
84      qcom,hw-settle-time-us:
85        description: Time between AMUX getting configured and the ADC starting conversion.
86        enum: [15, 100, 200, 300, 400, 500, 600, 700, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000]
87
88      qcom,pre-scaling:
89        $ref: /schemas/types.yaml#/definitions/uint32-array
90        description: Used for scaling the channel input signal before the
91          signal is fed to VADC. The configuration for this node is to know the
92          pre-determined ratio and use it for post scaling. It is a pair of
93          integers, denoting the numerator and denominator of the fraction by
94          which input signal is multiplied. For example, <1 3> indicates the
95          signal is scaled down to 1/3 of its value before ADC measurement.  If
96          property is not found default value depending on chip will be used.
97        items:
98          - const: 1
99          - enum: [ 1, 3, 4, 6, 20, 8, 10 ]
100
101      qcom,avg-samples:
102        $ref: /schemas/types.yaml#/definitions/uint32
103        description: Number of samples to be used for measurement.
104          This property in child node is applicable only for Gen2 ADC_TM peripheral.
105        enum:
106          - 1
107          - 2
108          - 4
109          - 8
110          - 16
111        default: 1
112
113      qcom,decimation:
114        $ref: /schemas/types.yaml#/definitions/uint32
115        description: This parameter is used to decrease ADC sampling rate.
116          Quicker measurements can be made by reducing decimation ratio.
117          This property in child node is applicable only for Gen2 ADC_TM peripheral.
118        enum:
119          - 85
120          - 340
121          - 1360
122        default: 1360
123
124    required:
125      - reg
126      - io-channels
127
128    additionalProperties:
129      false
130
131allOf:
132  - if:
133      properties:
134        compatible:
135          contains:
136            const: qcom,spmi-adc-tm5
137
138    then:
139      patternProperties:
140        "^([-a-z0-9]*)@[0-7]$":
141          properties:
142            qcom,decimation: false
143            qcom,avg-samples: false
144
145  - if:
146      properties:
147        compatible:
148          contains:
149            const: qcom,spmi-adc-tm5-gen2
150
151    then:
152      properties:
153        qcom,avg-samples: false
154        qcom,decimation: false
155
156required:
157  - compatible
158  - reg
159  - interrupts
160  - "#address-cells"
161  - "#size-cells"
162  - "#thermal-sensor-cells"
163
164additionalProperties: false
165
166examples:
167  - |
168    #include <dt-bindings/iio/qcom,spmi-vadc.h>
169    #include <dt-bindings/interrupt-controller/irq.h>
170
171    pmic {
172        #address-cells = <1>;
173        #size-cells = <0>;
174
175        pm8150b_adc: adc@3100 {
176            compatible = "qcom,spmi-adc5";
177            reg = <0x3100>;
178            #address-cells = <1>;
179            #size-cells = <0>;
180            #io-channel-cells = <1>;
181
182            /* Other properties are omitted */
183            channel@4f {
184                reg = <ADC5_AMUX_THM3_100K_PU>;
185                qcom,ratiometric;
186                qcom,hw-settle-time = <200>;
187                label = "conn_therm";
188            };
189        };
190
191        adc-tm@3500 {
192            compatible = "qcom,spmi-adc-tm5";
193            reg = <0x3500>;
194            interrupts = <0x2 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
195            #thermal-sensor-cells = <1>;
196            #address-cells = <1>;
197            #size-cells = <0>;
198
199            conn-therm@0 {
200                reg = <0>;
201                io-channels = <&pm8150b_adc ADC5_AMUX_THM3_100K_PU>;
202                qcom,ratiometric;
203                qcom,hw-settle-time-us = <200>;
204            };
205        };
206    };
207
208  - |
209    #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
210    #include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
211    #include <dt-bindings/interrupt-controller/irq.h>
212
213    pmic {
214        #address-cells = <1>;
215        #size-cells = <0>;
216
217        pmk8350_vadc: adc@3100 {
218            compatible = "qcom,spmi-adc7";
219            reg = <0x3100>;
220            #address-cells = <1>;
221            #size-cells = <0>;
222            #io-channel-cells = <1>;
223
224            /* Other properties are omitted */
225            channel@44 {
226                reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
227                qcom,ratiometric;
228                qcom,hw-settle-time = <200>;
229                label = "xo_therm";
230            };
231
232            channel@147 {
233                reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
234                qcom,ratiometric;
235                qcom,hw-settle-time = <200>;
236                label = "conn_therm";
237            };
238        };
239
240        adc-tm@3400 {
241            compatible = "qcom,spmi-adc-tm5-gen2";
242            reg = <0x3400>;
243            interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
244            #thermal-sensor-cells = <1>;
245            #address-cells = <1>;
246            #size-cells = <0>;
247
248            pmk8350-xo-therm@0 {
249                reg = <0>;
250                io-channels = <&pmk8350_vadc PMK8350_ADC7_AMUX_THM1_100K_PU>;
251                qcom,decimation = <340>;
252                qcom,ratiometric;
253                qcom,hw-settle-time-us = <200>;
254            };
255
256            conn-therm@1 {
257                reg = <1>;
258                io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
259                qcom,avg-samples = <2>;
260                qcom,ratiometric;
261                qcom,hw-settle-time-us = <200>;
262            };
263        };
264    };
265...
266