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-cooling-devices.yaml#
662306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
762306a36Sopenharmony_ci
862306a36Sopenharmony_cititle: Thermal cooling device
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 overload.
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 cooling devices.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci  There are essentially two ways to provide control on power dissipation:
2862306a36Sopenharmony_ci    - Passive cooling: by means of regulating device performance. A typical
2962306a36Sopenharmony_ci      passive cooling mechanism is a CPU that has dynamic voltage and frequency
3062306a36Sopenharmony_ci      scaling (DVFS), and uses lower frequencies as cooling states.
3162306a36Sopenharmony_ci    - Active cooling: by means of activating devices in order to remove the
3262306a36Sopenharmony_ci      dissipated heat, e.g. regulating fan speeds.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci  Any cooling device has a range of cooling states (i.e. different levels of
3562306a36Sopenharmony_ci  heat dissipation). They also have a way to determine the state of cooling in
3662306a36Sopenharmony_ci  which the device is. For example, a fan's cooling states correspond to the
3762306a36Sopenharmony_ci  different fan speeds possible. Cooling states are referred to by single
3862306a36Sopenharmony_ci  unsigned integers, where larger numbers mean greater heat dissipation. The
3962306a36Sopenharmony_ci  precise set of cooling states associated with a device should be defined in
4062306a36Sopenharmony_ci  a particular device's binding.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciselect: true
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciproperties:
4562306a36Sopenharmony_ci  "#cooling-cells":
4662306a36Sopenharmony_ci    description:
4762306a36Sopenharmony_ci      Must be 2, in order to specify minimum and maximum cooling state used in
4862306a36Sopenharmony_ci      the cooling-maps reference. The first cell is the minimum cooling state
4962306a36Sopenharmony_ci      and the second cell is the maximum cooling state requested.
5062306a36Sopenharmony_ci    const: 2
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciadditionalProperties: true
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciexamples:
5562306a36Sopenharmony_ci  - |
5662306a36Sopenharmony_ci    #include <dt-bindings/interrupt-controller/arm-gic.h>
5762306a36Sopenharmony_ci    #include <dt-bindings/thermal/thermal.h>
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci    // Example 1: Cpufreq cooling device on CPU0
6062306a36Sopenharmony_ci    cpus {
6162306a36Sopenharmony_ci            #address-cells = <2>;
6262306a36Sopenharmony_ci            #size-cells = <0>;
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci            CPU0: cpu@0 {
6562306a36Sopenharmony_ci                    device_type = "cpu";
6662306a36Sopenharmony_ci                    compatible = "qcom,kryo385";
6762306a36Sopenharmony_ci                    reg = <0x0 0x0>;
6862306a36Sopenharmony_ci                    enable-method = "psci";
6962306a36Sopenharmony_ci                    cpu-idle-states = <&LITTLE_CPU_SLEEP_0>,
7062306a36Sopenharmony_ci                                      <&LITTLE_CPU_SLEEP_1>,
7162306a36Sopenharmony_ci                                      <&CLUSTER_SLEEP_0>;
7262306a36Sopenharmony_ci                    capacity-dmips-mhz = <607>;
7362306a36Sopenharmony_ci                    dynamic-power-coefficient = <100>;
7462306a36Sopenharmony_ci                    qcom,freq-domain = <&cpufreq_hw 0>;
7562306a36Sopenharmony_ci                    #cooling-cells = <2>;
7662306a36Sopenharmony_ci                    next-level-cache = <&L2_0>;
7762306a36Sopenharmony_ci                    L2_0: l2-cache {
7862306a36Sopenharmony_ci                            compatible = "cache";
7962306a36Sopenharmony_ci                            cache-unified;
8062306a36Sopenharmony_ci                            cache-level = <2>;
8162306a36Sopenharmony_ci                            next-level-cache = <&L3_0>;
8262306a36Sopenharmony_ci                            L3_0: l3-cache {
8362306a36Sopenharmony_ci                                    compatible = "cache";
8462306a36Sopenharmony_ci                                    cache-unified;
8562306a36Sopenharmony_ci                                    cache-level = <3>;
8662306a36Sopenharmony_ci                            };
8762306a36Sopenharmony_ci                    };
8862306a36Sopenharmony_ci          };
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci          /* ... */
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci    };
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci    /* ... */
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci    thermal-zones {
9762306a36Sopenharmony_ci            cpu0-thermal {
9862306a36Sopenharmony_ci                    polling-delay-passive = <250>;
9962306a36Sopenharmony_ci                    polling-delay = <1000>;
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci                    thermal-sensors = <&tsens0 1>;
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci                    trips {
10462306a36Sopenharmony_ci                            cpu0_alert0: trip-point0 {
10562306a36Sopenharmony_ci                                    temperature = <90000>;
10662306a36Sopenharmony_ci                                    hysteresis = <2000>;
10762306a36Sopenharmony_ci                                    type = "passive";
10862306a36Sopenharmony_ci                            };
10962306a36Sopenharmony_ci                    };
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci                    cooling-maps {
11262306a36Sopenharmony_ci                            map0 {
11362306a36Sopenharmony_ci                                    trip = <&cpu0_alert0>;
11462306a36Sopenharmony_ci                                    /* Corresponds to 1000MHz in OPP table */
11562306a36Sopenharmony_ci                                    cooling-device = <&CPU0 5 5>;
11662306a36Sopenharmony_ci                            };
11762306a36Sopenharmony_ci                    };
11862306a36Sopenharmony_ci            };
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci            /* ... */
12162306a36Sopenharmony_ci    };
12262306a36Sopenharmony_ci...
123