SOC THERMAL DRAFT
Introduction
The CPU temperature plays a crucial role in the optimal functioning and reliability of a computer system. As the CPU is the primary processing unit of a computer, it generates a significant amount of heat while executing tasks.
The temperature of the CPU must be within a safe range to ensure that the system
operates correctly, without any performance degradation or hardware damage. Therefore, monitoring and managing the CPU temperature is essential to maintaining a stable and efficient computer system.
If there are heat problems, using a heat plate or sink can be considered as an option to manage the temperature of the CPU. Variscite provides the heat sink on the accessories page:
U-Boot
In the U-Boot, the CPU temperature is also monitored, and if it exceeds the critical temperature, the system waits until the temperature drops below the critical trip point before continuing with the boot process.
Starting from the imx_v2017.03_4.9.11_1.0.0_ga_var01 branch, the critical temperature is detected automatically and set to the same values as in the newer kernels.
Linux Kernel
In the User space, the current CPU's temperature sensor can be read as the following:
root@machine:~# cat /sys/devices/virtual/thermal/thermal_zone0/temp
Additionally, there are two thermal trip points that can be configured to control the behavior of the CPU based on temperature changes:
The first trip point, also known as the passive trip point, is set/read in:
root@machine:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
When the CPU temperature reaches the passive trip point, the CPU frequency is reduced to minimize heat production, allowing the CPU to cool down.
Once the temperature drops 10 °C below the passive trip point, the CPU frequency returns to its normal value.
The second trip point, the critical trip point, is read/set in:
root@machine:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_1_temp
If the CPU temperature exceeds the critical trip point, the system is shut down by software to avoid damaging the hardware.
Starting from kernel version 4.9.x, the temperature grade of the CPU is detected automatically, and the trip points are set accordingly.
For Industrial/Extended Commercial temperature grade CPUs, the maximum temperature is 105 °C, and the critical trip point is set 5 °C below the maximum temperature, while the passive trip point is set to 10 °C below the maximum temperature.
For Commercial grade CPUs, the maximum temperature is 95 °C, and the trip points are similarly set.
In older kernels, the temperature grade may not be detected automatically, and the trip points must be set manually. However, it is essential to be careful not to set the trip points of a higher-grade CPU on a lower-grade CPU to avoid damage. To manually set the trip points, the appropriate sysfs file can be written to, but the default value of the passive trip point cannot be exceeded without modifying the kernel source code.
To identify which processes are consuming the most power, the powertop software package can be used.
Defining the default trip points values via Linux kernel source code/device tree
The default values of the passive and critical trip points can be changed manually in the Linux kernel source code.
i.MX6 Family
- Passive trip point: https://github.com/varigit/linux-2.6-imx/blob/imx-rel_imx_4.1.15_2.0.0_ga-var03/drivers/thermal/imx_thermal.c#L95
- Critical trip point: https://github.com/varigit/linux-2.6-imx/blob/imx-rel_imx_4.1.15_2.0.0_ga-var03/drivers/thermal/imx_thermal.c#L634