SOC THERMAL DRAFT: Difference between revisions
No edit summary |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
Set common variables | Set common variables | ||
--> {{#vardefine: MACHINE_PROMPT | root@{{#var:MACHINE_NAME}}}} <!-- | --> {{#vardefine: MACHINE_PROMPT | root@{{#var:MACHINE_NAME}}}} <!-- | ||
--> {{#vardefine: KERNEL_SOURCE | {{#ifeq: {{#pos: {{#var: HARDWARE_NAME}} | | --> {{#vardefine: KERNEL_SOURCE | {{#ifeq: {{#pos: {{#var: HARDWARE_NAME}} | MX6 }} | | {{#ifeq: {{#pos: {{#var: HARDWARE_NAME}} | MX7 }} | | {{#ifeq: {{#pos: {{#var: HARDWARE_NAME}} | 6UL }} | | device tree | source code }} | source code }} | source code }}}} <!-- | ||
--> {{#vardefine: DEVICE_TREE | {{#replace:{{#var:DEFAULT_DTB}}|dtb|dts}}}} <!-- | --> {{#vardefine: DEVICE_TREE | {{#replace:{{#var:DEFAULT_DTB}}|dtb|dts}}}} <!-- | ||
--> {{#vardefine: DEVICE_TREE_LINK | https://github.com/varigit/{{#var:KERNEL_REPO_NAME}}/blob/{{#var:KERNEL_BRANCH}}/arch/arm64/boot/dts/freescale/{{#var:DEVICE_TREE}}}} <!-- | --> {{#vardefine: DEVICE_TREE_LINK | https://github.com/varigit/{{#var:KERNEL_REPO_NAME}}/blob/{{#var:KERNEL_BRANCH}}/arch/arm64/boot/dts/freescale/{{#var:DEVICE_TREE}}}} <!-- | ||
--> {{#vardefine: IMX_THERMAL_LINK | https://github.com/varigit/{{#var:KERNEL_REPO_NAME}}/blob/{{#var:KERNEL_BRANCH}}/drivers/thermal/imx_thermal.c }} <!-- | --> {{#vardefine: IMX_THERMAL_LINK | https://github.com/varigit/{{#var:KERNEL_REPO_NAME}}/blob/{{#var:KERNEL_BRANCH}}/drivers/thermal/imx_thermal.c }} <!-- | ||
--> {{#vardefine: HEATSINK_LINK | | --> {{#switch: {{#var:HARDWARE_NAME}} | VAR-SOM-AM62= | ||
{{# | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-AM62 Heatsink]}} | ||
[https://www.variscite.com/product/accessories/vhp- | {{#vardefine: SOC_FAMILY | AM62}} | ||
| VAR-SOM-MX6= | |||
{{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-mx6/ VAR-SOM-MX6 Heatsink]}} | |||
{{#vardefine: SOC_FAMILY | MX6_MX7}} | |||
| DART-6UL= | |||
{{#vardefine: HEATSINK_LINK | }} | |||
{{#vardefine: SOC_FAMILY | MX6_MX7}} | |||
| VAR-SOM-MX7= | |||
{{#vardefine: HEATSINK_LINK | }} | |||
{{#vardefine: SOC_FAMILY | MX6_MX7}} | |||
| VAR-SOM-MX8= | |||
{{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-mx8/ VAR-SOM-MX8 Heatsink]}} | |||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| DART-MX8M= | | DART-MX8M= | ||
[https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M Heatsink] | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| DART-MX8M-MINI= | | DART-MX8M-MINI= | ||
[https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M-MINI Heatsink]<br> | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M-MINI Heatsink]<br> | ||
[https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-MINI Heatsink] | [https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-MINI Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| VAR-SOM-MX8M-NANO= | | VAR-SOM-MX8M-NANO= | ||
[https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-NANO Heatsink] | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-NANO Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| DART-MX8M-PLUS= | | DART-MX8M-PLUS= | ||
[https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M-PLUS Heatsink]<br> | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-dt8mx/ DART-MX8M-PLUS Heatsink]<br> | ||
[https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-PLUS Heatsink] | [https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX8M-PLUS Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| | |||
| VAR-SOM-MX8X= | | VAR-SOM-MX8X= | ||
[https://www.variscite.com/product/accessories/vhp-mx8/ VAR-SOM-MX8X Heatsink] | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-mx8/ VAR-SOM-MX8X Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| | | VAR-SOM-MX93 = | ||
[https://www.variscite.com/ | {{#vardefine: HEATSINK_LINK | [https://www.variscite.com/product/accessories/vhp-vs8m/ VAR-SOM-MX93 Heatsink]}} | ||
{{#vardefine: SOC_FAMILY | MX8_MX93}} | |||
| }} <!-- | |||
--> {{#vardefine: HEATSINK | {{#if: {{#var:HEATSINK_LINK}} | | |||
{{Note|'''NOTE:'''<br> | |||
Variscite provides the heat sink on the accessories page:<br> | |||
{{#var: HEATSINK_LINK}} | info }}}} | |||
|}}<!-- | |||
Define mx6/7 source codes lines needed for changing the trip points | Define mx6/7 source codes lines needed for changing the trip points | ||
--> {{#vardefine: | -->{{#vardefine: MX6_MX7_TRIP_CHANGE_CODE | {{#ifexpr: {{#var:KERNEL_VER}} >= 4.9 <!-- | ||
Kernel version 4.9 or higher -->|< | Kernel version 4.9 or higher --> | ||
static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0) | |<br> | ||
{ | static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0) | ||
{ | |||
struct imx_thermal_data *data = platform_get_drvdata(pdev); | |||
/* The maximum die temp is specified by the Temperature Grade */ | |||
switch ((ocotp_mem0 >> 6) & 0x3) { | |||
case 0: /* Commercial (0 to 95 °C) */ | |||
data->temp_grade = "Commercial"; | |||
data->temp_max = 95000; | |||
break; | |||
case 1: /* Extended Commercial (-20 °C to 105 °C) */ | |||
data->temp_grade = "Extended Commercial"; | |||
data->temp_max = 105000; | |||
break; | |||
case 2: /* Industrial (-40 °C to 105 °C) */ | |||
data->temp_grade = "Industrial"; | |||
data->temp_max = 105000; | |||
break; | |||
case 3: /* Automotive (-40 °C to 125 °C) */ | |||
data->temp_grade = "Automotive"; | |||
data->temp_max = 125000; | |||
break; | |||
} | |||
/* | |||
* Set the critical trip point at 5 °C under max | |||
* Set the passive trip point at 10 °C under max (changeable via sysfs) | |||
*/ | |||
'''data->temp_critical = data->temp_max - (1000 * 5);''' /* Sets critical trip point temperature, in millidegree Celsius */ | |||
'''data->temp_passive = data->temp_max - (1000 * 10);''' /* Sets passive trip point temperature, in millidegree Celsius */ | |||
} | |||
<!-- Kernel version less than 4.9 --> | |||
|<br> | |||
'''#define IMX_TEMP_PASSIVE 85000''' /* Sets passive trip point temperature, in millidegree Celsius */ | |||
... | |||
/* | |||
* Set the default critical trip point to 20 C higher | |||
* than the passive trip point. Can be changed from userspace. | |||
*/ | |||
'''data->temp_critical = IMX_TEMP_PASSIVE + 20 * 1000;''' /* Sets critical trip point temperature, in millidegree Celsius */ | |||
}}}}<!-- | |||
Define mx8/mx93 device tree node needed for changing the trip points | |||
-->{{#vardefine: MX8_MX93_TRIP_CHANGE_CODE | | |||
<br> | |||
&thermal-zones { | |||
cpu-thermal { | |||
trips { | |||
cpu_alert0: trip0 { | |||
'''temperature = <85000>;''' /* Sets passive trip point temperature, in millidegree Celsius */ | |||
hysteresis = <2000>; | |||
type = "passive"; | |||
}; | |||
cpu_crit0: trip1 { | |||
'''temperature = <95000>;''' /* Sets the critical trip point temperature, in millidegree Celsius */ | |||
hysteresis = <2000>; | |||
type = "critical"; | |||
}; | |||
}; | |||
}; | |||
}; | |||
This node will instruct the kernel to periodically poll this temperature sensor and to shut down the SoC once it has exceeded 95 degrees Celsius. And will reduce CPU frequency using DFS by cpufreq-dt driver at 85 degrees Celsius. | |||
}}<!-- | |||
} | |||
Define am62 device tree node needed for changing the trip points | |||
-->{{#vardefine: AM62_TRIP_CHANGE_CODE | | |||
<br> | |||
thermal_zones: thermal-zones { | |||
main0_thermal: main0-thermal { | |||
polling-delay-passive = <250>; /* milliseconds */ | |||
polling-delay = <500>; /* milliseconds */ | |||
thermal-sensors = <&wkup_vtm0 0>; | |||
trips { | |||
main0_crit: main0-crit { | |||
'''temperature = <105000>;''' /* milliCelsius */ | |||
hysteresis = <2000>; /* milliCelsius */ | |||
type = "critical"; | |||
}; | |||
}; | |||
}; | |||
main1_thermal: main1-thermal { | |||
polling-delay-passive = <250>; /* milliseconds */ | |||
polling-delay = <500>; /* milliseconds */ | |||
thermal-sensors = <&wkup_vtm0 1>; | |||
trips { | |||
main1_crit: main1-crit { | |||
'''temperature = <105000>;''' /* milliCelsius */ | |||
hysteresis = <2000>; /* milliCelsius */ | |||
type = "critical"; | |||
}; | |||
}; | |||
}; | |||
}; | |||
This node will instruct the kernel to periodically poll this temperature sensor and to shut down the SoC once it has exceeded 105 degrees Celsius. And will reduce CPU frequency using DFS by cpufreq-dt driver at 85 degrees Celsius. | |||
}}<!-- | |||
-->{{PageHeader|{{#var:HARDWARE_NAME}} SoC Thermal Temperature}} __toc__ | |||
{{PageHeader|{{#var:HARDWARE_NAME}} SoC Thermal Temperature}} __toc__ | |||
= Introduction = | = 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.<br> | 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.<br> | ||
The temperature of the CPU must be within a safe range to ensure that the system | 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. | 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. | ||
== Temperature management == | |||
Thermal management is an essential aspect of ensuring optimal performance of the processor. Although the system has software mechanisms to manage temperature, a good thermal design can improve the dissipation of the heat generated by the processor. Here are some extra components that can be used for temperature management: | |||
* '''Fan''': Fans are used to improve airflow and dissipate heat. When using a fan, it's essential to ensure that it's the appropriate size and has sufficient airflow to remove heat effectively. | |||
* '''Thermal Interface''': Thermal interfaces are used to fill gaps between the processor and heat sink to improve thermal conductivity. There are many types, such as thermal paste, thermal pads, and thermal tapes. | |||
*'''Heat Sink''': A heat sink is an essential component in a thermal design. It typically consists of a plate that has good thermal conductivity with a large surface area that is in contact with the device that generates heat, for instance, the processor. The heat is then transferred from the device to the heatsink. | |||
{{#var:HEATSINK}} | |||
{{#switch: {{#var:SOC_FAMILY}} | AM62= | |||
= Voltage and Thermal Manager (VTM) = | |||
The '''VTM''' module on the AM62x supports voltage and thermal management of the device by providing control of on-chip temperature sensors. | |||
The device supports a single VTM module, '''VTM0''', which is located in the '''WKUP''' domain. | |||
'''VTM0''' has two associated temperature monitors, '''Temp_Sensor_Main_0''', and '''Temp_Sensor_Main_1''', each of which is located near hotspots in the device die.<br> | |||
The VTM system provides the control, status, and interrupt generation for the various independent temperature sensors located at different hotspots on the SoC. | |||
This allows the kernel to take actions based on thermal events configured via the kernel’s device tree. | |||
| {{#var: SOC_FAMILY}}= | |||
= U-Boot = | = U-Boot = | ||
The imx_thermal driver is an essential component for ensuring the proper operation of i.MX SoCs, particularly in environments where high temperatures are a concern. | The imx_thermal driver is an essential component for ensuring the proper operation of i.MX SoCs, particularly in environments where high temperatures are a concern. | ||
In U-Boot, the CPU temperature is 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.<br> | In U-Boot, the CPU temperature is 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.<br> | ||
Line 105: | Line 189: | ||
Starting from [https://github.com/varigit/uboot-imx/tree/imx_v2017.03_4.9.11_1.0.0_ga_var01 imx_v2017.03_4.9.11_1.0.0_ga_var01], the critical temperature is set automatically and set to the same values as in the more recent Linux kernel releases. The feature was introduced in the following commit: | Starting from [https://github.com/varigit/uboot-imx/tree/imx_v2017.03_4.9.11_1.0.0_ga_var01 imx_v2017.03_4.9.11_1.0.0_ga_var01], the critical temperature is set automatically and set to the same values as in the more recent Linux kernel releases. The feature was introduced in the following commit: | ||
* [https://github.com/varigit/uboot-imx/commit/a91db95479e75c70ec49676e9a347787b054d651 thermal: imx_thermal: use CPU temperature grade for trip points] | * [https://github.com/varigit/uboot-imx/commit/a91db95479e75c70ec49676e9a347787b054d651 thermal: imx_thermal: use CPU temperature grade for trip points] | ||
}} | |||
= Linux kernel = | = Linux kernel = | ||
In the User space, the current CPU's temperature sensor can be read as the following: | In the User space, the current CPU's temperature sensor can be read as the following: | ||
{{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/ | {{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/thermal_zone*/temp | ||
<br> | <br> | ||
Additionally, there are | Additionally, there {{#switch: {{#var:SOC_FAMILY}} | AM62=is a '''thermal trip point''' | are '''thermal trip points'''}} that can be configured to control the behavior of the CPU based on temperature changes:<br> | ||
{{#switch: {{#var:SOC_FAMILY}} | AM62= | | |||
<br> | <br> | ||
The | The '''passive trip point''', set/read in: | ||
{{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp | {{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp | ||
Line 119: | Line 204: | ||
This is done by lowering the CPU frequency and voltage to reduce the heat generated by the processor. | This is done by lowering the CPU frequency and voltage to reduce the heat generated by the processor. | ||
Once the temperature drops '''10 °C''' below the passive trip point, the CPU frequency returns to its normal value.<br> | Once the temperature drops '''10 °C''' below the passive trip point, the CPU frequency returns to its normal value.<br> | ||
<br> | <br>}} | ||
The | The '''critical trip point''', is read/set in: | ||
{{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/thermal_zone0/ | {{#var:MACHINE_PROMPT}}:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_{{#switch: {{#var:SOC_FAMILY}} | AM62=0 | 1}}_temp | ||
The critical trip point is the temperature threshold at which the kernel will initiate an emergency shutdown to prevent damage to the processor due to overheating. This is a last-resort mechanism to protect the system from damaging itself.<br> | The critical trip point is the temperature threshold at which the kernel will initiate an emergency shutdown to prevent damage to the processor due to overheating. This is a last-resort mechanism to protect the system from damaging itself.<br> | ||
== Defining the default trip points values via Linux kernel {{#var: KERNEL_SOURCE}} == | == Defining the default trip points values via Linux kernel {{#var: KERNEL_SOURCE}} == | ||
{{#ifeq: {{#pos: {{#var: SOC_FAMILY}} | MX6_MX7 }} | | | | |||
Starting from kernel [https://github.com/varigit/linux-imx/tree/imx_4.9.11_1.0.0_ga-var01 imx_4.9.11_1.0.0_ga-var01], the temperature grade of the CPU is detected automatically, and the trip points are set accordingly.<br> | Starting from kernel [https://github.com/varigit/linux-imx/tree/imx_4.9.11_1.0.0_ga-var01 imx_4.9.11_1.0.0_ga-var01], the temperature grade of the CPU is detected automatically, and the trip points are set accordingly.<br> | ||
* For Commercial CPUs, the operational temperature ranges from 0 to 95 °C. | * For Commercial CPUs, the operational temperature ranges from 0 to 95 °C. | ||
Line 133: | Line 219: | ||
The critical trip point is set to '''5 °C''' below the maximum temperature, while the passive trip point is set to '''10 °C''' below the maximum temperature.<br> | The critical trip point is set to '''5 °C''' below the maximum temperature, while the passive trip point is set to '''10 °C''' below the maximum temperature.<br> | ||
<br> | <br> | ||
In older releases, the temperature grade may not be detected automatically, and the trip points must be set manually | In older releases, the temperature grade may not be detected automatically, and the trip points must be set manually. To manually set the trip points, the appropriate SYSFS file can be written to, but the default value of the passive trip point can not be exceeded without modifying the kernel source code.<br> | }} | ||
<!-- Demonstrate how to change the thermal trip points in the source code --> | <!-- Demonstrate how to change the thermal trip points in the source code --> | ||
=== {{#var:HARDWARE_NAME}} {{#var:KERNEL_SOURCE}}=== | === {{#var:HARDWARE_NAME}} {{#var:KERNEL_SOURCE}}=== | ||
{{Note|''' | {{Note|'''CAUTION:'''<br> | ||
Be very careful when changing the thermal trip points of your SoC manually. Note that changing the thermal trip points can have serious consequences if not done properly. It is important to understand the thermal characteristics of your device and to make careful modifications to the trip points to avoid causing damage or instability. | Be very careful when changing the thermal trip points of your SoC manually. 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. Note that changing the thermal trip points can have serious consequences if not done properly. It is important to understand the thermal characteristics of your device and to make careful modifications to the trip points to avoid causing damage or instability. | ||
| error}} | | error}} | ||
{{#ifeq: {{#pos: {{#var: | {{#ifeq: {{#pos: {{#var: SOC_FAMILY}} | MX6_MX7 }} |<!-- | ||
i. | i.MX8/ i.MX93 / AM62 -->| The {{#var: MACHINE_NAME}} temperature trip points can be changed by adding the following to its [{{#var: DEVICE_TREE_LINK}} {{#var: KERNEL_SOURCE}}]:<!-- | ||
i.MX6/ i.MX7 -->| The {{#var: MACHINE_NAME}} temperature trip points can be changed in the following lines of the [{{#var: IMX_THERMAL_LINK}} imx_thermal {{#var: KERNEL_SOURCE}}]:}} | |||
i. | {{#switch: {{#var:SOC_FAMILY}} | MX6_MX7= | ||
{{#var: MX6_MX7_TRIP_CHANGE_CODE}} | |||
| MX8_MX93= | |||
{{#var: MX8_MX93_TRIP_CHANGE_CODE}} | |||
| AM62= | |||
{{#var: AM62_TRIP_CHANGE_CODE}} | |||
| }} | |||
= powertop package = | |||
In addition, to identify which processes are consuming more power, the '''powertop''' software package can be used. It is a Linux tool used to diagnose issues with power consumption and power management<br> | |||
<br> | |||
To install '''powertop''', add the following line to the '''conf/local.conf''' file in your Yocto build: | |||
{{#ifexpr: {{#var:YOCTO_VERSION}} >= 3.4 | |||
| <pre>IMAGE_INSTALL:append = "powertop"</pre> | |||
| <pre>IMAGE_INSTALL_append = "powertop"</pre> }} | |||
< | |||
Latest revision as of 12:29, 27 June 2023
This page is using the default release mx8mp-yocto-hardknott-5.10.72_2.2.1-v1.0.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
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.
Temperature management
Thermal management is an essential aspect of ensuring optimal performance of the processor. Although the system has software mechanisms to manage temperature, a good thermal design can improve the dissipation of the heat generated by the processor. Here are some extra components that can be used for temperature management:
- Fan: Fans are used to improve airflow and dissipate heat. When using a fan, it's essential to ensure that it's the appropriate size and has sufficient airflow to remove heat effectively.
- Thermal Interface: Thermal interfaces are used to fill gaps between the processor and heat sink to improve thermal conductivity. There are many types, such as thermal paste, thermal pads, and thermal tapes.
- Heat Sink: A heat sink is an essential component in a thermal design. It typically consists of a plate that has good thermal conductivity with a large surface area that is in contact with the device that generates heat, for instance, the processor. The heat is then transferred from the device to the heatsink.
Variscite provides the heat sink on the accessories page:
DART-MX8M-PLUS Heatsink
U-Boot
The imx_thermal driver is an essential component for ensuring the proper operation of i.MX SoCs, particularly in environments where high temperatures are a concern.
In U-Boot, the CPU temperature is 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 imx_v2017.03_4.9.11_1.0.0_ga_var01, the critical temperature is set automatically and set to the same values as in the more recent Linux kernel releases. The feature was introduced in the following commit:
Linux kernel
In the User space, the current CPU's temperature sensor can be read as the following:
root@imx8mp-var-dart:~# cat /sys/devices/virtual/thermal/thermal_zone*/temp
Additionally, there are thermal trip points that can be configured to control the behavior of the CPU based on temperature changes:
The passive trip point, set/read in:
root@imx8mp-var-dart:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp
The passive trip point refers to the temperature at which the kernel starts to reduce the performance of the SoC to prevent it from overheating.
This is done by lowering the CPU frequency and voltage to reduce the heat generated by the processor.
Once the temperature drops 10 °C below the passive trip point, the CPU frequency returns to its normal value.
The critical trip point, is read/set in:
root@imx8mp-var-dart:~# cat /sys/devices/virtual/thermal/thermal_zone0/trip_point_1_temp
The critical trip point is the temperature threshold at which the kernel will initiate an emergency shutdown to prevent damage to the processor due to overheating. This is a last-resort mechanism to protect the system from damaging itself.
Defining the default trip points values via Linux kernel device tree
DART-MX8M-PLUS device tree
Be very careful when changing the thermal trip points of your SoC manually. 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. Note that changing the thermal trip points can have serious consequences if not done properly. It is important to understand the thermal characteristics of your device and to make careful modifications to the trip points to avoid causing damage or instability.
The imx8mp-var-dart temperature trip points can be changed by adding the following to its device tree:
&thermal-zones { cpu-thermal { trips { cpu_alert0: trip0 { temperature = <85000>; /* Sets passive trip point temperature, in millidegree Celsius */ hysteresis = <2000>; type = "passive"; }; cpu_crit0: trip1 { temperature = <95000>; /* Sets the critical trip point temperature, in millidegree Celsius */ hysteresis = <2000>; type = "critical"; }; }; }; };
This node will instruct the kernel to periodically poll this temperature sensor and to shut down the SoC once it has exceeded 95 degrees Celsius. And will reduce CPU frequency using DFS by cpufreq-dt driver at 85 degrees Celsius.
powertop package
In addition, to identify which processes are consuming more power, the powertop software package can be used. It is a Linux tool used to diagnose issues with power consumption and power management
To install powertop, add the following line to the conf/local.conf file in your Yocto build:
IMAGE_INSTALL_append = "powertop"