[IMX8MP] not able to read Thermal_zone0 temperature

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[IMX8MP] not able to read Thermal_zone0 temperature

2,672 Views
sneha_mohan
Contributor I

Hello,

I am working on a project based on IMX8MP board having Linux 5.10.72 and while I tried to read the thermal_zone0 temperature I am getting the below error

#cat /sys/devices/virtual/thermal/thermal_zone0/temp
cat: /sys/devices/virtual/thermal/thermal_zone0/temp: Invalid argument

From the kernel dmesg logs, I found the below failure logs

# dmesg | grep -i thermal
[ 0.048602] thermal_sys: Registered thermal governor 'step_wise'
[ 0.048606] thermal_sys: Registered thermal governor 'power_allocator'
[ 0.048847] OF: /thermal-zones/soc-thermal/cooling-maps/map0: could not find phandle
[ 0.048855] thermal_sys: Add a cooling_device property with at least one device
[ 0.048862] thermal_sys: failed to build thermal zone soc-thermal: -2
[ 1.686503] i.mx8mm_thermal 30260000.tmu: failed to register thermal zone sensor[1]: 0
[ 2.669281] i.mx8mm_thermal 30260000.tmu: failed to register thermal zone sensor[1]: 0

I have included the imx8mp.dtsi in my main dts file .This dtsi file already has thermal zone support for cpu-thermal and soc-thermal (attached the imp8mp.dtsi in this ticket). In both of these thermal zones, cooling maps and associated phandles are defined.

thermal-zones {
cpu-thermal {
polling-delay-passive = <250>;
polling-delay = <2000>;
thermal-sensors = <&tmu 0>;
trips {
cpu_alert0: trip0 {
temperature = <85000>;
hysteresis = <2000>;
type = "passive";
};

cpu_crit0: trip1 {
temperature = <95000>;
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>;
};
};
};
soc-thermal {
polling-delay-passive = <250>;
polling-delay = <2000>;
thermal-sensors = <&tmu 1>;
trips {
soc_alert0: trip0 {
temperature = <85000>;
hysteresis = <2000>;
type = "passive";
};

soc_crit0: trip1 {
temperature = <95000>;
hysteresis = <2000>;
type = "critical";
};
};

cooling-maps {
map0 {
trip = <&soc_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>;
};
};
};
};


Why am I getting the above error even though phandles for cooling-devices in cpu-thermal and soc-thermal are already defined? Could someone please support me here?

Labels (1)
0 Kudos
Reply
4 Replies

2,422 Views
willfrazer
Contributor I

I am working with @sneha_mohan on this project. I wanted to report that we see the issue on more than 1 unit.

Also, we can boot the EVK image on our hardware and while the thermal zone works on the EVK hardware, the exact same software image does not work on our hardware. 

Any suggestions as to why this might happen? i.e. is there an impact to the function of the thermal zone based on how the CPU mux pins may be wired?

thanks Will 

0 Kudos
Reply

2,618 Views
sneha_mohan
Contributor I

Hello Dhruvit,

Thanks for the update. But I can see that in the imx8mp.dtsi, the cooling device and associated properties are already included for the phandles A53_0, A53_1, A53_2 and A53_3. Do I need to add the cooling device and properties in the main dts explicitly?My implementation is similar to imx-8mp-evk.dts where imx8mp.dtsi is included.

cpus {
#address-cells = <1>;
#size-cells = <0>;

idle-states {
entry-method = "psci";

cpu_pd_wait: cpu-pd-wait {
compatible = "arm,idle-state";
arm,psci-suspend-param = <0x0010033>;
local-timer-stop;
entry-latency-us = <1000>;
exit-latency-us = <700>;
min-residency-us = <2700>;
wakeup-latency-us = <1500>;
};
};

A53_0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a53";
reg = <0x0>;
clock-latency = <61036>;
clocks = <&clk IMX8MP_CLK_ARM>;
operating-points-v2 = <&a53_opp_table>;
nvmem-cells = <&cpu_speed_grade>;
nvmem-cell-names = "speed_grade";
enable-method = "psci";
next-level-cache = <&A53_L2>;
#cooling-cells = <2>;
cpu-idle-states = <&cpu_pd_wait>;
};

A53_1: cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a53";
reg = <0x1>;
clock-latency = <61036>;
clocks = <&clk IMX8MP_CLK_ARM>;
operating-points-v2 = <&a53_opp_table>;
enable-method = "psci";
next-level-cache = <&A53_L2>;
#cooling-cells = <2>;
cpu-idle-states = <&cpu_pd_wait>;

Thanks and Regards

Sneha 

0 Kudos
Reply

2,586 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @sneha_mohan,

I hope you are doing well.

A function that may cause this error is of_parse_thermal_zones - parse device tree thermal data.
->Initialization function that can be called by machine initialization code to parse thermal data and populate the thermal framework with hardware thermal zones info.

Function thermal_of_build_thermal_zone - parse and fill one thermal zone data
This function will also tell that if any of the properties are missing like the polling-delay-passive property or polling-delay property it will throw such an error, please look into it, it will help you resolve the issue.
If any of the properties is missing to be mentioned then this function will return the value -1 to tz variable that led to this error occurring.

Please make sure that below kernel configurations are enabled. 

CONFIG_THERMAL=y

CONFIG_CPU_THERMAL=y

CONFIG_IMX8M_THERMAL=y


Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply

2,640 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @sneha_mohan,

I hope you are doing well.

[ 0.048855] thermal_sys: Add a cooling_device property with at least one device
->This line says that you have linked 4 cooling devices to the A53 core and added a cooling-device property to any one device out of these four.

->I have shared a few pieces of information for the same, please take a look at it.
cooling devices: devices that may be used to dissipate heat.
Required properties -> polling-delay, polling-delay-passive, thermal-sensors, trips, cooling-maps.
Please make sure to add these properties.

Please refer to this file for more information o the required properties that should be set for the cooling device.
<linux_source_code>/Documentation/devicetree/bindings/thermal/thermal-cooling-devices.yaml

I hope this information helps!

Thanks & Regards,
Dhruvit Vasavada

0 Kudos
Reply