The NXP i.MX8M Mini SOC Thermal Monitor Unit (TMU) has a sensor that can measure the die temperature with 1 °C resolution and uses software calibration.

Kernel configuration

You can manage the thermal support through the kernel configuration option:

  • Temperature sensor driver for Freescale i.MX8MM SoC (CONFIG_IMX8MM_THERMAL)

This option is enabled as built-in on the default ConnectCore 8M Mini kernel configuration file.

Kernel driver

File Description

drivers/thermal/imx8mm_thermal.c

Thermal driver

Device tree bindings and customization

The i.MX8M Mini thermal device tree binding is documented at Documentation/devicetree/bindings/thermal/imx8mm-thermal.txt

Definition of the thermal monitor unit

i.MX8M Mini device tree
	tmu: tmu@30260000 {
		compatible = "fsl,imx8mm-tmu";
		reg = <0x30260000 0x10000>;
		clocks = <&clk IMX8MM_CLK_TMU_ROOT>;
		#thermal-sensor-cells = <0>;
	};

Definition of the trip points and cooling devices

i.MX8M Mini device tree
	thermal-zones {
		cpu-thermal {
			polling-delay-passive = <250>;
			polling-delay = <2000>;
			thermal-sensors = <&tmu>;
			trips {
				cpu_alert0: trip0 {
					temperature = <85000>;
					hysteresis = <2000>;
					type = "passive";
				};

				cpu_crit0: trip1 {
					temperature = <100000>;
					hysteresis = <2000>;
					type = "critical";
				};
			};

			cooling-maps {
				map0 {
					trip = <&cpu_alert0>;
					cooling-device =
						<&A53_0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
						<&A53_1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
						<&A53_2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
						<&A53_3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
				};
			};
		};
	};

Usage

CPU temperature

To check the current temperature of the CPU:

~# cat /sys/class/thermal/thermal_zone0/temp
32000

The command returns the temperature in millicelsius.

Trip points

A trip point describes a point in the temperature domain at which the system takes an action. This node describes just the point, not the action.

The Linux thermal subsystem establishes several types of trip points:

  • passive: a trip point to enable passive cooling (such as decreasing clock frequency).

  • active: a trip point to enable active cooling (such as activating fans).

  • hot: a trip point to indicate that an emergency temperature threshold has been reached.

  • critical: a trip point where hardware is at risk.

The device tree defines two trip points:

Trip point type Temperature

Passive

85 °C

Critical

100 °C

The maximum temperature supported by the chip, depends on the thermal grade of the SOC:

  • Commercial: 95 °C

  • Industrial: 105 °C

Check the thermal grade of your SOC at the U-Boot banner during boot.

Passive trip point

When the temperature in the SOC reaches the passive trip point temperature, the SOC generates an interrupt and the driver sends a notification. Other drivers may subscribe to such notifications in order to trigger cooling actions, such as reducing their clock frequency.

On the current BSP, the GPU driver subscribes to the temperature monitor to lower the GPU frequency when the passive trip point is reached. Expect a performance impact on graphical applications when this happens.

Besides subscriptions, devices declared on the device tree as cooling devices and linked to this trip point will take passive actions. This is the case of the Cortex-A53 cores, which reduce their frequency when they reach the passive trip point.

The device tree defines a hysteresis of 2 °C for the passive trip point. This means that only when the die temperature has gone 2 °C below the passive trip point, the system is considered within normal parameters and the cooling actions can be cancelled.

To read the passive trip point parameters:

~# cat /sys/class/thermal/thermal_zone0/trip_point_0_type
passive
~# cat /sys/class/thermal/thermal_zone0/trip_point_0_hyst
2000
~# cat /sys/class/thermal/thermal_zone0/trip_point_0_temp
85000

To set a different temperature for the passive trip point, write the new temperature (in millicelsius) to the trip point temperature descriptor:

~# echo 65000 > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Critical trip point

When the SOC temperature reaches the critical trip point temperature, the SOC generates an interrupt and the driver shuts down the system to prevent damage to the silicon.

To read the critical trip point parameters:

~# cat /sys/class/thermal/thermal_zone0/trip_point_1_type
critical
~# cat /sys/class/thermal/thermal_zone0/trip_point_1_hyst
2000
~# cat /sys/class/thermal/thermal_zone0/trip_point_1_temp
100000

To set a different temperature for the critical trip point, write the new temperature (in millicelsius) to the trip point temperature descriptor:

~# echo 90000 > /sys/class/thermal/thermal_zone0/trip_point_1_temperature