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 <amit.kucheria@linaro.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: v0.1 of TSENS
23        items:
24          - enum:
25              - qcom,msm8916-tsens
26              - qcom,msm8974-tsens
27          - const: qcom,tsens-v0_1
28
29      - description: v1 of TSENS
30        items:
31          - enum:
32              - qcom,msm8976-tsens
33              - qcom,qcs404-tsens
34          - const: qcom,tsens-v1
35
36      - description: v2 of TSENS
37        items:
38          - enum:
39              - qcom,msm8996-tsens
40              - qcom,msm8998-tsens
41              - qcom,sc7180-tsens
42              - qcom,sdm845-tsens
43          - const: qcom,tsens-v2
44
45  reg:
46    items:
47      - description: TM registers
48      - description: SROT registers
49
50  interrupts:
51    minItems: 1
52    items:
53      - description: Combined interrupt if upper or lower threshold crossed
54      - description: Interrupt if critical threshold crossed
55
56  interrupt-names:
57    minItems: 1
58    items:
59      - const: uplow
60      - const: critical
61
62  nvmem-cells:
63    minItems: 1
64    maxItems: 2
65    description:
66      Reference to an nvmem node for the calibration data
67
68  nvmem-cell-names:
69    minItems: 1
70    maxItems: 2
71    items:
72      - const: calib
73      - const: calib_sel
74
75  "#qcom,sensors":
76    description:
77      Number of sensors enabled on this platform
78    $ref: /schemas/types.yaml#/definitions/uint32
79    minimum: 1
80    maximum: 16
81
82  "#thermal-sensor-cells":
83    const: 1
84    description:
85      Number of cells required to uniquely identify the thermal sensors. Since
86      we have multiple sensors this is set to 1
87
88allOf:
89  - if:
90      properties:
91        compatible:
92          contains:
93            enum:
94              - qcom,msm8916-tsens
95              - qcom,msm8974-tsens
96              - qcom,msm8976-tsens
97              - qcom,qcs404-tsens
98              - qcom,tsens-v0_1
99              - qcom,tsens-v1
100    then:
101      properties:
102        interrupts:
103          maxItems: 1
104        interrupt-names:
105          maxItems: 1
106
107    else:
108      properties:
109        interrupts:
110          minItems: 2
111        interrupt-names:
112          minItems: 2
113
114required:
115  - compatible
116  - reg
117  - "#qcom,sensors"
118  - interrupts
119  - interrupt-names
120  - "#thermal-sensor-cells"
121
122additionalProperties: false
123
124examples:
125  - |
126    #include <dt-bindings/interrupt-controller/arm-gic.h>
127    // Example 1 (legacy: for pre v1 IP):
128    tsens1: thermal-sensor@900000 {
129           compatible = "qcom,msm8916-tsens", "qcom,tsens-v0_1";
130           reg = <0x4a9000 0x1000>, /* TM */
131                 <0x4a8000 0x1000>; /* SROT */
132
133           nvmem-cells = <&tsens_caldata>, <&tsens_calsel>;
134           nvmem-cell-names = "calib", "calib_sel";
135
136           interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
137           interrupt-names = "uplow";
138
139           #qcom,sensors = <5>;
140           #thermal-sensor-cells = <1>;
141    };
142
143  - |
144    #include <dt-bindings/interrupt-controller/arm-gic.h>
145    // Example 2 (for any platform containing v1 of the TSENS IP):
146    tsens2: thermal-sensor@4a9000 {
147          compatible = "qcom,qcs404-tsens", "qcom,tsens-v1";
148          reg = <0x004a9000 0x1000>, /* TM */
149                <0x004a8000 0x1000>; /* SROT */
150
151          nvmem-cells = <&tsens_caldata>;
152          nvmem-cell-names = "calib";
153
154          interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>;
155          interrupt-names = "uplow";
156
157          #qcom,sensors = <10>;
158          #thermal-sensor-cells = <1>;
159    };
160
161  - |
162    #include <dt-bindings/interrupt-controller/arm-gic.h>
163    // Example 3 (for any platform containing v2 of the TSENS IP):
164    tsens3: thermal-sensor@c263000 {
165           compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
166           reg = <0xc263000 0x1ff>,
167                 <0xc222000 0x1ff>;
168
169           interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
170                        <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>;
171           interrupt-names = "uplow", "critical";
172
173           #qcom,sensors = <13>;
174           #thermal-sensor-cells = <1>;
175    };
176...
177