1# SPDX-License-Identifier: (GPL-2.0 OR MIT)
2# Copyright 2019 Linaro Ltd.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/thermal/qcom-tsens.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: QCOM SoC Temperature Sensor (TSENS)
9
10maintainers:
11  - Amit Kucheria <amitk@kernel.org>
12
13description: |
14  QCOM SoCs have TSENS IP to allow temperature measurement. There are currently
15  three distinct major versions of the IP that is supported by a single driver.
16  The IP versions are named v0.1, v1 and v2 in the driver, where v0.1 captures
17  everything before v1 when there was no versioning information.
18
19properties:
20  compatible:
21    oneOf:
22      - description: msm8960 TSENS based
23        items:
24          - enum:
25              - qcom,ipq8064-tsens
26              - qcom,msm8960-tsens
27
28      - description: v0.1 of TSENS
29        items:
30          - enum:
31              - qcom,mdm9607-tsens
32              - qcom,msm8916-tsens
33              - qcom,msm8939-tsens
34              - qcom,msm8974-tsens
35          - const: qcom,tsens-v0_1
36
37      - description: v1 of TSENS
38        items:
39          - enum:
40              - qcom,msm8976-tsens
41              - qcom,qcs404-tsens
42          - const: qcom,tsens-v1
43
44      - description: v2 of TSENS
45        items:
46          - enum:
47              - qcom,msm8953-tsens
48              - qcom,msm8996-tsens
49              - qcom,msm8998-tsens
50              - qcom,sc7180-tsens
51              - qcom,sc7280-tsens
52              - qcom,sc8180x-tsens
53              - qcom,sc8280xp-tsens
54              - qcom,sdm630-tsens
55              - qcom,sdm845-tsens
56              - qcom,sm6350-tsens
57              - qcom,sm8150-tsens
58              - qcom,sm8250-tsens
59              - qcom,sm8350-tsens
60              - qcom,sm8450-tsens
61          - const: qcom,tsens-v2
62
63      - description: v2 of TSENS with combined interrupt
64        enum:
65          - qcom,ipq8074-tsens
66
67  reg:
68    items:
69      - description: TM registers
70      - description: SROT registers
71
72  interrupts:
73    minItems: 1
74    maxItems: 2
75
76  interrupt-names:
77    minItems: 1
78    maxItems: 2
79
80  nvmem-cells:
81    minItems: 1
82    maxItems: 2
83    description:
84      Reference to an nvmem node for the calibration data
85
86  nvmem-cell-names:
87    minItems: 1
88    items:
89      - const: calib
90      - enum:
91          - calib_backup
92          - calib_sel
93
94  "#qcom,sensors":
95    description:
96      Number of sensors enabled on this platform
97    $ref: /schemas/types.yaml#/definitions/uint32
98    minimum: 1
99    maximum: 16
100
101  "#thermal-sensor-cells":
102    const: 1
103    description:
104      Number of cells required to uniquely identify the thermal sensors. Since
105      we have multiple sensors this is set to 1
106
107required:
108  - compatible
109  - interrupts
110  - interrupt-names
111  - "#thermal-sensor-cells"
112  - "#qcom,sensors"
113
114allOf:
115  - if:
116      properties:
117        compatible:
118          contains:
119            enum:
120              - qcom,ipq8064-tsens
121              - qcom,mdm9607-tsens
122              - qcom,msm8916-tsens
123              - qcom,msm8960-tsens
124              - qcom,msm8974-tsens
125              - qcom,msm8976-tsens
126              - qcom,qcs404-tsens
127              - qcom,tsens-v0_1
128              - qcom,tsens-v1
129    then:
130      properties:
131        interrupts:
132          items:
133            - description: Combined interrupt if upper or lower threshold crossed
134        interrupt-names:
135          items:
136            - const: uplow
137
138  - if:
139      properties:
140        compatible:
141          contains:
142            enum:
143              - qcom,msm8953-tsens
144              - qcom,msm8996-tsens
145              - qcom,msm8998-tsens
146              - qcom,sc7180-tsens
147              - qcom,sc7280-tsens
148              - qcom,sc8180x-tsens
149              - qcom,sc8280xp-tsens
150              - qcom,sdm630-tsens
151              - qcom,sdm845-tsens
152              - qcom,sm6350-tsens
153              - qcom,sm8150-tsens
154              - qcom,sm8250-tsens
155              - qcom,sm8350-tsens
156              - qcom,sm8450-tsens
157              - qcom,tsens-v2
158    then:
159      properties:
160        interrupts:
161          items:
162            - description: Combined interrupt if upper or lower threshold crossed
163            - description: Interrupt if critical threshold crossed
164        interrupt-names:
165          items:
166            - const: uplow
167            - const: critical
168
169  - if:
170      properties:
171        compatible:
172          contains:
173            enum:
174              - qcom,ipq8074-tsens
175    then:
176      properties:
177        interrupts:
178          items:
179            - description: Combined interrupt if upper, lower or critical thresholds crossed
180        interrupt-names:
181          items:
182            - const: combined
183
184  - if:
185      properties:
186        compatible:
187          contains:
188            enum:
189              - qcom,ipq8074-tsens
190              - qcom,tsens-v0_1
191              - qcom,tsens-v1
192              - qcom,tsens-v2
193
194    then:
195      required:
196        - reg
197
198additionalProperties: false
199
200examples:
201  - |
202    #include <dt-bindings/interrupt-controller/arm-gic.h>
203    // Example msm9860 based SoC (ipq8064):
204    gcc: clock-controller {
205
206           /* ... */
207
208           tsens: thermal-sensor {
209                compatible = "qcom,ipq8064-tsens";
210
211                 nvmem-cells = <&tsens_calib>, <&tsens_calib_backup>;
212                 nvmem-cell-names = "calib", "calib_backup";
213                 interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
214                 interrupt-names = "uplow";
215
216                 #qcom,sensors = <11>;
217                 #thermal-sensor-cells = <1>;
218          };
219    };
220
221  - |
222    #include <dt-bindings/interrupt-controller/arm-gic.h>
223    // Example 1 (legacy: for pre v1 IP):
224    tsens1: thermal-sensor@900000 {
225           compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";
226           reg = <0x4a9000 0x1000>, /* TM */
227                 <0x4a8000 0x1000>; /* SROT */
228
229           nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
230           nvmem-cell-names = "calib", "calib_sel";
231
232           interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
233           interrupt-names = "uplow";
234
235           #qcom,sensors = <5>;
236           #thermal-sensor-cells = <1>;
237    };
238
239  - |
240    #include <dt-bindings/interrupt-controller/arm-gic.h>
241    // Example 2 (for any platform containing v1 of the TSENS IP):
242    tsens2: thermal-sensor@4a9000 {
243          compatible = "qcom,qcs404-tsens", "qcom,tsens-v1";
244          reg = <0x004a9000 0x1000>, /* TM */
245                <0x004a8000 0x1000>; /* SROT */
246
247          nvmem-cells = <&tsens_caldata>;
248          nvmem-cell-names = "calib";
249
250          interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>;
251          interrupt-names = "uplow";
252
253          #qcom,sensors = <10>;
254          #thermal-sensor-cells = <1>;
255    };
256
257  - |
258    #include <dt-bindings/interrupt-controller/arm-gic.h>
259    // Example 3 (for any platform containing v2 of the TSENS IP):
260    tsens3: thermal-sensor@c263000 {
261           compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
262           reg = <0xc263000 0x1ff>,
263                 <0xc222000 0x1ff>;
264
265           interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
266                        <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>;
267           interrupt-names = "uplow", "critical";
268
269           #qcom,sensors = <13>;
270           #thermal-sensor-cells = <1>;
271    };
272
273  - |
274    #include <dt-bindings/interrupt-controller/arm-gic.h>
275    // Example 4 (for any IPQ8074 based SoC-s):
276    tsens4: thermal-sensor@4a9000 {
277           compatible = "qcom,ipq8074-tsens";
278           reg = <0x4a9000 0x1000>,
279                 <0x4a8000 0x1000>;
280
281           interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
282           interrupt-names = "combined";
283
284           #qcom,sensors = <16>;
285           #thermal-sensor-cells = <1>;
286    };
287...
288