Thermal System
Temperature Sensors
The X5 has three temperature sensors used to display the temperatures of the DDR, BPU, and CPU. These sensors' parameters can be found under the /sys/class/hwmon/
directory. Specifically, in the hwmon0
directory, the following temperature readings are provided:
temp1_input
: DDR temperaturetemp2_input
: BPU temperaturetemp3_input
: CPU temperature
The temperature accuracy is 0.001°C.
cat /sys/class/hwmon/hwmon0/temp1_input
46643
Note: The BPU temperature sensor is located in the BPU subsystem, which is powered on only when the BPU is running. Therefore, the BPU temperature can only be monitored when the BPU is active.
Thermal
Linux Thermal is a module in the Linux system related to temperature control. It is primarily used to manage the heat generated by the chip during system operation, ensuring that the chip temperature and the device casing temperature remain within a safe and comfortable range.
To achieve reasonable temperature control, we need to understand the following three modules:
- Temperature Sensing Devices: In the Thermal framework, these are abstracted as Thermal Zone Devices. The X5 has two thermal zones, namely
thermal_zone0
andthermal_zone1
. - Cooling Devices: In the Thermal framework, these are abstracted as Thermal Cooling Devices, such as CPU, BPU, GPU, and DDR.
- Temperature Control Policy: In the Thermal framework, this is abstracted as the Thermal Governor.
Information and control for these modules can be found under the /sys/class/thermal
directory.
In the X5, there are four cooling devices:
- cooling_device0: CPU
- cooling_device1: BPU
- cooling_device2: GPU
- cooling_device3: DDR
Among these, the DDR cooling device is associated with thermal_zone0
, while the CPU/BPU/GPU cooling devices are associated with thermal_zone1
. The default policy, as identified by the following command, is step_wise.
cat /sys/class/thermal/thermal_zone0/policy
You can see the supported policies through the following command: user_space
and step_wise
, a total of two options.
cat /sys/class/thermal/thermal_zone0/available_policies
- user_space: This policy reports the current temperature of the thermal zone, as well as the thermal trigger points, to user space via uevent. The user space software then defines the thermal control strategy.
- step_wise: This policy gradually increases the cooling state in each polling cycle. It is a relatively mild thermal control strategy.
The choice of which strategy to use depends on the product requirements. It can be specified during compilation or dynamically switched via sysfs. For example, to dynamically switch the strategy for thermal_zone0
to user_space
mode, use the following command:
echo user_space > /sys/class/thermal/thermal_zone0/policy
In thermal_zone0
, there is 1 trip point used to control the frequency scaling of the DDR cooling device.
You can check the DDR frequency scaling temperature through sysfs. The current configured value is 95°C.
cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
If you want to adjust the DDR frequency scaling temperature to 85°C, you can use the following command:
echo 85000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
In thermal_zone1
, there are 3 trip points:
- trip_point_0_temp: Reserved for future use.
- trip_point_1_temp: The frequency scaling temperature for this thermal zone, which controls the CPU/BPU/GPU frequency. The current setting is 95°C.
- trip_point_2_temp: The shutdown temperature, which is currently set to 105°C.
To set the temperature at which the CPU/BPU/GPU should start frequency scaling to 85°C, you can adjust trip_point_1_temp in
thermal_zone1
. Use the following command:
echo 85000 > /sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp
If you want to adjust the shutdown temperature to 105°C in thermal_zone1
, you can modify trip_point_2_temp. Use the following command:
echo 105000 > /sys/devices/virtual/thermal/thermal_zone1/trip_point_2_temp
Note: The above settings will need to be re-applied after a power cycle or reboot.
Thermal Reference Documentation
The following paths are based on the kernel source directory:
./Documentation/devicetree/bindings/thermal
./Documentation/driver-api/thermal