1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0)
2c66ec88fSEmmanuel Vadot# Copyright 2020 Linaro Ltd.
3c66ec88fSEmmanuel Vadot%YAML 1.2
4c66ec88fSEmmanuel Vadot---
5c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/thermal/thermal-cooling-devices.yaml#
6c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
7c66ec88fSEmmanuel Vadot
8*8bab661aSEmmanuel Vadottitle: Thermal cooling device
9c66ec88fSEmmanuel Vadot
10c66ec88fSEmmanuel Vadotmaintainers:
11c66ec88fSEmmanuel Vadot  - Amit Kucheria <amitk@kernel.org>
12c66ec88fSEmmanuel Vadot
13c66ec88fSEmmanuel Vadotdescription: |
14c66ec88fSEmmanuel Vadot  Thermal management is achieved in devicetree by describing the sensor hardware
15c66ec88fSEmmanuel Vadot  and the software abstraction of cooling devices and thermal zones required to
16c66ec88fSEmmanuel Vadot  take appropriate action to mitigate thermal overload.
17c66ec88fSEmmanuel Vadot
18c66ec88fSEmmanuel Vadot  The following node types are used to completely describe a thermal management
19c66ec88fSEmmanuel Vadot  system in devicetree:
20c66ec88fSEmmanuel Vadot   - thermal-sensor: device that measures temperature, has SoC-specific bindings
21c66ec88fSEmmanuel Vadot   - cooling-device: device used to dissipate heat either passively or actively
22c66ec88fSEmmanuel Vadot   - thermal-zones: a container of the following node types used to describe all
23c66ec88fSEmmanuel Vadot     thermal data for the platform
24c66ec88fSEmmanuel Vadot
25c66ec88fSEmmanuel Vadot  This binding describes the cooling devices.
26c66ec88fSEmmanuel Vadot
27c66ec88fSEmmanuel Vadot  There are essentially two ways to provide control on power dissipation:
28c66ec88fSEmmanuel Vadot    - Passive cooling: by means of regulating device performance. A typical
29c66ec88fSEmmanuel Vadot      passive cooling mechanism is a CPU that has dynamic voltage and frequency
30c66ec88fSEmmanuel Vadot      scaling (DVFS), and uses lower frequencies as cooling states.
31c66ec88fSEmmanuel Vadot    - Active cooling: by means of activating devices in order to remove the
32c66ec88fSEmmanuel Vadot      dissipated heat, e.g. regulating fan speeds.
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel Vadot  Any cooling device has a range of cooling states (i.e. different levels of
35c66ec88fSEmmanuel Vadot  heat dissipation). They also have a way to determine the state of cooling in
36c66ec88fSEmmanuel Vadot  which the device is. For example, a fan's cooling states correspond to the
37c66ec88fSEmmanuel Vadot  different fan speeds possible. Cooling states are referred to by single
38c66ec88fSEmmanuel Vadot  unsigned integers, where larger numbers mean greater heat dissipation. The
39c66ec88fSEmmanuel Vadot  precise set of cooling states associated with a device should be defined in
40c66ec88fSEmmanuel Vadot  a particular device's binding.
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel Vadotselect: true
43c66ec88fSEmmanuel Vadot
44c66ec88fSEmmanuel Vadotproperties:
45c66ec88fSEmmanuel Vadot  "#cooling-cells":
46c66ec88fSEmmanuel Vadot    description:
47c66ec88fSEmmanuel Vadot      Must be 2, in order to specify minimum and maximum cooling state used in
48c66ec88fSEmmanuel Vadot      the cooling-maps reference. The first cell is the minimum cooling state
49c66ec88fSEmmanuel Vadot      and the second cell is the maximum cooling state requested.
50c66ec88fSEmmanuel Vadot    const: 2
51c66ec88fSEmmanuel Vadot
526be33864SEmmanuel VadotadditionalProperties: true
536be33864SEmmanuel Vadot
54c66ec88fSEmmanuel Vadotexamples:
55c66ec88fSEmmanuel Vadot  - |
56c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
57c66ec88fSEmmanuel Vadot    #include <dt-bindings/thermal/thermal.h>
58c66ec88fSEmmanuel Vadot
59c66ec88fSEmmanuel Vadot    // Example 1: Cpufreq cooling device on CPU0
60c66ec88fSEmmanuel Vadot    cpus {
61c66ec88fSEmmanuel Vadot            #address-cells = <2>;
62c66ec88fSEmmanuel Vadot            #size-cells = <0>;
63c66ec88fSEmmanuel Vadot
64c66ec88fSEmmanuel Vadot            CPU0: cpu@0 {
65c66ec88fSEmmanuel Vadot                    device_type = "cpu";
66c66ec88fSEmmanuel Vadot                    compatible = "qcom,kryo385";
67c66ec88fSEmmanuel Vadot                    reg = <0x0 0x0>;
68c66ec88fSEmmanuel Vadot                    enable-method = "psci";
69c9ccf3a3SEmmanuel Vadot                    cpu-idle-states = <&LITTLE_CPU_SLEEP_0>,
70c9ccf3a3SEmmanuel Vadot                                      <&LITTLE_CPU_SLEEP_1>,
71c9ccf3a3SEmmanuel Vadot                                      <&CLUSTER_SLEEP_0>;
72c66ec88fSEmmanuel Vadot                    capacity-dmips-mhz = <607>;
73c66ec88fSEmmanuel Vadot                    dynamic-power-coefficient = <100>;
74c66ec88fSEmmanuel Vadot                    qcom,freq-domain = <&cpufreq_hw 0>;
75c66ec88fSEmmanuel Vadot                    #cooling-cells = <2>;
76c66ec88fSEmmanuel Vadot                    next-level-cache = <&L2_0>;
77c66ec88fSEmmanuel Vadot                    L2_0: l2-cache {
78c66ec88fSEmmanuel Vadot                            compatible = "cache";
79*8bab661aSEmmanuel Vadot                            cache-unified;
80*8bab661aSEmmanuel Vadot                            cache-level = <2>;
81c66ec88fSEmmanuel Vadot                            next-level-cache = <&L3_0>;
82c66ec88fSEmmanuel Vadot                            L3_0: l3-cache {
83c66ec88fSEmmanuel Vadot                                    compatible = "cache";
84*8bab661aSEmmanuel Vadot                                    cache-unified;
85*8bab661aSEmmanuel Vadot                                    cache-level = <3>;
86c66ec88fSEmmanuel Vadot                            };
87c66ec88fSEmmanuel Vadot                    };
88c66ec88fSEmmanuel Vadot          };
89c66ec88fSEmmanuel Vadot
90c66ec88fSEmmanuel Vadot          /* ... */
91c66ec88fSEmmanuel Vadot
92c66ec88fSEmmanuel Vadot    };
93c66ec88fSEmmanuel Vadot
94c66ec88fSEmmanuel Vadot    /* ... */
95c66ec88fSEmmanuel Vadot
96c66ec88fSEmmanuel Vadot    thermal-zones {
97c66ec88fSEmmanuel Vadot            cpu0-thermal {
98c66ec88fSEmmanuel Vadot                    polling-delay-passive = <250>;
99c66ec88fSEmmanuel Vadot                    polling-delay = <1000>;
100c66ec88fSEmmanuel Vadot
101c66ec88fSEmmanuel Vadot                    thermal-sensors = <&tsens0 1>;
102c66ec88fSEmmanuel Vadot
103c66ec88fSEmmanuel Vadot                    trips {
104c66ec88fSEmmanuel Vadot                            cpu0_alert0: trip-point0 {
105c66ec88fSEmmanuel Vadot                                    temperature = <90000>;
106c66ec88fSEmmanuel Vadot                                    hysteresis = <2000>;
107c66ec88fSEmmanuel Vadot                                    type = "passive";
108c66ec88fSEmmanuel Vadot                            };
109c66ec88fSEmmanuel Vadot                    };
110c66ec88fSEmmanuel Vadot
111c66ec88fSEmmanuel Vadot                    cooling-maps {
112c66ec88fSEmmanuel Vadot                            map0 {
113c66ec88fSEmmanuel Vadot                                    trip = <&cpu0_alert0>;
114c66ec88fSEmmanuel Vadot                                    /* Corresponds to 1000MHz in OPP table */
115c66ec88fSEmmanuel Vadot                                    cooling-device = <&CPU0 5 5>;
116c66ec88fSEmmanuel Vadot                            };
117c66ec88fSEmmanuel Vadot                    };
118c66ec88fSEmmanuel Vadot            };
119c66ec88fSEmmanuel Vadot
120c66ec88fSEmmanuel Vadot            /* ... */
121c66ec88fSEmmanuel Vadot    };
122c66ec88fSEmmanuel Vadot...
123