[BPI-R64]Only 10% cpu speed at already 48 degrees celcius, speed not increasing anymore

Could you test if settings without fan (mt7622.dtsi only) work for you?

I guess this is the best way getting upstream

I tried this:

	thermal-zones {
		cpu_thermal: cpu-thermal {
			polling-delay-passive = <1000>;
			polling-delay = <1000>;

			thermal-sensors = <&thermal 0>;

			trips {
				cpu_passive: cpu-passive {
					temperature = <70000>;
					hysteresis = <2000>;
					type = "passive";
				};

				cpu_active: cpu-active {
					temperature = <60000>;
					hysteresis = <2000>;
					type = "active";
				};

				cpu_hot: cpu-hot {
					temperature = <87000>;
					hysteresis = <2000>;
					type = "hot";
				};

				cpu-crit {
					temperature = <107000>;
					hysteresis = <2000>;
					type = "critical";
				};
			};

			cooling-maps {
				map0 {
					trip = <&cpu_passive>;
					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
				};

				map1 {
					trip = <&cpu_active>;
					cooling-device = <&cpu0 0 0>,
							 <&cpu1 0 0>;
				};

				map2 {
					trip = <&cpu_hot>;
					cooling-device = <&cpu0 0 0>,
							 <&cpu1 0 0>;
				};
			};
		};
	};

Passive trip higher then active trip in degrees. It works, temperature is regulated at 70 degrees with frequency throttling.

I however do not understand 70, 75 or even 80 degrees. The ;maximum junction temperature is 125 degrees. I cannot find documentation, but this should be the temperature where the soc itself is starting it’s throttling to protect itself. Staying 35 degrees below this 125 degrrees Celcius should really be safe.

It would be such a waist if this nice soc is limited in performance in mainline kernel, because there is a hunch that 75 degrees is a nice temperature to regulate. Before the patch the soc is limited by a bug, and after it is limited by a hunch… Not much improvement…

I tried bpi support contact email, if they know the correct temperature, but no reply yet.

1 Like

here you disable trottling for active and hot thermal zones, thats why only at passive it is trottled…

have you tried my approach (i’m waiting for a fan to test, but it should work without too)?

I don’t have a fan either… but it should work

added fan to my board, but it is on at bootup…afair there was a problem i always have +5v on fan-port (remember that i see this on testing pwm)

@sinovoip, have you an idea why i always get 5V on FAN-port? in documentation this should be connected to pwm3 (2)

so what will be the best trotteling-setting without disabling any trip?

Do you know any per-cpu value for reading temp and freq?

i wonder why my r2 is not throttled…

echo "TEMP:" $(cat /sys/class/thermal/thermal_zone0/temp) "   FREQ:" $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq)
TEMP: 52713    FREQ: 1040000

so also over the passive trip (47 degrees, and all cpus are defined as cooling device)

mt7623n-bananapi-bpi-r2.dts does not contain any overrides for thermal-zones/cooling-devices

while comparing defconfigs, i guess on r2 i miss

CONFIG_CPU_THERMAL=y

if i enable this, i have same on r2…trottling down on 47 degrees Celsius

root@bpi-r2:~# echo "TEMP:" $(cat /sys/class/thermal/thermal_zone0/temp) "   FREQ:" $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq)
TEMP: 47085    FREQ: 598000
root@bpi-r2:~# echo "TEMP:" $(cat /sys/class/thermal/thermal_zone0/temp) "   FREQ:" $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq)
TEMP: 47085    FREQ: 97999
root@bpi-r2:~#

Posted patch to increase passive trip to 57 degrees

https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

I was about to suggest checking kernel config, seems you found it already.

Too bad we did not hear anything from Mediatek or Bananapi as to which temperature to set these values to .

I have run my mt7622 on 88 degrees for several hours, build a kernel 5 or 6 times now. All builds successful, no problems at this temperature encountered yet…

This issue is reported to openwrt too (for mt7623):

I originally had thought that we could swap the first two trip point types and solve the problem, but looking more closely at the dtsi file I see that the first three trip points (passive, active, and hot) all refer to identical cooling maps which have unlimited CPU scaling as their only recourse.

I now believe the only real solution is to simply delete the first two trip points and cooling maps. There was some discussion of this earlier, I see, and I think it was hoped that Mediatek would weigh in on this issue. I don’t think we should wait. I have proposed a patch on the OpenWrt tracker for the MT7623 boards, and I think the same patch should be proposed upstream.

I considered trying to get fancy and have the first two trip points just be limited in the amount they scale, but the reality is, that neither 47°C or even 67°C are dangerous temperatures, so there is no need to even begin CPU throttling until 87°C. Since the kernel will throttle the CPU speed all the way down to 98MHz if the temperature goes even a degree about the trip point, I believe this is an appropriate trip point.

Maybe a fan can be used in first 2 trips,but my tests with fan on r64 showing that fan was no real pwm…i have only on and off,did not know why as the mapping to pwm was right

Hi guys

can you tell me why i have not file /sys/class/thermal/thermal_zone0/temp ?

root@bpi-r64:/# cat /sys/class/thermal/thermal_zone0/temp
cat: /sys/class/thermal/thermal_zone0/temp: No such file or directory

maybe some kind of kernel module is needed ?

Imho r64 uses

CONFIG_MEDIATEK_MT6577_AUXADC

Which is set in my defconfig in branch 6.6-main

And these common options are needed:

CONFIG_HWMON=y
CONFIG_THERMAL_HWMON=y

Could you check if all 3 are selected in your kernel? tried importing defconfig and all are set…maybe anything in bootlog (dmesg)?

maybe MTK_SOC_THERMAL and/or MTK_THERMAL are needed…

first was introduced in 6.3, so if 6.1 was working and 6.6 not this may because of this

https://cateee.net/lkddb/web-lkddb/MTK_SOC_THERMAL.html

seems i found cause…

fad399ebdd67 thermal/drivers/mediatek: Relocate driver to mediatek folder

moves MTK_THERMAL into the new directory/Kconfig and drops the “default y”

so please try to enable both options above

CONFIG_MTK_THERMAL=y
CONFIG_MTK_SOC_THERMAL=y

and then build/try again

1 Like

yes, its not enabled

image

i`ll try recompile

thank you Frank

Thanks, I also needed to add this again…

i have done as you advised, and driver not loaded. There is no thermal_zone0

root@bpi-r64:/# dmesg | grep -i thermal
[    0.014084] thermal_sys: Registered thermal governor 'fair_share'
[    0.014088] thermal_sys: Registered thermal governor 'bang_bang'
[    0.014092] thermal_sys: Registered thermal governor 'step_wise'
[    0.014096] thermal_sys: Registered thermal governor 'user_space'
[   23.779316] platform 1100b000.thermal: deferred probe pending
root@bpi-r64:/# 
root@bpi-r64:/# lsmod | grep -e 'thermal\|aux'
root@bpi-r64:/# 
root@bpi-r64:/# ls /sys/class/thermal/
cooling_device0
root@bpi-r64:/# 

NVMEM_MTK_EFUSE seems to be missing too…looks like it is renamed

CONFIG_MTK_EFUSE=y to CONFIG_NVMEM_MTK_EFUSE=y

since 6.1 Linux Kernel Driver DataBase: CONFIG_NVMEM_MTK_EFUSE: Mediatek SoCs EFUSE support

by commit

28fc7c986f01 2022-09-16 nvmem: prefix all symbols with NVMEM_

there is no the config line, at all

# CONFIG_NVMEM_MTK_EFUSE is not set

does this need to be enabled?

yes, this also needs to be added / replacing the old option as i’ve wrote above

root@bpi-r64:~# cat /sys/class/thermal/thermal_zone0/temp                                                                                 
41800

upload fixes to 6.6-main branch and updated 6.1-6.8

@dangowrt do you need this fix too (CONFIG_NVMEM_MTK_EFUSE) for r64/mt7622 and r2/mt7623 after switching to 6.1? the other was 6.3+ so it should not affect opwnwrt

@Krantic a bit more information how i found this out:

  • you’ve shown this error: platform 1100b000.thermal: deferred probe pending, that means that a depency is not filled…
  • looking in dts https://github.com/frank-w/BPI-Router-Linux/blob/6.6-main/arch/arm64/boot/dts/mediatek/mt7622.dtsi#L509 you see depency on pericfg, apmixedsys and thermal_calibration
  • as pericfg does manage all peripheral clocks and other systems work, it should be ok
  • thermal_calibration is subnode of the efuse which was likely the first thing i look :slight_smile:
  • have not looked on apmixedsys, but this would be next part if it was not fixed (searching compatible e.g. with grep -Rni 'compatible' drivers, then makefile in same folder of driver-file to get the corresponding CONFIG option)

Hi guys

it all worked

but now i have another problem

works very slowly

root@bpi-r64:/shara/R64# ./loopt.sh
TEMP: 59900   FREQ: 119999
TEMP: 60300   FREQ: 119999
TEMP: 60200   FREQ: 119999
TEMP: 60200   FREQ: 119999
TEMP: 59900   FREQ: 119999
TEMP: 60200   FREQ: 119999
TEMP: 60000   FREQ: 119999

how to increase the processor frequency and keep it around 1,000,000 ?

Raise temp lower thermalzone in dts. When this temp is arrived cpu will be trottled.

Had done this way in 6.1-main: arm64: dts: mediatek: update thermal trips · frank-w/BPI-Router-Linux@674a164 · GitHub