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