Search code examples
linux-kerneldevice-treeheat

What does kernel thermal zone mean in dts file?


In the dts file of my kernel, I have:

thermal-zones {
    cpu0_thermal: cpu0-thermal {
        thermal-sensors = <&tmuctrl_0>;
        polling-delay-passive = <1000>;
        polling-delay = <1000>;
        trips {
            cpu_alert0: cpu-alert-0 {
                temperature = <100000>;
                hysteresis = <1000>;
                type = "active";
            };
            cpu_alert1: cpu-alert-1 {
                temperature = <110000>;
                hysteresis = <1000>;
                type = "passive";
            };
            cpu_alert2: cpu-alert-2 {
                temperature = <120000>;
                hysteresis = <1000>;
                type = "passive";
            };
            cpu-crit-0 {
                temperature = <130000>;
                hysteresis = <1000>;
                type = "critical";
            };
        };

        cooling-maps {
            map0 {
                trip = <&cpu_alert0>;
                cooling-device = <&cpu0 1 1>;
            };
            map1 {
                trip = <&cpu_alert1>;
                cooling-device = <&cpu0 4 4>;
            };
            map2 {
                trip = <&cpu_alert2>;
                cooling-device = <&cpu0 10 10>;
            };
        };
    };
};

It seems that passive means only CPU is used, active means any FAN cooling-device is used.

My question: what do the two figures represent in the cooling-device of the CPU?

https://www.kernel.org/doc/Documentation/devicetree/bindings/thermal/thermal.txt says: "Cooling states are referred to by single unsigned integers, where larger numbers mean greater heat dissipation."

But what is 1, 4 and 10? Would this apply only if cpufreq is ondemand? How are the "cooling" frequencies calculated? is there another part of the DTS that is linked to those values?


Solution

  • I'm not totally sure if it's generic or specific to my ARM device, but I figured out by reading commit comments that the number (1, 4, 10) correspond to throttle of the CPU only in ondemand mode. In my particular case, those numbers represent a measure of throttle in 100MHz. Therefore, 10 means that the CPU is throttle at 1GHz less than its maximum frequency.