18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0) 28c2ecf20Sopenharmony_ci# Copyright 2020 Linaro Ltd. 38c2ecf20Sopenharmony_ci%YAML 1.2 48c2ecf20Sopenharmony_ci--- 58c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/thermal/thermal-cooling-devices.yaml# 68c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cititle: Thermal cooling device binding 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cimaintainers: 118c2ecf20Sopenharmony_ci - Amit Kucheria <amitk@kernel.org> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cidescription: | 148c2ecf20Sopenharmony_ci Thermal management is achieved in devicetree by describing the sensor hardware 158c2ecf20Sopenharmony_ci and the software abstraction of cooling devices and thermal zones required to 168c2ecf20Sopenharmony_ci take appropriate action to mitigate thermal overload. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci The following node types are used to completely describe a thermal management 198c2ecf20Sopenharmony_ci system in devicetree: 208c2ecf20Sopenharmony_ci - thermal-sensor: device that measures temperature, has SoC-specific bindings 218c2ecf20Sopenharmony_ci - cooling-device: device used to dissipate heat either passively or actively 228c2ecf20Sopenharmony_ci - thermal-zones: a container of the following node types used to describe all 238c2ecf20Sopenharmony_ci thermal data for the platform 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci This binding describes the cooling devices. 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci There are essentially two ways to provide control on power dissipation: 288c2ecf20Sopenharmony_ci - Passive cooling: by means of regulating device performance. A typical 298c2ecf20Sopenharmony_ci passive cooling mechanism is a CPU that has dynamic voltage and frequency 308c2ecf20Sopenharmony_ci scaling (DVFS), and uses lower frequencies as cooling states. 318c2ecf20Sopenharmony_ci - Active cooling: by means of activating devices in order to remove the 328c2ecf20Sopenharmony_ci dissipated heat, e.g. regulating fan speeds. 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci Any cooling device has a range of cooling states (i.e. different levels of 358c2ecf20Sopenharmony_ci heat dissipation). They also have a way to determine the state of cooling in 368c2ecf20Sopenharmony_ci which the device is. For example, a fan's cooling states correspond to the 378c2ecf20Sopenharmony_ci different fan speeds possible. Cooling states are referred to by single 388c2ecf20Sopenharmony_ci unsigned integers, where larger numbers mean greater heat dissipation. The 398c2ecf20Sopenharmony_ci precise set of cooling states associated with a device should be defined in 408c2ecf20Sopenharmony_ci a particular device's binding. 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciselect: true 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciproperties: 458c2ecf20Sopenharmony_ci "#cooling-cells": 468c2ecf20Sopenharmony_ci description: 478c2ecf20Sopenharmony_ci Must be 2, in order to specify minimum and maximum cooling state used in 488c2ecf20Sopenharmony_ci the cooling-maps reference. The first cell is the minimum cooling state 498c2ecf20Sopenharmony_ci and the second cell is the maximum cooling state requested. 508c2ecf20Sopenharmony_ci const: 2 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciadditionalProperties: true 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciexamples: 558c2ecf20Sopenharmony_ci - | 568c2ecf20Sopenharmony_ci #include <dt-bindings/interrupt-controller/arm-gic.h> 578c2ecf20Sopenharmony_ci #include <dt-bindings/thermal/thermal.h> 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci // Example 1: Cpufreq cooling device on CPU0 608c2ecf20Sopenharmony_ci cpus { 618c2ecf20Sopenharmony_ci #address-cells = <2>; 628c2ecf20Sopenharmony_ci #size-cells = <0>; 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci CPU0: cpu@0 { 658c2ecf20Sopenharmony_ci device_type = "cpu"; 668c2ecf20Sopenharmony_ci compatible = "qcom,kryo385"; 678c2ecf20Sopenharmony_ci reg = <0x0 0x0>; 688c2ecf20Sopenharmony_ci enable-method = "psci"; 698c2ecf20Sopenharmony_ci cpu-idle-states = <&LITTLE_CPU_SLEEP_0 708c2ecf20Sopenharmony_ci &LITTLE_CPU_SLEEP_1 718c2ecf20Sopenharmony_ci &CLUSTER_SLEEP_0>; 728c2ecf20Sopenharmony_ci capacity-dmips-mhz = <607>; 738c2ecf20Sopenharmony_ci dynamic-power-coefficient = <100>; 748c2ecf20Sopenharmony_ci qcom,freq-domain = <&cpufreq_hw 0>; 758c2ecf20Sopenharmony_ci #cooling-cells = <2>; 768c2ecf20Sopenharmony_ci next-level-cache = <&L2_0>; 778c2ecf20Sopenharmony_ci L2_0: l2-cache { 788c2ecf20Sopenharmony_ci compatible = "cache"; 798c2ecf20Sopenharmony_ci next-level-cache = <&L3_0>; 808c2ecf20Sopenharmony_ci L3_0: l3-cache { 818c2ecf20Sopenharmony_ci compatible = "cache"; 828c2ecf20Sopenharmony_ci }; 838c2ecf20Sopenharmony_ci }; 848c2ecf20Sopenharmony_ci }; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci /* ... */ 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci }; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci /* ... */ 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci thermal-zones { 938c2ecf20Sopenharmony_ci cpu0-thermal { 948c2ecf20Sopenharmony_ci polling-delay-passive = <250>; 958c2ecf20Sopenharmony_ci polling-delay = <1000>; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci thermal-sensors = <&tsens0 1>; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci trips { 1008c2ecf20Sopenharmony_ci cpu0_alert0: trip-point0 { 1018c2ecf20Sopenharmony_ci temperature = <90000>; 1028c2ecf20Sopenharmony_ci hysteresis = <2000>; 1038c2ecf20Sopenharmony_ci type = "passive"; 1048c2ecf20Sopenharmony_ci }; 1058c2ecf20Sopenharmony_ci }; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci cooling-maps { 1088c2ecf20Sopenharmony_ci map0 { 1098c2ecf20Sopenharmony_ci trip = <&cpu0_alert0>; 1108c2ecf20Sopenharmony_ci /* Corresponds to 1000MHz in OPP table */ 1118c2ecf20Sopenharmony_ci cooling-device = <&CPU0 5 5>; 1128c2ecf20Sopenharmony_ci }; 1138c2ecf20Sopenharmony_ci }; 1148c2ecf20Sopenharmony_ci }; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci /* ... */ 1178c2ecf20Sopenharmony_ci }; 1188c2ecf20Sopenharmony_ci... 119