Jump to content

[Armbian build PR] - Sunxi 6.1 / 6.2: h616 (OrangePi Zero 2): Fix thermal zones (add missing trips)


RSS Bot

Recommended Posts

Description

These patches fix an issue present on newer Kernels (6.1+, no idea if older kernels are affected as well), where the thermal sensors are unavailable (/sys/class/thermal is empty). By applying these patches, thermal sensors are available to use.

The problem seems to be related by how Linux thermal driver drivers/thermal/thermal_of.c handles thermal zones without trips defined - if it doesn't exist, throw an error. I'm not Linux expert, but it looks like 6.1 brought some thermal driver refactoring, which might have caused this behavior.

Before the patches, with logging verbosity set to 7, there's also an error present in boot log related to the sensor's init process: https://paste.armbian.com/awikixucez

...
[    1.255888] thermal_sys: Failed to find 'trips' node
[    1.255901] thermal_sys: Failed to find trip points for thermal-sensor id=0
[    1.255916] sun8i-thermal 5070400.thermal-sensor: Failed to register sensor 0 (-EINVAL)
[    1.255925] sun8i-thermal: probe of 5070400.thermal-sensor failed with error -22
...

With the patches applied, the errors are no longer present: (sunxi-6.1 log): https://paste.armbian.com/jomezorune (sunxi-6.2 log): https://paste.armbian.com/kutozasuji

Changes

  • Added one trip to each thermal zone with missing trips (GPU, DDR & VE).
    • Added critical trip point, set to 110C, corresponding to the recommended Tj max, as per H616 documentation (found here: https://linux-sunxi.org/H616)
  • For completeness, added new critical trip point for CPU thermal zone, similar to trips mentioned above

How Has This Been Tested?

Both kernel versions have been compiled before and after applying patches and tested like this:

  1. Check if the board boots up
  2. Proceed with minimal initial setup
  3. Be logged in as root
  4. Check if sensors are available by using the following command:
ls /sys/class/thermal/
  • Expected result: there are 4 directories present in the output
  • Actual result (before patch): output is empty
  1. Check if sensors provide meaningful temperatures by using the following commands:
cat /sys/class/thermal/thermal_zone0/temp
cat /sys/class/thermal/thermal_zone1/temp
cat /sys/class/thermal/thermal_zone2/temp
cat /sys/class/thermal/thermal_zone3/temp
  • Expected results: each sensor readout outputs sensible temperature (in my case, ~50 C)
  • Actual result (before patch): no output, commands fail

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [ ] Any dependent changes have been merged and published in downstream modules

View the full article

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines