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