1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Allwinner SUN8I Thermal Controller Device Tree Bindings
8
9maintainers:
10  - Vasily Khoruzhick <anarsoul@gmail.com>
11  - Yangtao Li <tiny.windzz@gmail.com>
12
13properties:
14  compatible:
15    enum:
16      - allwinner,sun8i-a83t-ths
17      - allwinner,sun8i-h3-ths
18      - allwinner,sun8i-r40-ths
19      - allwinner,sun50i-a64-ths
20      - allwinner,sun50i-a100-ths
21      - allwinner,sun50i-h5-ths
22      - allwinner,sun50i-h6-ths
23
24  clocks:
25    minItems: 1
26    items:
27      - description: Bus Clock
28      - description: Module Clock
29
30  clock-names:
31    minItems: 1
32    items:
33      - const: bus
34      - const: mod
35
36  reg:
37    maxItems: 1
38
39  interrupts:
40    maxItems: 1
41
42  resets:
43    maxItems: 1
44
45  nvmem-cells:
46    maxItems: 1
47    description: Calibration data for thermal sensors
48
49  nvmem-cell-names:
50    const: calibration
51
52  # See Documentation/devicetree/bindings/thermal/thermal-sensor.yaml for details
53  "#thermal-sensor-cells":
54    enum:
55      - 0
56      - 1
57
58allOf:
59  - if:
60      properties:
61        compatible:
62          contains:
63            enum:
64              - allwinner,sun50i-a100-ths
65              - allwinner,sun50i-h6-ths
66
67    then:
68      properties:
69        clocks:
70          maxItems: 1
71
72        clock-names:
73          maxItems: 1
74
75    else:
76      properties:
77        clocks:
78          minItems: 2
79
80        clock-names:
81          minItems: 2
82
83  - if:
84      properties:
85        compatible:
86          contains:
87            const: allwinner,sun8i-h3-ths
88
89    then:
90      properties:
91        "#thermal-sensor-cells":
92          const: 0
93
94    else:
95      properties:
96        "#thermal-sensor-cells":
97          const: 1
98
99  - if:
100      properties:
101        compatible:
102          contains:
103            enum:
104              - allwinner,sun8i-h3-ths
105              - allwinner,sun8i-r40-ths
106              - allwinner,sun50i-a64-ths
107              - allwinner,sun50i-a100-ths
108              - allwinner,sun50i-h5-ths
109              - allwinner,sun50i-h6-ths
110
111    then:
112      required:
113        - clocks
114        - clock-names
115        - resets
116
117required:
118  - compatible
119  - reg
120  - interrupts
121  - '#thermal-sensor-cells'
122
123additionalProperties: false
124
125examples:
126  - |
127    thermal-sensor@1f04000 {
128         compatible = "allwinner,sun8i-a83t-ths";
129         reg = <0x01f04000 0x100>;
130         interrupts = <0 31 0>;
131         nvmem-cells = <&ths_calibration>;
132         nvmem-cell-names = "calibration";
133         #thermal-sensor-cells = <1>;
134    };
135
136  - |
137    thermal-sensor@1c25000 {
138         compatible = "allwinner,sun8i-h3-ths";
139         reg = <0x01c25000 0x400>;
140         clocks = <&ccu 0>, <&ccu 1>;
141         clock-names = "bus", "mod";
142         resets = <&ccu 2>;
143         interrupts = <0 31 0>;
144         nvmem-cells = <&ths_calibration>;
145         nvmem-cell-names = "calibration";
146         #thermal-sensor-cells = <0>;
147    };
148
149  - |
150    thermal-sensor@5070400 {
151         compatible = "allwinner,sun50i-h6-ths";
152         reg = <0x05070400 0x100>;
153         clocks = <&ccu 0>;
154         clock-names = "bus";
155         resets = <&ccu 2>;
156         interrupts = <0 15 0>;
157         nvmem-cells = <&ths_calibration>;
158         nvmem-cell-names = "calibration";
159         #thermal-sensor-cells = <1>;
160    };
161
162...
163