← Documents Documentation/devicetree/bindings/thermal/thermal-zones.yaml GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings / Thermal

Thermal Zones

Thermal zone의 polling, trip, sensor coefficient, cooling-map과 SDM845 예제를 설명합니다.

Source pathDocumentation/devicetree/bindings/thermal/thermal-zones.yaml
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

thermal-zones.yaml:1-359

Thermal zone 공통 schema의 모든 속성, threshold 동작, 정확한 수식과 수치, 긴 SDM845 예제를 원문 줄 좌표에 맞춰 전문 번역합니다. 접을 수 있는 영어 원문 전체에는 source path, symbol, phandle, 표기와 코드가 그대로 보존됩니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 # SPDX-License-Identifier: (GPL-2.0)
2 # Copyright 2020 Linaro Ltd.
3 %YAML 1.2
4 ---
5 $id: http://devicetree.org/schemas/thermal/thermal-zones.yaml#
6 $schema: http://devicetree.org/meta-schemas/base.yaml#
7
8 title: Thermal zone
9
10 maintainers:
11 - Daniel Lezcano <[email protected]>
12
13 description: |
14 Thermal management is achieved in devicetree by describing the sensor hardware
15 and the software abstraction of cooling devices and thermal zones required to
16 take appropriate action to mitigate thermal overloads.
17
18 The following node types are used to completely describe a thermal management
19 system in devicetree:
20 - thermal-sensor: device that measures temperature, has SoC-specific bindings
21 - cooling-device: device used to dissipate heat either passively or actively
22 - thermal-zones: a container of the following node types used to describe all
23 thermal data for the platform
24
25 This binding describes the thermal-zones.
26
27 The polling-delay properties of a thermal-zone are bound to the maximum dT/dt
28 (temperature derivative over time) in two situations for a thermal zone:
29 1. when passive cooling is activated (polling-delay-passive)
30 2. when the zone just needs to be monitored (polling-delay) or when
31 active cooling is activated.
32
33 The maximum dT/dt is highly bound to hardware power consumption and
34 dissipation capability. The delays should be chosen to account for said
35 max dT/dt, such that a device does not cross several trip boundaries
36 unexpectedly between polls. Choosing the right polling delays shall avoid
37 having the device in temperature ranges that may damage the silicon structures
38 and reduce silicon lifetime.
39
40 properties:
41 $nodename:
42 const: thermal-zones
43 description:
44 A /thermal-zones node is required in order to use the thermal framework to
45 manage input from the various thermal zones in the system in order to
46 mitigate thermal overload conditions. It does not represent a real device
47 in the system, but acts as a container to link a thermal sensor device,
48 platform-data regarding temperature thresholds and the mitigation actions
49 to take when the temperature crosses those thresholds.
50
51 patternProperties:
52 # Node name is limited in size due to Linux kernel requirements - 19
53 # characters in total (see THERMAL_NAME_LENGTH, including terminating NUL
54 # byte):
55 "^[a-zA-Z][a-zA-Z0-9\\-]{1,10}-thermal$":
56 type: object
57 description:
58 Each thermal zone node contains information about how frequently it
59 must be checked, the sensor responsible for reporting temperature for
60 this zone, one sub-node containing the various trip points for this
61 zone and one sub-node containing all the zone cooling-maps.
62
63 properties:
64 polling-delay:
65 $ref: /schemas/types.yaml#/definitions/uint32
66 description:
67 The maximum number of milliseconds to wait between polls when
68 checking this thermal zone. Setting this to 0 disables the polling
69 timers setup by the thermal framework and assumes that the thermal
70 sensors in this zone support interrupts.
71
72 polling-delay-passive:
73 $ref: /schemas/types.yaml#/definitions/uint32
74 description:
75 The maximum number of milliseconds to wait between polls when
76 checking this thermal zone while doing passive cooling. Setting
77 this to 0 disables the polling timers setup by the thermal
78 framework and assumes that the thermal sensors in this zone
79 support interrupts.
80
81 critical-action:
82 $ref: /schemas/types.yaml#/definitions/string
83 description: |
84 The action the OS should perform after the critical temperature is reached.
85 If the property is not set, it is up to the system to select the correct
86 action. The recommended and preferred default is shutdown.
87 Choose 'reboot' with care, as the hardware may be in thermal stress,
88 thus leading to infinite reboots that may cause damage to the hardware.
89 Make sure the firmware/bootloader will act as the last resort and take
90 over the thermal control.
91
92 enum:
93 - shutdown
94 - reboot
95
96 thermal-sensors:
97 $ref: /schemas/types.yaml#/definitions/phandle-array
98 maxItems: 1
99 description:
100 The thermal sensor phandle and sensor specifier used to monitor this
101 thermal zone.
102
103 coefficients:
104 $ref: /schemas/types.yaml#/definitions/uint32-array
105 description:
106 An array of integers containing the coefficients of a linear equation
107 that binds all the sensors listed in this thermal zone.
108
109 The linear equation used is as follows,
110 z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn
111 where c0, c1, .., cn are the coefficients.
112
113 Coefficients default to 1 in case this property is not specified. The
114 coefficients are ordered and are matched with sensors by means of the
115 sensor ID. Additional coefficients are interpreted as constant offset.
116
117 sustainable-power:
118 $ref: /schemas/types.yaml#/definitions/uint32
119 description:
120 An estimate of the sustainable power (in mW) that this thermal zone
121 can dissipate at the desired control temperature. For reference, the
122 sustainable power of a 4-inch phone is typically 2000mW, while on a
123 10-inch tablet is around 4500mW.
124
125 trips:
126 type: object
127 description:
128 This node describes a set of points in the temperature domain at
129 which the thermal framework needs to take action. The actions to
130 be taken are defined in another node called cooling-maps.
131
132 patternProperties:
133 "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$":
134 type: object
135
136 properties:
137 temperature:
138 $ref: /schemas/types.yaml#/definitions/int32
139 minimum: -273000
140 maximum: 200000
141 description:
142 An integer expressing the trip temperature in millicelsius.
143
144 hysteresis:
145 $ref: /schemas/types.yaml#/definitions/uint32
146 description:
147 An unsigned integer expressing the hysteresis delta with
148 respect to the trip temperature property above, also in
149 millicelsius. Any cooling action initiated by the framework is
150 maintained until the temperature falls below
151 (trip temperature - hysteresis). This potentially prevents a
152 situation where the trip gets constantly triggered soon after
153 cooling action is removed.
154
155 type:
156 $ref: /schemas/types.yaml#/definitions/string
157 enum:
158 - active # enable active cooling e.g. fans
159 - passive # enable passive cooling e.g. throttling cpu
160 - hot # send notification to driver
161 - critical # send notification to driver, trigger shutdown
162 description: |
163 There are four valid trip types: active, passive, hot,
164 critical.
165
166 The critical trip type is used to set the maximum
167 temperature threshold above which the HW becomes
168 unstable and underlying firmware might even trigger a
169 reboot. Hitting the critical threshold triggers a system
170 shutdown.
171
172 The hot trip type can be used to send a notification to
173 the thermal driver (if a .notify callback is registered).
174 The action to be taken is left to the driver.
175
176 The passive trip type can be used to slow down HW e.g. run
177 the CPU, GPU, bus at a lower frequency.
178
179 The active trip type can be used to control other HW to
180 help in cooling e.g. fans can be sped up or slowed down
181
182 required:
183 - temperature
184 - hysteresis
185 - type
186 additionalProperties: false
187
188 additionalProperties: false
189
190 cooling-maps:
191 type: object
192 additionalProperties: false
193 description:
194 This node describes the action to be taken when a thermal zone
195 crosses one of the temperature thresholds described in the trips
196 node. The action takes the form of a mapping relation between a
197 trip and the target cooling device state.
198
199 patternProperties:
200 "^map[-a-zA-Z0-9]*$":
201 type: object
202
203 properties:
204 trip:
205 $ref: /schemas/types.yaml#/definitions/phandle
206 description:
207 A phandle of a trip point node within this thermal zone.
208
209 cooling-device:
210 $ref: /schemas/types.yaml#/definitions/phandle-array
211 description:
212 A list of cooling device phandles along with the minimum
213 and maximum cooling state specifiers for each cooling
214 device. Using the THERMAL_NO_LIMIT (-1UL) constant in the
215 cooling-device phandle limit specifier lets the framework
216 use the minimum and maximum cooling state for that cooling
217 device automatically.
218
219 contribution:
220 $ref: /schemas/types.yaml#/definitions/uint32
221 description:
222 The cooling contribution to the thermal zone of the referred
223 cooling device at the referred trip point. The contribution is
224 a ratio of the sum of all cooling contributions within a
225 thermal zone.
226
227 required:
228 - trip
229 - cooling-device
230 additionalProperties: false
231
232 required:
233 - thermal-sensors
234
235 additionalProperties: false
236
237 additionalProperties: false
238
239 examples:
240 - |
241 #include <dt-bindings/interrupt-controller/arm-gic.h>
242 #include <dt-bindings/thermal/thermal.h>
243
244 // Example 1: SDM845 TSENS
245 soc {
246 #address-cells = <2>;
247 #size-cells = <2>;
248
249 /* ... */
250
251 tsens0: thermal-sensor@c263000 {
252 compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
253 reg = <0 0x0c263000 0 0x1ff>, /* TM */
254 <0 0x0c222000 0 0x1ff>; /* SROT */
255 #qcom,sensors = <13>;
256 interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
257 <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>;
258 interrupt-names = "uplow", "critical";
259 #thermal-sensor-cells = <1>;
260 };
261
262 tsens1: thermal-sensor@c265000 {
263 compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
264 reg = <0 0x0c265000 0 0x1ff>, /* TM */
265 <0 0x0c223000 0 0x1ff>; /* SROT */
266 #qcom,sensors = <8>;
267 interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH>,
268 <GIC_SPI 509 IRQ_TYPE_LEVEL_HIGH>;
269 interrupt-names = "uplow", "critical";
270 #thermal-sensor-cells = <1>;
271 };
272 };
273
274 /* ... */
275
276 thermal-zones {
277 cpu0-thermal {
278 polling-delay-passive = <250>;
279 polling-delay = <1000>;
280
281 thermal-sensors = <&tsens0 1>;
282
283 trips {
284 cpu0_alert0: trip-point0 {
285 temperature = <90000>;
286 hysteresis = <2000>;
287 type = "passive";
288 };
289
290 cpu0_alert1: trip-point1 {
291 temperature = <95000>;
292 hysteresis = <2000>;
293 type = "passive";
294 };
295
296 cpu0_crit: cpu_crit {
297 temperature = <110000>;
298 hysteresis = <1000>;
299 type = "critical";
300 };
301 };
302
303 cooling-maps {
304 map0 {
305 trip = <&cpu0_alert0>;
306 /* Corresponds to 1400MHz in OPP table */
307 cooling-device = <&CPU0 3 3>, <&CPU1 3 3>,
308 <&CPU2 3 3>, <&CPU3 3 3>;
309 };
310
311 map1 {
312 trip = <&cpu0_alert1>;
313 /* Corresponds to 1000MHz in OPP table */
314 cooling-device = <&CPU0 5 5>, <&CPU1 5 5>,
315 <&CPU2 5 5>, <&CPU3 5 5>;
316 };
317 };
318 };
319
320 /* ... */
321
322 cluster0-thermal {
323 polling-delay-passive = <250>;
324 polling-delay = <1000>;
325
326 thermal-sensors = <&tsens0 5>;
327
328 trips {
329 cluster0_alert0: trip-point0 {
330 temperature = <90000>;
331 hysteresis = <2000>;
332 type = "hot";
333 };
334 cluster0_crit: cluster0_crit {
335 temperature = <110000>;
336 hysteresis = <2000>;
337 type = "critical";
338 };
339 };
340 };
341
342 /* ... */
343
344 gpu-top-thermal {
345 polling-delay-passive = <250>;
346 polling-delay = <1000>;
347
348 thermal-sensors = <&tsens0 11>;
349
350 trips {
351 gpu1_alert0: trip-point0 {
352 temperature = <90000>;
353 hysteresis = <2000>;
354 type = "hot";
355 };
356 };
357 };
358 };
359 ...
360

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Thermal zone 공통 스키마

1-12

GPL-2.0 라이선스의 이 YAML 스키마는 devicetree의 thermal zone을 정의합니다. 저작권자는 Linaro Ltd.이고 maintainer는 Daniel Lezcano입니다.

Thermal 관리 시스템의 세 구성 요소

13-25

Devicetree의 thermal 관리는 sensor hardware와 cooling device 및 thermal zone의 software abstraction을 기술하여 thermal overload를 완화하는 적절한 동작을 수행합니다. 전체 시스템은 온도를 측정하고 SoC별 binding을 갖는 `thermal-sensor`, 수동 또는 능동 방식으로 열을 방출하는 `cooling-device`, 플랫폼의 모든 thermal data를 담는 `thermal-zones` 컨테이너로 구성됩니다. 이 binding은 그중 `thermal-zones`를 설명합니다.

최대 dT/dt에 따른 polling 간격

26-39

Thermal zone의 polling-delay 속성은 두 상황의 최대 dT/dt, 즉 시간에 따른 온도 변화율에 맞춰야 합니다. Passive cooling이 활성화된 동안에는 `polling-delay-passive`, 단순 감시 중이거나 active cooling이 활성화된 동안에는 `polling-delay`를 사용합니다. 최대 dT/dt는 hardware power consumption과 heat dissipation capability에 크게 좌우됩니다. Poll 사이에 여러 trip boundary를 예상치 못하게 넘어가지 않도록 지연을 정해야 하며, 올바른 간격은 silicon structure를 손상하거나 silicon lifetime을 줄일 수 있는 온도 범위에 장치가 머무는 일을 방지합니다.

컨테이너와 zone 이름 제약

40-62

Thermal framework가 여러 zone의 입력을 관리하고 과열을 완화하려면 `/thermal-zones` node가 필요하며 `$nodename`은 정확히 `thermal-zones`입니다. 이 node는 실제 장치를 나타내지 않고 thermal sensor, temperature threshold에 관한 platform data, threshold를 넘을 때의 mitigation action을 연결하는 컨테이너입니다. 각 zone 이름은 정규식 `^[a-zA-Z][a-zA-Z0-9\-]{1,10}-thermal$`을 따릅니다. Linux kernel의 `THERMAL_NAME_LENGTH` 제한 때문에 terminating NUL byte를 포함한 전체 길이는 19 characters입니다.

properties:
  $nodename:
    const: thermal-zones
    description:
      A /thermal-zones node is required in order to use the thermal framework to
      manage input from the various thermal zones in the system in order to
      mitigate thermal overload conditions. It does not represent a real device
      in the system, but acts as a container to link a thermal sensor device,
      platform-data regarding temperature thresholds and the mitigation actions
      to take when the temperature crosses those thresholds.

patternProperties:
  # Node name is limited in size due to Linux kernel requirements - 19
  # characters in total (see THERMAL_NAME_LENGTH, including terminating NUL
  # byte):
  "^[a-zA-Z][a-zA-Z0-9\\-]{1,10}-thermal$":
    type: object
    description:
      Each thermal zone node contains information about how frequently it
      must be checked, the sensor responsible for reporting temperature for
      this zone, one sub-node containing the various trip points for this
      zone and one sub-node containing all the zone cooling-maps.

Polling timer와 critical-action

63-95

각 zone은 검사 주기, 온도를 보고하는 sensor, trip point 하위 node, cooling-map 하위 node를 담습니다. `polling-delay`는 일반 감시 중 poll 사이의 최대 millisecond이고 `polling-delay-passive`는 passive cooling 중의 최대 millisecond입니다. 어느 값을 0으로 설정하면 thermal framework가 만드는 polling timer가 비활성화되므로 해당 zone sensor가 interrupt를 지원한다고 가정합니다.

`critical-action`은 critical temperature 도달 후 OS가 수행할 동작입니다. 속성이 없으면 system이 동작을 선택하며 권장 기본값은 `shutdown`입니다. `reboot`는 hardware가 thermal stress 상태일 때 infinite reboot와 추가 손상을 일으킬 수 있으므로 주의해서 선택해야 합니다. Firmware/bootloader는 최후 수단으로 thermal control을 인계할 수 있어야 합니다. 허용 값은 `shutdown`과 `reboot`입니다.

properties:
  polling-delay:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      The maximum number of milliseconds to wait between polls when
      checking this thermal zone. Setting this to 0 disables the polling
      timers setup by the thermal framework and assumes that the thermal
      sensors in this zone support interrupts.

  polling-delay-passive:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      The maximum number of milliseconds to wait between polls when
      checking this thermal zone while doing passive cooling. Setting
      this to 0 disables the polling timers setup by the thermal
      framework and assumes that the thermal sensors in this zone
      support interrupts.

  critical-action:
    $ref: /schemas/types.yaml#/definitions/string
    description: |
      The action the OS should perform after the critical temperature is reached.
      If the property is not set, it is up to the system to select the correct
      action. The recommended and preferred default is shutdown.
      Choose 'reboot' with care, as the hardware may be in thermal stress,
      thus leading to infinite reboots that may cause damage to the hardware.
      Make sure the firmware/bootloader will act as the last resort and take
      over the thermal control.

    enum:
      - shutdown
      - reboot

Sensor, 선형 계수와 지속 가능 전력

96-124

`thermal-sensors`는 이 zone을 감시하는 thermal sensor phandle과 sensor specifier를 담으며 항목은 하나로 제한됩니다. `coefficients`는 zone에 나열된 sensor들을 결합하는 선형식의 정수 계수 배열입니다. 식은 `z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn`이고 c0부터 cn까지가 coefficients입니다. 속성이 없으면 계수의 default는 1입니다. 계수는 순서대로 배치되고 sensor ID로 sensor와 대응하며, sensor 수보다 더 있는 계수는 constant offset으로 해석됩니다.

`sustainable-power`는 원하는 control temperature에서 이 thermal zone이 지속적으로 방출할 수 있다고 추정한 전력을 mW 단위로 나타냅니다. 참고로 4-inch phone은 보통 2000mW, 10-inch tablet은 약 4500mW입니다.

thermal-sensors:
  $ref: /schemas/types.yaml#/definitions/phandle-array
  maxItems: 1
  description:
    The thermal sensor phandle and sensor specifier used to monitor this
    thermal zone.

coefficients:
  $ref: /schemas/types.yaml#/definitions/uint32-array
  description:
    An array of integers containing the coefficients of a linear equation
    that binds all the sensors listed in this thermal zone.

    The linear equation used is as follows,
      z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn
    where c0, c1, .., cn are the coefficients.

    Coefficients default to 1 in case this property is not specified. The
    coefficients are ordered and are matched with sensors by means of the
    sensor ID. Additional coefficients are interpreted as constant offset.

sustainable-power:
  $ref: /schemas/types.yaml#/definitions/uint32
  description:
    An estimate of the sustainable power (in mW) that this thermal zone
    can dissipate at the desired control temperature. For reference, the
    sustainable power of a 4-inch phone is typically 2000mW, while on a
    10-inch tablet is around 4500mW.

Trip point와 네 가지 동작 유형

125-188

`trips` node는 thermal framework가 동작해야 하는 temperature domain의 지점들을 정의하며 실제 동작은 `cooling-maps`에서 연결합니다. 각 trip 이름은 `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`을 따릅니다. `temperature`는 millicelsius 단위 int32로 minimum -273000, maximum 200000입니다. `hysteresis`도 millicelsius 단위의 unsigned delta이며, 시작된 cooling action은 온도가 `(trip temperature - hysteresis)` 아래로 내려갈 때까지 유지됩니다. 이는 cooling action 제거 직후 trip이 계속 다시 발생하는 상황을 줄입니다.

유효한 trip type은 `active`, `passive`, `hot`, `critical` 네 가지입니다. `critical`은 HW가 불안정해지고 firmware가 reboot를 일으킬 수도 있는 최대 threshold이며 도달하면 system shutdown을 유발합니다. `hot`은 `.notify` callback이 등록된 thermal driver에 notification을 보내고 후속 동작은 driver에 맡깁니다. `passive`는 CPU, GPU, bus 등을 더 낮은 frequency로 실행해 HW를 늦춥니다. `active`는 fan 속도처럼 냉각을 돕는 다른 HW를 제어합니다. 모든 trip에는 `temperature`, `hysteresis`, `type`이 필요합니다.

trips:
  type: object
  description:
    This node describes a set of points in the temperature domain at
    which the thermal framework needs to take action. The actions to
    be taken are defined in another node called cooling-maps.

  patternProperties:
    "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$":
      type: object

      properties:
        temperature:
          $ref: /schemas/types.yaml#/definitions/int32
          minimum: -273000
          maximum: 200000
          description:
            An integer expressing the trip temperature in millicelsius.

        hysteresis:
          $ref: /schemas/types.yaml#/definitions/uint32
          description:
            An unsigned integer expressing the hysteresis delta with
            respect to the trip temperature property above, also in
            millicelsius. Any cooling action initiated by the framework is
            maintained until the temperature falls below
            (trip temperature - hysteresis). This potentially prevents a
            situation where the trip gets constantly triggered soon after
            cooling action is removed.

        type:
          $ref: /schemas/types.yaml#/definitions/string
          enum:
            - active   # enable active cooling e.g. fans
            - passive  # enable passive cooling e.g. throttling cpu
            - hot      # send notification to driver
            - critical # send notification to driver, trigger shutdown
          description: |
            There are four valid trip types: active, passive, hot,
            critical.

            The critical trip type is used to set the maximum
            temperature threshold above which the HW becomes
            unstable and underlying firmware might even trigger a
            reboot. Hitting the critical threshold triggers a system
            shutdown.

            The hot trip type can be used to send a notification to
            the thermal driver (if a .notify callback is registered).
            The action to be taken is left to the driver.

            The passive trip type can be used to slow down HW e.g. run
            the CPU, GPU, bus at a lower frequency.

            The active trip type can be used to control other HW to
            help in cooling e.g. fans can be sped up or slowed down

      required:
        - temperature
        - hysteresis
        - type
      additionalProperties: false

  additionalProperties: false

Trip과 cooling device state의 연결

189-238

`cooling-maps`는 zone이 `trips`의 temperature threshold를 넘을 때 취할 동작을 정의하고, trip과 target cooling device state 사이의 mapping relation으로 표현합니다. Map 이름은 `^map[-a-zA-Z0-9]*$`을 따릅니다. `trip`은 같은 thermal zone 안의 trip point node phandle입니다. `cooling-device`는 각 cooling device phandle과 minimum 및 maximum cooling state specifier의 목록입니다. Limit specifier에 `THERMAL_NO_LIMIT (-1UL)`을 쓰면 framework가 해당 장치의 최소·최대 cooling state를 자동 사용합니다.

선택적인 `contribution`은 해당 trip에서 참조한 cooling device가 zone 냉각에 기여하는 비율이며, 한 thermal zone 안의 모든 cooling contribution 합에 대한 ratio입니다. 각 map에는 `trip`과 `cooling-device`가 반드시 있어야 하고, 각 zone에는 `thermal-sensors`가 필수입니다. 정의되지 않은 추가 속성은 허용되지 않습니다.

      cooling-maps:
        type: object
        additionalProperties: false
        description:
          This node describes the action to be taken when a thermal zone
          crosses one of the temperature thresholds described in the trips
          node. The action takes the form of a mapping relation between a
          trip and the target cooling device state.

        patternProperties:
          "^map[-a-zA-Z0-9]*$":
            type: object

            properties:
              trip:
                $ref: /schemas/types.yaml#/definitions/phandle
                description:
                  A phandle of a trip point node within this thermal zone.

              cooling-device:
                $ref: /schemas/types.yaml#/definitions/phandle-array
                description:
                  A list of cooling device phandles along with the minimum
                  and maximum cooling state specifiers for each cooling
                  device. Using the THERMAL_NO_LIMIT (-1UL) constant in the
                  cooling-device phandle limit specifier lets the framework
                  use the minimum and maximum cooling state for that cooling
                  device automatically.

              contribution:
                $ref: /schemas/types.yaml#/definitions/uint32
                description:
                  The cooling contribution to the thermal zone of the referred
                  cooling device at the referred trip point. The contribution is
                  a ratio of the sum of all cooling contributions within a
                  thermal zone.

            required:
              - trip
              - cooling-device
            additionalProperties: false

    required:
      - thermal-sensors

    additionalProperties: false

additionalProperties: false

SDM845 TSENS provider 예제

239-275

예제는 SDM845의 TSENS provider 두 개를 구성합니다. `tsens0`은 TM과 SROT register 영역, sensors 13개, `uplow` 및 `critical` interrupt를 갖고, `tsens1`은 별도 register 영역, sensors 8개와 같은 두 interrupt 종류를 갖습니다. 둘 다 `#thermal-sensor-cells = <1>`로 sensor index를 받습니다.

- |
  #include <dt-bindings/interrupt-controller/arm-gic.h>
  #include <dt-bindings/thermal/thermal.h>

  // Example 1: SDM845 TSENS
  soc {
          #address-cells = <2>;
          #size-cells = <2>;

          /* ... */

          tsens0: thermal-sensor@c263000 {
                  compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
                  reg = <0 0x0c263000 0 0x1ff>, /* TM */
                        <0 0x0c222000 0 0x1ff>; /* SROT */
                  #qcom,sensors = <13>;
                  interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>,
                               <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>;
                  interrupt-names = "uplow", "critical";
                  #thermal-sensor-cells = <1>;
          };

          tsens1: thermal-sensor@c265000 {
                  compatible = "qcom,sdm845-tsens", "qcom,tsens-v2";
                  reg = <0 0x0c265000 0 0x1ff>, /* TM */
                        <0 0x0c223000 0 0x1ff>; /* SROT */
                  #qcom,sensors = <8>;
                  interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH>,
                               <GIC_SPI 509 IRQ_TYPE_LEVEL_HIGH>;
                  interrupt-names = "uplow", "critical";
                  #thermal-sensor-cells = <1>;
          };
  };

  /* ... */

CPU0 trip과 주파수 cooling map

276-321

`cpu0-thermal` zone은 passive polling 250ms, 일반 polling 1000ms로 `tsens0`의 sensor index 1을 감시합니다. Passive trip은 90000 및 95000 millicelsius이고 각 hysteresis는 2000입니다. Critical trip은 110000, hysteresis 1000입니다. 첫 map은 90000 trip에서 CPU0부터 CPU3까지 `<3 3>` state를 선택하며 OPP table의 1400MHz에 해당합니다. 둘째 map은 95000 trip에서 네 CPU 모두 `<5 5>` state를 선택하며 1000MHz에 해당합니다.

thermal-zones {
        cpu0-thermal {
                polling-delay-passive = <250>;
                polling-delay = <1000>;

                thermal-sensors = <&tsens0 1>;

                trips {
                        cpu0_alert0: trip-point0 {
                                temperature = <90000>;
                                hysteresis = <2000>;
                                type = "passive";
                        };

                        cpu0_alert1: trip-point1 {
                                temperature = <95000>;
                                hysteresis = <2000>;
                                type = "passive";
                        };

                        cpu0_crit: cpu_crit {
                                temperature = <110000>;
                                hysteresis = <1000>;
                                type = "critical";
                        };
                };

                cooling-maps {
                        map0 {
                                trip = <&cpu0_alert0>;
                                /* Corresponds to 1400MHz in OPP table */
                                cooling-device = <&CPU0 3 3>, <&CPU1 3 3>,
                                                 <&CPU2 3 3>, <&CPU3 3 3>;
                        };

                        map1 {
                                trip = <&cpu0_alert1>;
                                /* Corresponds to 1000MHz in OPP table */
                                cooling-device = <&CPU0 5 5>, <&CPU1 5 5>,
                                                 <&CPU2 5 5>, <&CPU3 5 5>;
                        };
                };
        };

        /* ... */

Cluster0 hot·critical trip

322-343

`cluster0-thermal` zone은 passive polling 250ms, 일반 polling 1000ms로 `tsens0` sensor index 5를 사용합니다. 90000 millicelsius의 `hot` trip과 110000 millicelsius의 `critical` trip을 두며 둘의 hysteresis는 2000입니다.

cluster0-thermal {
        polling-delay-passive = <250>;
        polling-delay = <1000>;

        thermal-sensors = <&tsens0 5>;

        trips {
                cluster0_alert0: trip-point0 {
                        temperature = <90000>;
                        hysteresis = <2000>;
                        type = "hot";
                };
                cluster0_crit: cluster0_crit {
                        temperature = <110000>;
                        hysteresis = <2000>;
                        type = "critical";
                };
        };
};

/* ... */

GPU top hot trip

344-359

`gpu-top-thermal` zone은 passive polling 250ms, 일반 polling 1000ms로 `tsens0` sensor index 11을 감시합니다. 90000 millicelsius, hysteresis 2000의 `hot` trip 하나를 정의합니다.

            gpu-top-thermal {
                    polling-delay-passive = <250>;
                    polling-delay = <1000>;

                    thermal-sensors = <&tsens0 11>;

                    trips {
                            gpu1_alert0: trip-point0 {
                                    temperature = <90000>;
                                    hysteresis = <2000>;
                                    type = "hot";
                            };
                    };
            };
    };
...