162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0) 262306a36Sopenharmony_ci# Copyright 2020 Linaro Ltd. 362306a36Sopenharmony_ci%YAML 1.2 462306a36Sopenharmony_ci--- 562306a36Sopenharmony_ci$id: http://devicetree.org/schemas/thermal/thermal-zones.yaml# 662306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/base.yaml# 762306a36Sopenharmony_ci 862306a36Sopenharmony_cititle: Thermal zone 962306a36Sopenharmony_ci 1062306a36Sopenharmony_cimaintainers: 1162306a36Sopenharmony_ci - Amit Kucheria <amitk@kernel.org> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cidescription: | 1462306a36Sopenharmony_ci Thermal management is achieved in devicetree by describing the sensor hardware 1562306a36Sopenharmony_ci and the software abstraction of cooling devices and thermal zones required to 1662306a36Sopenharmony_ci take appropriate action to mitigate thermal overloads. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci The following node types are used to completely describe a thermal management 1962306a36Sopenharmony_ci system in devicetree: 2062306a36Sopenharmony_ci - thermal-sensor: device that measures temperature, has SoC-specific bindings 2162306a36Sopenharmony_ci - cooling-device: device used to dissipate heat either passively or actively 2262306a36Sopenharmony_ci - thermal-zones: a container of the following node types used to describe all 2362306a36Sopenharmony_ci thermal data for the platform 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci This binding describes the thermal-zones. 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci The polling-delay properties of a thermal-zone are bound to the maximum dT/dt 2862306a36Sopenharmony_ci (temperature derivative over time) in two situations for a thermal zone: 2962306a36Sopenharmony_ci 1. when passive cooling is activated (polling-delay-passive) 3062306a36Sopenharmony_ci 2. when the zone just needs to be monitored (polling-delay) or when 3162306a36Sopenharmony_ci active cooling is activated. 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci The maximum dT/dt is highly bound to hardware power consumption and 3462306a36Sopenharmony_ci dissipation capability. The delays should be chosen to account for said 3562306a36Sopenharmony_ci max dT/dt, such that a device does not cross several trip boundaries 3662306a36Sopenharmony_ci unexpectedly between polls. Choosing the right polling delays shall avoid 3762306a36Sopenharmony_ci having the device in temperature ranges that may damage the silicon structures 3862306a36Sopenharmony_ci and reduce silicon lifetime. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciproperties: 4162306a36Sopenharmony_ci $nodename: 4262306a36Sopenharmony_ci const: thermal-zones 4362306a36Sopenharmony_ci description: 4462306a36Sopenharmony_ci A /thermal-zones node is required in order to use the thermal framework to 4562306a36Sopenharmony_ci manage input from the various thermal zones in the system in order to 4662306a36Sopenharmony_ci mitigate thermal overload conditions. It does not represent a real device 4762306a36Sopenharmony_ci in the system, but acts as a container to link a thermal sensor device, 4862306a36Sopenharmony_ci platform-data regarding temperature thresholds and the mitigation actions 4962306a36Sopenharmony_ci to take when the temperature crosses those thresholds. 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_cipatternProperties: 5262306a36Sopenharmony_ci "^[a-zA-Z][a-zA-Z0-9\\-]{1,12}-thermal$": 5362306a36Sopenharmony_ci type: object 5462306a36Sopenharmony_ci description: 5562306a36Sopenharmony_ci Each thermal zone node contains information about how frequently it 5662306a36Sopenharmony_ci must be checked, the sensor responsible for reporting temperature for 5762306a36Sopenharmony_ci this zone, one sub-node containing the various trip points for this 5862306a36Sopenharmony_ci zone and one sub-node containing all the zone cooling-maps. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci properties: 6162306a36Sopenharmony_ci polling-delay: 6262306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 6362306a36Sopenharmony_ci description: 6462306a36Sopenharmony_ci The maximum number of milliseconds to wait between polls when 6562306a36Sopenharmony_ci checking this thermal zone. Setting this to 0 disables the polling 6662306a36Sopenharmony_ci timers setup by the thermal framework and assumes that the thermal 6762306a36Sopenharmony_ci sensors in this zone support interrupts. 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci polling-delay-passive: 7062306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 7162306a36Sopenharmony_ci description: 7262306a36Sopenharmony_ci The maximum number of milliseconds to wait between polls when 7362306a36Sopenharmony_ci checking this thermal zone while doing passive cooling. Setting 7462306a36Sopenharmony_ci this to 0 disables the polling timers setup by the thermal 7562306a36Sopenharmony_ci framework and assumes that the thermal sensors in this zone 7662306a36Sopenharmony_ci support interrupts. 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci thermal-sensors: 7962306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/phandle-array 8062306a36Sopenharmony_ci maxItems: 1 8162306a36Sopenharmony_ci description: 8262306a36Sopenharmony_ci The thermal sensor phandle and sensor specifier used to monitor this 8362306a36Sopenharmony_ci thermal zone. 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci coefficients: 8662306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32-array 8762306a36Sopenharmony_ci description: 8862306a36Sopenharmony_ci An array of integers containing the coefficients of a linear equation 8962306a36Sopenharmony_ci that binds all the sensors listed in this thermal zone. 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci The linear equation used is as follows, 9262306a36Sopenharmony_ci z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn 9362306a36Sopenharmony_ci where c0, c1, .., cn are the coefficients. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci Coefficients default to 1 in case this property is not specified. The 9662306a36Sopenharmony_ci coefficients are ordered and are matched with sensors by means of the 9762306a36Sopenharmony_ci sensor ID. Additional coefficients are interpreted as constant offset. 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci sustainable-power: 10062306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 10162306a36Sopenharmony_ci description: 10262306a36Sopenharmony_ci An estimate of the sustainable power (in mW) that this thermal zone 10362306a36Sopenharmony_ci can dissipate at the desired control temperature. For reference, the 10462306a36Sopenharmony_ci sustainable power of a 4-inch phone is typically 2000mW, while on a 10562306a36Sopenharmony_ci 10-inch tablet is around 4500mW. 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci trips: 10862306a36Sopenharmony_ci type: object 10962306a36Sopenharmony_ci description: 11062306a36Sopenharmony_ci This node describes a set of points in the temperature domain at 11162306a36Sopenharmony_ci which the thermal framework needs to take action. The actions to 11262306a36Sopenharmony_ci be taken are defined in another node called cooling-maps. 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci patternProperties: 11562306a36Sopenharmony_ci "^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$": 11662306a36Sopenharmony_ci type: object 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci properties: 11962306a36Sopenharmony_ci temperature: 12062306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/int32 12162306a36Sopenharmony_ci minimum: -273000 12262306a36Sopenharmony_ci maximum: 200000 12362306a36Sopenharmony_ci description: 12462306a36Sopenharmony_ci An integer expressing the trip temperature in millicelsius. 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci hysteresis: 12762306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 12862306a36Sopenharmony_ci description: 12962306a36Sopenharmony_ci An unsigned integer expressing the hysteresis delta with 13062306a36Sopenharmony_ci respect to the trip temperature property above, also in 13162306a36Sopenharmony_ci millicelsius. Any cooling action initiated by the framework is 13262306a36Sopenharmony_ci maintained until the temperature falls below 13362306a36Sopenharmony_ci (trip temperature - hysteresis). This potentially prevents a 13462306a36Sopenharmony_ci situation where the trip gets constantly triggered soon after 13562306a36Sopenharmony_ci cooling action is removed. 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci type: 13862306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/string 13962306a36Sopenharmony_ci enum: 14062306a36Sopenharmony_ci - active # enable active cooling e.g. fans 14162306a36Sopenharmony_ci - passive # enable passive cooling e.g. throttling cpu 14262306a36Sopenharmony_ci - hot # send notification to driver 14362306a36Sopenharmony_ci - critical # send notification to driver, trigger shutdown 14462306a36Sopenharmony_ci description: | 14562306a36Sopenharmony_ci There are four valid trip types: active, passive, hot, 14662306a36Sopenharmony_ci critical. 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci The critical trip type is used to set the maximum 14962306a36Sopenharmony_ci temperature threshold above which the HW becomes 15062306a36Sopenharmony_ci unstable and underlying firmware might even trigger a 15162306a36Sopenharmony_ci reboot. Hitting the critical threshold triggers a system 15262306a36Sopenharmony_ci shutdown. 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci The hot trip type can be used to send a notification to 15562306a36Sopenharmony_ci the thermal driver (if a .notify callback is registered). 15662306a36Sopenharmony_ci The action to be taken is left to the driver. 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci The passive trip type can be used to slow down HW e.g. run 15962306a36Sopenharmony_ci the CPU, GPU, bus at a lower frequency. 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci The active trip type can be used to control other HW to 16262306a36Sopenharmony_ci help in cooling e.g. fans can be sped up or slowed down 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci required: 16562306a36Sopenharmony_ci - temperature 16662306a36Sopenharmony_ci - hysteresis 16762306a36Sopenharmony_ci - type 16862306a36Sopenharmony_ci additionalProperties: false 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci additionalProperties: false 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci cooling-maps: 17362306a36Sopenharmony_ci type: object 17462306a36Sopenharmony_ci additionalProperties: false 17562306a36Sopenharmony_ci description: 17662306a36Sopenharmony_ci This node describes the action to be taken when a thermal zone 17762306a36Sopenharmony_ci crosses one of the temperature thresholds described in the trips 17862306a36Sopenharmony_ci node. The action takes the form of a mapping relation between a 17962306a36Sopenharmony_ci trip and the target cooling device state. 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ci patternProperties: 18262306a36Sopenharmony_ci "^map[-a-zA-Z0-9]*$": 18362306a36Sopenharmony_ci type: object 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ci properties: 18662306a36Sopenharmony_ci trip: 18762306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/phandle 18862306a36Sopenharmony_ci description: 18962306a36Sopenharmony_ci A phandle of a trip point node within this thermal zone. 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci cooling-device: 19262306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/phandle-array 19362306a36Sopenharmony_ci description: 19462306a36Sopenharmony_ci A list of cooling device phandles along with the minimum 19562306a36Sopenharmony_ci and maximum cooling state specifiers for each cooling 19662306a36Sopenharmony_ci device. Using the THERMAL_NO_LIMIT (-1UL) constant in the 19762306a36Sopenharmony_ci cooling-device phandle limit specifier lets the framework 19862306a36Sopenharmony_ci use the minimum and maximum cooling state for that cooling 19962306a36Sopenharmony_ci device automatically. 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci contribution: 20262306a36Sopenharmony_ci $ref: /schemas/types.yaml#/definitions/uint32 20362306a36Sopenharmony_ci description: 20462306a36Sopenharmony_ci The cooling contribution to the thermal zone of the referred 20562306a36Sopenharmony_ci cooling device at the referred trip point. The contribution is 20662306a36Sopenharmony_ci a ratio of the sum of all cooling contributions within a 20762306a36Sopenharmony_ci thermal zone. 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci required: 21062306a36Sopenharmony_ci - trip 21162306a36Sopenharmony_ci - cooling-device 21262306a36Sopenharmony_ci additionalProperties: false 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci required: 21562306a36Sopenharmony_ci - polling-delay 21662306a36Sopenharmony_ci - polling-delay-passive 21762306a36Sopenharmony_ci - thermal-sensors 21862306a36Sopenharmony_ci - trips 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci additionalProperties: false 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ciadditionalProperties: false 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ciexamples: 22562306a36Sopenharmony_ci - | 22662306a36Sopenharmony_ci #include <dt-bindings/interrupt-controller/arm-gic.h> 22762306a36Sopenharmony_ci #include <dt-bindings/thermal/thermal.h> 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci // Example 1: SDM845 TSENS 23062306a36Sopenharmony_ci soc { 23162306a36Sopenharmony_ci #address-cells = <2>; 23262306a36Sopenharmony_ci #size-cells = <2>; 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci /* ... */ 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci tsens0: thermal-sensor@c263000 { 23762306a36Sopenharmony_ci compatible = "qcom,sdm845-tsens", "qcom,tsens-v2"; 23862306a36Sopenharmony_ci reg = <0 0x0c263000 0 0x1ff>, /* TM */ 23962306a36Sopenharmony_ci <0 0x0c222000 0 0x1ff>; /* SROT */ 24062306a36Sopenharmony_ci #qcom,sensors = <13>; 24162306a36Sopenharmony_ci interrupts = <GIC_SPI 506 IRQ_TYPE_LEVEL_HIGH>, 24262306a36Sopenharmony_ci <GIC_SPI 508 IRQ_TYPE_LEVEL_HIGH>; 24362306a36Sopenharmony_ci interrupt-names = "uplow", "critical"; 24462306a36Sopenharmony_ci #thermal-sensor-cells = <1>; 24562306a36Sopenharmony_ci }; 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci tsens1: thermal-sensor@c265000 { 24862306a36Sopenharmony_ci compatible = "qcom,sdm845-tsens", "qcom,tsens-v2"; 24962306a36Sopenharmony_ci reg = <0 0x0c265000 0 0x1ff>, /* TM */ 25062306a36Sopenharmony_ci <0 0x0c223000 0 0x1ff>; /* SROT */ 25162306a36Sopenharmony_ci #qcom,sensors = <8>; 25262306a36Sopenharmony_ci interrupts = <GIC_SPI 507 IRQ_TYPE_LEVEL_HIGH>, 25362306a36Sopenharmony_ci <GIC_SPI 509 IRQ_TYPE_LEVEL_HIGH>; 25462306a36Sopenharmony_ci interrupt-names = "uplow", "critical"; 25562306a36Sopenharmony_ci #thermal-sensor-cells = <1>; 25662306a36Sopenharmony_ci }; 25762306a36Sopenharmony_ci }; 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci /* ... */ 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci thermal-zones { 26262306a36Sopenharmony_ci cpu0-thermal { 26362306a36Sopenharmony_ci polling-delay-passive = <250>; 26462306a36Sopenharmony_ci polling-delay = <1000>; 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci thermal-sensors = <&tsens0 1>; 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci trips { 26962306a36Sopenharmony_ci cpu0_alert0: trip-point0 { 27062306a36Sopenharmony_ci temperature = <90000>; 27162306a36Sopenharmony_ci hysteresis = <2000>; 27262306a36Sopenharmony_ci type = "passive"; 27362306a36Sopenharmony_ci }; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ci cpu0_alert1: trip-point1 { 27662306a36Sopenharmony_ci temperature = <95000>; 27762306a36Sopenharmony_ci hysteresis = <2000>; 27862306a36Sopenharmony_ci type = "passive"; 27962306a36Sopenharmony_ci }; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci cpu0_crit: cpu_crit { 28262306a36Sopenharmony_ci temperature = <110000>; 28362306a36Sopenharmony_ci hysteresis = <1000>; 28462306a36Sopenharmony_ci type = "critical"; 28562306a36Sopenharmony_ci }; 28662306a36Sopenharmony_ci }; 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci cooling-maps { 28962306a36Sopenharmony_ci map0 { 29062306a36Sopenharmony_ci trip = <&cpu0_alert0>; 29162306a36Sopenharmony_ci /* Corresponds to 1400MHz in OPP table */ 29262306a36Sopenharmony_ci cooling-device = <&CPU0 3 3>, <&CPU1 3 3>, 29362306a36Sopenharmony_ci <&CPU2 3 3>, <&CPU3 3 3>; 29462306a36Sopenharmony_ci }; 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci map1 { 29762306a36Sopenharmony_ci trip = <&cpu0_alert1>; 29862306a36Sopenharmony_ci /* Corresponds to 1000MHz in OPP table */ 29962306a36Sopenharmony_ci cooling-device = <&CPU0 5 5>, <&CPU1 5 5>, 30062306a36Sopenharmony_ci <&CPU2 5 5>, <&CPU3 5 5>; 30162306a36Sopenharmony_ci }; 30262306a36Sopenharmony_ci }; 30362306a36Sopenharmony_ci }; 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci /* ... */ 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci cluster0-thermal { 30862306a36Sopenharmony_ci polling-delay-passive = <250>; 30962306a36Sopenharmony_ci polling-delay = <1000>; 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci thermal-sensors = <&tsens0 5>; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_ci trips { 31462306a36Sopenharmony_ci cluster0_alert0: trip-point0 { 31562306a36Sopenharmony_ci temperature = <90000>; 31662306a36Sopenharmony_ci hysteresis = <2000>; 31762306a36Sopenharmony_ci type = "hot"; 31862306a36Sopenharmony_ci }; 31962306a36Sopenharmony_ci cluster0_crit: cluster0_crit { 32062306a36Sopenharmony_ci temperature = <110000>; 32162306a36Sopenharmony_ci hysteresis = <2000>; 32262306a36Sopenharmony_ci type = "critical"; 32362306a36Sopenharmony_ci }; 32462306a36Sopenharmony_ci }; 32562306a36Sopenharmony_ci }; 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci /* ... */ 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci gpu-top-thermal { 33062306a36Sopenharmony_ci polling-delay-passive = <250>; 33162306a36Sopenharmony_ci polling-delay = <1000>; 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci thermal-sensors = <&tsens0 11>; 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci trips { 33662306a36Sopenharmony_ci gpu1_alert0: trip-point0 { 33762306a36Sopenharmony_ci temperature = <90000>; 33862306a36Sopenharmony_ci hysteresis = <2000>; 33962306a36Sopenharmony_ci type = "hot"; 34062306a36Sopenharmony_ci }; 34162306a36Sopenharmony_ci }; 34262306a36Sopenharmony_ci }; 34362306a36Sopenharmony_ci }; 34462306a36Sopenharmony_ci... 345