Linux Thermal Framework: Architecture, Thermal Zones, Cooling Devices, and Governors
The Linux Thermal Framework provides a three‑layer architecture—userspace sysfs interfaces, kernel core components, and hardware sensors—to define thermal zones and cooling devices, employing governors such as bang‑bang, step‑wise, low‑limits, user‑space, and power‑allocator to balance performance, power consumption, and device temperature, especially on mobile platforms.
With the rapid development of technology, modern devices generate increasing amounts of heat, which can affect user experience, system stability, and chip lifespan. Because traditional cooling methods (e.g., fans, water cooling) are impractical for mobile devices, software-based thermal control becomes essential.
The Linux Thermal Framework provides a comprehensive architecture for managing device temperature. It consists of three layers:
Userspace : Exposes sysfs nodes under /sys/class/thermal/ (e.g., thermal_zone[n] , cooling_device[n] ) that allow applications to read temperatures and, with proper permissions, adjust cooling policies.
Kernelspace : Core components such as thermal_core , thermal_zone_device , thermal_cooling_device , and thermal_governor handle temperature acquisition and policy enforcement.
Hardware : Physical sensors (tsens0, tsens1, …) and cooling actuators (CPU, GPU, battery, etc.) are abstracted as thermal zones and cooling devices.
Thermal zones are described in device tree source (DTS) files. A typical zone definition includes parameters such as polling-delay-passive , polling-delay , thermal-governor , thermal-sensors , and trips (temperature thresholds, hysteresis, and trigger types). When the operating system runs, these zones appear as sysfs entries that can be monitored or modified from userspace.
Cooling devices are registered by drivers (e.g., cpufreq, devfreq) via of_thermal.c . Each cooling device has attributes like cur_state , max_state , and type , and is linked to thermal zones through cooling-maps and specific trip points.
The framework supports several thermal governors that decide how to adjust the cooling state when a zone reaches a trigger point:
bang_bang : Simple on/off control (e.g., turn fan on when temperature exceeds the threshold, turn it off when it falls below).
step_wise : Adjusts the cooling state step by step based on temperature trends (rising, falling, stable).
low_limits : Designed for low‑temperature environments to provide heating when needed.
user_space : Reports temperature and trigger information to userspace, allowing custom policies.
power_allocator (IPA): Uses a PID controller to allocate power based on temperature, adjusting frequency and voltage.
Future development of Linux thermal management is expected to continue improving the balance between performance and power consumption, with ongoing evolution of algorithms such as IPA and tighter integration with mobile SoC designs.
OPPO Kernel Craftsman
Sharing Linux kernel-related cutting-edge technology, technical articles, technical news, and curated tutorials
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.