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    spmi_bus {
171        #address-cells = <1>;
172        #size-cells = <0>;
173        pm8150b_adc: adc@3100 {
174            reg = <0x3100>;
175            compatible = "qcom,spmi-adc5";
176            #address-cells = <1>;
177            #size-cells = <0>;
178            #io-channel-cells = <1>;
179
180            /* Other properties are omitted */
181            conn-therm@4f {
182                reg = <ADC5_AMUX_THM3_100K_PU>;
183                qcom,ratiometric;
184                qcom,hw-settle-time = <200>;
185            };
186        };
187
188        pm8150b_adc_tm: adc-tm@3500 {
189            compatible = "qcom,spmi-adc-tm5";
190            reg = <0x3500>;
191            interrupts = <0x2 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
192            #thermal-sensor-cells = <1>;
193            #address-cells = <1>;
194            #size-cells = <0>;
195
196            conn-therm@0 {
197                reg = <0>;
198                io-channels = <&pm8150b_adc ADC5_AMUX_THM3_100K_PU>;
199                qcom,ratiometric;
200                qcom,hw-settle-time-us = <200>;
201            };
202        };
203    };
204
205  - |
206    #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
207    #include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
208    #include <dt-bindings/interrupt-controller/irq.h>
209    spmi_bus {
210        #address-cells = <1>;
211        #size-cells = <0>;
212        pmk8350_vadc: adc@3100 {
213            reg = <0x3100>;
214            compatible = "qcom,spmi-adc7";
215            #address-cells = <1>;
216            #size-cells = <0>;
217            #io-channel-cells = <1>;
218
219            /* Other properties are omitted */
220            xo-therm@44 {
221                reg = <PMK8350_ADC7_AMUX_THM1_100K_PU>;
222                qcom,ratiometric;
223                qcom,hw-settle-time = <200>;
224            };
225
226            conn-therm@147 {
227                reg = <PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
228                qcom,ratiometric;
229                qcom,hw-settle-time = <200>;
230            };
231        };
232
233        pmk8350_adc_tm: adc-tm@3400 {
234            compatible = "qcom,spmi-adc-tm5-gen2";
235            reg = <0x3400>;
236            interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
237            #thermal-sensor-cells = <1>;
238            #address-cells = <1>;
239            #size-cells = <0>;
240
241            pmk8350-xo-therm@0 {
242                reg = <0>;
243                io-channels = <&pmk8350_vadc PMK8350_ADC7_AMUX_THM1_100K_PU>;
244                qcom,decimation = <340>;
245                qcom,ratiometric;
246                qcom,hw-settle-time-us = <200>;
247            };
248
249            conn-therm@1 {
250                reg = <1>;
251                io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU(1)>;
252                qcom,avg-samples = <2>;
253                qcom,ratiometric;
254                qcom,hw-settle-time-us = <200>;
255            };
256        };
257    };
258...
259