Skip to contentSkip to conversation

Fix mt7622.dtsi thermal cpu

PATCH In review [email protected] 4 participants 19 messages Jun 19, 2021 – Jun 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix mt7622.dtsi thermal cpu

From: Eric Woudstra <[email protected]>

Cpu-thermal is set to use all frequencies already at 47 degrees. Using the CPU at 50 for a minute, the CPU has reached 48 degrees, is throttled back to lowest setting, making the mt7622 terrribly slow. Even at this low speed, the CPU does not cool down lower then 47 so the CPU is stuck at lowest possible frequency until it shut down and stays off for 15 minutes.

cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,

                 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;

This should not be set al every cooling map. It should only be set at the highest cooling map. Same as in the example:

https://www.kernel.org/doc/Documentation/devicetree/bindings/
thermal/thermal.txt line 272

But then without the fan and added a third map.

Now temperature will be regulated at 87 degrees celcius. At temperatures lower then 87, all frequencies can be used.

Also see the post:

http://forum.banana-pi.org/t/bpi-r64-only-10-cpu-speed-at-already-48-
degrees-celcius-speed-not-increasing-anymore/12262

---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt7622.dtsi +4 -4
index 890a942ec..b779c7aa6 100644
@@ -170,14 +170,14 @@ cpu-crit {
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};
 
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};
 
 				map2 {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · On 19/06/2021 14:19, [email protected] wrote:

From: Eric Woudstra <[email protected]>

Cpu-thermal is set to use all frequencies already at 47 degrees. Using the CPU at 50 for a minute, the CPU has reached 48 degrees, is throttled back to lowest setting, making the mt7622 terrribly slow. Even at this low speed, the CPU does not cool down lower then 47 so the CPU is stuck at lowest possible frequency until it shut down and stays off for 15 minutes.

cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,

                 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;

This should not be set al every cooling map. It should only be set at the highest cooling map. Same as in the example:

Quoted 7 lines

https://www.kernel.org/doc/Documentation/devicetree/bindings/
thermal/thermal.txt line 272

But then without the fan and added a third map.

Now temperature will be regulated at 87 degrees celcius. At temperatures lower then 87, all frequencies can be used.

47°C is really a too low temperature and this performance drop is normal.

I would not remove the passive mitigation but try by increasing the CPU temp to 70°C and by changing the active trip point to 80°C. If it works fine, try 75°C and 85°C.

To test, the thermal killer is dhrystone (one thread per cpu).

With a 75°C passive trip point, the step wise thermal governor, I think the mitigation will happen smoothly providing better performances, and probably the fan won't fire.

Quoted 34 lines

Also see the post:

http://forum.banana-pi.org/t/bpi-r64-only-10-cpu-speed-at-already-48-
degrees-celcius-speed-not-increasing-anymore/12262

---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt7622.dtsi +4 -4
index 890a942ec..b779c7aa6 100644
@@ -170,14 +170,14 @@ cpu-crit {
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};
 
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};
 
 				map2 {
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#2 lore raw

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached. It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

There is no fan... On the bpi r64.

Anyway without throttling at all a kernel build for more then an hour temperature creeps up to 85 degrees.

⁣Get BlueMail for Android ​

Quoted 81 lines · Daniel Lezcano
Quoted 15 lines · On 19/06/2021 14:19, [email protected] wrote:

From: Eric Woudstra <[email protected]>

Cpu-thermal is set to use all frequencies already at 47 degrees. Using the CPU at 50 for a minute, the CPU has reached 48 degrees, is throttled back to lowest setting, making the mt7622 terrribly slow. Even at this low speed, the CPU does not cool down lower then 47 so the CPU is stuck at lowest possible frequency until it shut down and stays off for 15 minutes.

cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,

                 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;

This should not be set al every cooling map. It should only be set at the highest cooling map. Same as in the example:

Quoted 6 lines

https://www.kernel.org/doc/Documentation/devicetree/bindings/
thermal/thermal.txt line 272

But then without the fan and added a third map.

Now temperature will be regulated at 87 degrees celcius. At

temperatures

Quoted 1 line

lower then 87, all frequencies can be used.

47°C is really a too low temperature and this performance drop is normal.

I would not remove the passive mitigation but try by increasing the CPU temp to 70°C and by changing the active trip point to 80°C. If it works fine, try 75°C and 85°C.

To test, the thermal killer is dhrystone (one thread per cpu).

With a 75°C passive trip point, the step wise thermal governor, I think the mitigation will happen smoothly providing better performances, and probably the fan won't fire.

Review

Quoted 11 lines

Also see the post:

http://forum.banana-pi.org/t/bpi-r64-only-10-cpu-speed-at-already-48-
degrees-celcius-speed-not-increasing-anymore/12262

---
 arch/arm64/boot/dts/mediatek/mt7622.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi

Quoted 13 lines

index 890a942ec..b779c7aa6 100644

arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
@@ -170,14 +170,14 @@ cpu-crit {
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 183

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
 
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&cpu0 0 0>,
+							 <&cpu1 0 0>;
 				};
 
 				map2 {

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

#3 lore raw
Quoted 7 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
index 890a942ec608..88c81d24f4ff 100644

arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -20
@@ -136,24 +136,18 @@ secmon_reserved: secmon@43000000 {
 
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
-			polling-delay-passive = <1000>;
+			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
 			thermal-sensors = <&thermal 0>;
 
 			trips {
 				cpu_passive: cpu-passive {
-					temperature = <47000>;
+					temperature = <77000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
 
-				cpu_active: cpu-active {
-					temperature = <67000>;
-					hysteresis = <2000>;
-					type = "active";
-				};
-
 				cpu_hot: cpu-hot {
 					temperature = <87000>;
 					hysteresis = <2000>;
@@ -173,18 +167,6 @@ map0 {
 					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
 							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
-
-				map1 {
-					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-
-				map2 {
-					trip = <&cpu_hot>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
 			};
 		};
 	};
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#4 lore raw

I choose "hot" before, because 87 degrees seems ok to start frequency throttling. But, yes, it should be passive.

87 is still quite low if I compare this temperature with the wrt3200acm Marvell dual core arm soc. They even went above 100 degrees so I feel for an arm processor inside a router box it is fine to use 87 degrees But maybe someone at Mediatek can give some more details about operating temperatures.

It may be possible to leave the active map in the device tree as some users of the bananapi might choose to install a fan as it is one of the options.

⁣Get BlueMail for Android ​

Quoted 95 lines · Daniel Lezcano
Quoted 7 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same
cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -21
index 890a942ec608..88c81d24f4ff 100644
@@ -136,24 +136,18 @@ secmon_reserved: secmon@43000000 {
 
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
-			polling-delay-passive = <1000>;
+			polling-delay-passive = <250>;
 			polling-delay = <1000>;
 
 			thermal-sensors = <&thermal 0>;
 
 			trips {
 				cpu_passive: cpu-passive {
-					temperature = <47000>;
+					temperature = <77000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
 
-				cpu_active: cpu-active {
-					temperature = <67000>;
-					hysteresis = <2000>;
-					type = "active";
-				};
-
 				cpu_hot: cpu-hot {
 					temperature = <87000>;
 					hysteresis = <2000>;
@@ -173,18 +167,6 @@ map0 {
 					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
 							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
-
-				map1 {
-					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
-
-				map2 {
-					trip = <&cpu_hot>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-				};
 			};
 		};
 	};
 
 
--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

#5 lore raw
Quoted 9 lines · Eric Woudstra

I choose "hot" before, because 87 degrees seems ok to start frequency throttling. But, yes, it should be passive.

87 is still quite low if I compare this temperature with the wrt3200acm Marvell dual core arm soc. They even went above 100 degrees so I feel for an arm processor inside a router box it is fine to use 87 degrees But maybe someone at Mediatek can give some more details about operating temperatures.

Sometimes, the SoC vendor puts a high temperature in the DT just to export the thermal zone and deal with it from userspace. So putting the high temp allow the userspace (usually a thermal engine - Android stuff) to deal with the mitigation without a kernel interaction.

Having more than 100°C could be this kind of setup. Only the operating temperature from the hardware documentation will tell the safe temperature for the silicon.

IMO, 77°C is a good compromise until getting the documented temp. 87°C sounds to me a bit too hot.

Quoted 3 lines

It may be possible to leave the active map in the device tree as some users of the bananapi might choose to install a fan as it is one of the options.

The active trip only makes sense if the cooling device is a fan (or any active device), so the mapping points to a fan node, like:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi#n192

If there is no such [pwm] fan output on the board, no active trip point should be added.

Quoted 76 lines

⁣Get BlueMail for Android ​

Quoted 71 lines · Daniel Lezcano
Quoted 8 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 890a942ec608..88c81d24f4ff 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -136,24 +136,18 @@
secmon_reserved: secmon@43000000 {

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

thermal-sensors = <&thermal 0>;

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

(quoted diff) +0 -1
-				cpu_active: cpu-active { -					temperature = <67000>; -

hysteresis = <2000>; - type = "active"; - }; - cpu_hot:
cpu-hot { temperature = <87000>; hysteresis = <2000>; @@ -173,18 +167,6 @@ map0 { cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; -

(quoted diff) +0 -1
-				map1 { -					trip = <&cpu_active>; -					cooling-device =

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

-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#6 lore raw

For Marvell:

https://www.google.com/url?sa=t&source=web&rct=j&url=https://wiki.kobol.io/helios4/files/som/brochure_a38x_microsom_2017-09-05.pdf

Armada38x maximum die temperature 115 degrees Celcius. They really get hotter then 100.

But for mt7622 I cannot find this value

⁣Get BlueMail for Android ​

Quoted 120 lines · Daniel Lezcano
Quoted 9 lines · Eric Woudstra

I choose "hot" before, because 87 degrees seems ok to start frequency throttling. But, yes, it should be passive.

87 is still quite low if I compare this temperature with the wrt3200acm Marvell dual core arm soc. They even went above 100 degrees so I feel for an arm processor inside a router box it is fine to use 87 degrees But maybe someone at Mediatek can give some more details about operating temperatures.

Sometimes, the SoC vendor puts a high temperature in the DT just to export the thermal zone and deal with it from userspace. So putting the high temp allow the userspace (usually a thermal engine - Android stuff)
to deal with the mitigation without a kernel interaction.

Having more than 100°C could be this kind of setup. Only the operating temperature from the hardware documentation will tell the safe temperature for the silicon.

IMO, 77°C is a good compromise until getting the documented temp. 87°C sounds to me a bit too hot.

Quoted 3 lines

It may be possible to leave the active map in the device tree as some users of the bananapi might choose to install a fan as it is one of the options.

The active trip only makes sense if the cooling device is a fan (or any active device), so the mapping points to a fan node, like:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi#n192

If there is no such [pwm] fan output on the board, no active trip point should be added.

Quoted 69 lines

⁣Get BlueMail for Android ​

Quoted 65 lines · Daniel Lezcano
Quoted 8 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 890a942ec608..88c81d24f4ff 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -136,24 +136,18 @@
secmon_reserved: secmon@43000000 {

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

thermal-sensors = <&thermal 0>;

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

(quoted diff) +0 -1
-				cpu_active: cpu-active { -					temperature = <67000>; -

hysteresis = <2000>; - type = "active"; - }; - cpu_hot:
cpu-hot { temperature = <87000>; hysteresis = <2000>; @@ -173,18 +167,6 @@ map0 { cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; -

(quoted diff) +0 -1
-				map1 { -					trip = <&cpu_active>; -					cooling-device =

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

Quoted 7 lines
Quoted 6 lines

-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

#7 lore raw
Quoted 8 lines · Eric Woudstra

For Marvell:

https://www.google.com/url?sa=t&source=web&rct=j&url=https://wiki.kobol.io/helios4/files/som/brochure_a38x_microsom_2017-09-05.pdf

Armada38x maximum die temperature 115 degrees Celcius. They really get hotter then 100.

But for mt7622 I cannot find this value

Found that:

https://download.kamami.pl/p579344-MT7622A_Datasheet_for_BananaPi_Only%281%29.pdf

Chapter 3.3 - Thermal Characteristics

Given the values I suggest:

- Passive - 80°C

- Hot - 90°C

- Critical - 100°C

And passive polling set to 250ms.

It sounds like the sensor is not supporting the interrupt mode yet, so a big gap is needed with the Tj IMO to give the time to detect the trip point crossing with the polling.

Quoted 124 lines

⁣Get BlueMail for Android ​

Quoted 120 lines · Daniel Lezcano
Quoted 9 lines · Eric Woudstra

I choose "hot" before, because 87 degrees seems ok to start frequency throttling. But, yes, it should be passive.

87 is still quite low if I compare this temperature with the wrt3200acm Marvell dual core arm soc. They even went above 100 degrees so I feel for an arm processor inside a router box it is fine to use 87 degrees But maybe someone at Mediatek can give some more details about operating temperatures.

Sometimes, the SoC vendor puts a high temperature in the DT just to export the thermal zone and deal with it from userspace. So putting the high temp allow the userspace (usually a thermal engine - Android stuff)
to deal with the mitigation without a kernel interaction.

Having more than 100°C could be this kind of setup. Only the operating temperature from the hardware documentation will tell the safe temperature for the silicon.

IMO, 77°C is a good compromise until getting the documented temp. 87°C sounds to me a bit too hot.

Quoted 3 lines

It may be possible to leave the active map in the device tree as some users of the bananapi might choose to install a fan as it is one of the options.

The active trip only makes sense if the cooling device is a fan (or any active device), so the mapping points to a fan node, like:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi#n192

If there is no such [pwm] fan output on the board, no active trip point should be added.

Quoted 76 lines

⁣Get BlueMail for Android ​

Quoted 71 lines · Daniel Lezcano
Quoted 8 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 890a942ec608..88c81d24f4ff 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -136,24 +136,18 @@
secmon_reserved: secmon@43000000 {

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

thermal-sensors = <&thermal 0>;

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

(quoted diff) +0 -1
-				cpu_active: cpu-active { -					temperature = <67000>; -

hysteresis = <2000>; - type = "active"; - }; - cpu_hot:
cpu-hot { temperature = <87000>; hysteresis = <2000>; @@ -173,18 +167,6 @@ map0 { cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; -

(quoted diff) +0 -1
-				map1 { -					trip = <&cpu_active>; -					cooling-device =

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

-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#8 lore raw

The SOC runs unthrotlled slowly to 80 degrees. This takes minutes. Polling interval 1 second or less does not matter much when looking at these temperature rise times

After that in more then an hour it slowly creeps up to 85. I believe the design is so that the SOC, under normal circumstances, can run at 1.35 GHz without throttling frequency, without heatsink. It just needs a safeguard for different circumstances.

Most of these SOCs can also run in industrial grade circumstances, which means up to 85 degrees ambient temperature already . If not industrial then this would be 60 degrees ambient already

But only someone at Mediatek can confirm this

⁣Get BlueMail for Android ​

Quoted 178 lines · Daniel Lezcano
Quoted 4 lines · Eric Woudstra

For Marvell:

https://www.google.com/url?sa=t&source=web&rct=j&url=https://wiki.kobol.io/helios4/files/som/brochure_a38x_microsom_2017-09-05.pdf

Quoted 2 lines

Armada38x maximum die temperature 115 degrees Celcius. They really

get hotter then 100.

Quoted 2 lines

But for mt7622 I cannot find this value

Found that:

https://download.kamami.pl/p579344-MT7622A_Datasheet_for_BananaPi_Only%281%29.pdf

Chapter 3.3 - Thermal Characteristics

Given the values I suggest:

- Passive - 80°C

- Hot - 90°C

- Critical - 100°C

And passive polling set to 250ms.

It sounds like the sensor is not supporting the interrupt mode yet, so a
big gap is needed with the Tj IMO to give the time to detect the trip point crossing with the polling.

Quoted 3 lines

⁣Get BlueMail for Android ​

On Jun 23, 2021, 10:08 PM, at 10:08 PM, Daniel Lezcano

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines · Eric Woudstra
Quoted 2 lines

I choose "hot" before, because 87 degrees seems ok to start

frequency

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

throttling. But, yes, it should be passive.

87 is still quite low if I compare this temperature with the wrt3200acm Marvell dual core arm soc. They even went above 100 degrees so I feel for an arm processor inside a router box it is

fine

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

to use 87 degrees But maybe someone at Mediatek can give some more details about operating temperatures.

Sometimes, the SoC vendor puts a high temperature in the DT just to export the thermal zone and deal with it from userspace. So putting

the

Quoted 5 lines
Quoted 5 lines

high temp allow the userspace (usually a thermal engine - Android stuff)
to deal with the mitigation without a kernel interaction.

Having more than 100°C could be this kind of setup. Only the

operating

Quoted 4 lines
Quoted 4 lines

temperature from the hardware documentation will tell the safe temperature for the silicon.

IMO, 77°C is a good compromise until getting the documented temp.

87°C

Quoted 3 lines
Quoted 3 lines

sounds to me a bit too hot.

Quoted 1 line

It may be possible to leave the active map in the device tree as

some

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

users of the bananapi might choose to install a fan as it is one of the options.

The active trip only makes sense if the cooling device is a fan (or

any

Quoted 3 lines
Quoted 3 lines

active device), so the mapping points to a fan node, like:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi#n192

Quoted 2 lines
Quoted 2 lines

If there is no such [pwm] fan output on the board, no active trip

point

Quoted 76 lines
Quoted 76 lines

should be added.

Quoted 74 lines

⁣Get BlueMail for Android ​

Quoted 70 lines · Daniel Lezcano
Quoted 8 lines · Eric Woudstra

It is only useful to set 1 map with the regulated temperature for cpu frequency throttling. Same as in the kernel document example.

It has no use to set frequency scaling on 2 different temperature trip points, as the lowest one makes sure the higher one(s) are never reached.

I looked more closely the DT and there is a misunderstanding of the thermal framework in the definition.

There is one trip point with the passive type and the cpu cooling device, followed by a second trip point with the active type *but* the same cpu cooling device. That is wrong.

And finally, there is the hot trip point as a third mapping and the same cooling device.

The hot trip point is only there to notify userspace and let it take an immediate action to prevent an emergency shutdown when reaching the critical temperature.

Quoted 9 lines

It can be applied only at 1 trip point. Multiple trip points is only usefully for fan control to make sure the fan is not too noisy when it is not necessary to be noisy.

The CPU will almost come to a dead stop when it starts to pass the lowest thermal map with frequency throttling.

This is why it is a bug and needs a fix, not only adjustment.

Yes, you are right. It should be something like (verbatim copy):

(quoted diff) +0 -0

b/arch/arm64/boot/dts/mediatek/mt7622.dtsi index 890a942ec608..88c81d24f4ff 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi @@ -136,24 +136,18 @@
secmon_reserved: secmon@43000000 {

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

polling-delay = <1000>;

thermal-sensors = <&thermal 0>;

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

(quoted diff) +0 -1
-				cpu_active: cpu-active { -					temperature = <67000>; -

hysteresis = <2000>; - type = "active"; - }; - cpu_hot:
cpu-hot { temperature = <87000>; hysteresis = <2000>; @@ -173,18 +167,6 @@ map0 { cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; }; -

(quoted diff) +0 -1
-				map1 { -					trip = <&cpu_active>; -					cooling-device =

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

-- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM

SoCs

Quoted 5 lines
Quoted 4 lines

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

#9 lore raw

Hi,

Quoted 9 lines

Gesendet: Donnerstag, 24. Juni 2021 um 15:29 Uhr
Von: "Eric Woudstra" <[email protected]>
The SOC runs unthrotlled slowly to 80 degrees. This takes minutes. Polling interval 1 second or less does not matter much when looking at these temperature rise times

After that in more then an hour it slowly creeps up to 85. I believe the design is so that the SOC, under normal circumstances, can run at 1.35 GHz without throttling frequency, without heatsink. It just needs a safeguard for different circumstances.

Most of these SOCs can also run in industrial grade circumstances, which means up to 85 degrees ambient temperature already . If not industrial then this would be 60 degrees ambient already

But only someone at Mediatek can confirm this

maybe Matthias knows anybody?
get_maintainers-script shows no mtk employee for mtk_thermal driver, added Sean and Ryder as common Linux-Contacts...

Daniel from openwrt have some other mt7622 Boards maybe he can test the Fan approach below

Quoted 7 lines · Daniel Lezcano
Quoted 6 lines

Found that:

https://download.kamami.pl/p579344-MT7622A_Datasheet_for_BananaPi_Only%281%29.pdf

Chapter 3.3 - Thermal Characteristics

Quoted 7 lines
Quoted 7 lines

Given the values I suggest:

- Passive - 80°C

- Hot - 90°C

- Critical - 100°C

maybe adding FAN (r64, don't know for other mt7622 boards) for lower 2 trips (with adjusted temperature points) and cpu-throtteling for upper 2 trips

something like this (used the 70/80 trip points discussed before):

arch/arm64/boot/dts/mediatek/mt7622.dtsi +12 -6
@@ -134,6 +134,13 @@
 		};
 	};
 
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		pwms = <&pwm 2 10000 0>;
+		cooling-levels = <0 102 170 230>;
+	};
+
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <1000>;
@@ -143,13 +150,13 @@
 
 			trips {
 				cpu_passive: cpu-passive {
-					temperature = <47000>;
+					temperature = <70000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
 
 				cpu_active: cpu-active {
-					temperature = <67000>;
+					temperature = <80000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
 
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
 
 				map2 {
@@ -428,6 +433,7 @@
 	pwm: pwm@11006000 {
 		compatible = "mediatek,mt7622-pwm";
 		reg = <0 0x11006000 0 0x1000>;
+		#pwm-cells = <3>;
 		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&topckgen CLK_TOP_PWM_SEL>,
 			 <&pericfg CLK_PERI_PWM_PD>,

regards Frank

#10 lore raw
Quoted 8 lines · Frank Wunderlich

Hi,

Quoted 6 lines

Gesendet: Donnerstag, 24. Juni 2021 um 15:29 Uhr
Von: "Eric Woudstra" <[email protected]>
The SOC runs unthrotlled slowly to 80 degrees. This takes minutes. Polling interval 1 second or less does not matter much when looking at these temperature rise times

After that in more then an hour it slowly creeps up to 85. I believe the design is so that the SOC, under normal circumstances, can run at 1.35 GHz without throttling frequency, without heatsink. It just needs a safeguard for different circumstances.

Quoted 8 lines
Quoted 3 lines

Most of these SOCs can also run in industrial grade circumstances, which means up to 85 degrees ambient temperature already . If not industrial then this would be 60 degrees ambient already

But only someone at Mediatek can confirm this

maybe Matthias knows anybody?
get_maintainers-script shows no mtk employee for mtk_thermal driver, added Sean and Ryder as common Linux-Contacts...

Daniel from openwrt have some other mt7622 Boards maybe he can test the Fan approach below

I got Linksys E8450 aka. Belkin RT3200 ( https://fcc.io/K7S-03571 ) as well as Ubiquiti UniFi 6 LR ( https://fcc.io/SWX-U6LR ). Both got quite massive customized heatsinks (see internal photos on FCC submission), which results in much better heat dissipation than just having the naked chip like on the BPi-R64.
Hence I also can't test the fan approach on boards other than the R64.

Quoted 80 lines
Quoted 8 lines · Daniel Lezcano
Quoted 6 lines

Found that:

https://download.kamami.pl/p579344-MT7622A_Datasheet_for_BananaPi_Only%281%29.pdf

Chapter 3.3 - Thermal Characteristics

Quoted 7 lines
Quoted 7 lines

Given the values I suggest:

- Passive - 80°C

- Hot - 90°C

- Critical - 100°C

maybe adding FAN (r64, don't know for other mt7622 boards) for lower 2 trips (with adjusted temperature points) and cpu-throtteling for upper 2 trips

something like this (used the 70/80 trip points discussed before):

arch/arm64/boot/dts/mediatek/mt7622.dtsi +12 -6
@@ -134,6 +134,13 @@
 		};
 	};
 
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		pwms = <&pwm 2 10000 0>;
+		cooling-levels = <0 102 170 230>;
+	};
+
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <1000>;
@@ -143,13 +150,13 @@
 
 			trips {
 				cpu_passive: cpu-passive {
-					temperature = <47000>;
+					temperature = <70000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
 
 				cpu_active: cpu-active {
-					temperature = <67000>;
+					temperature = <80000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
 
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
 
 				map2 {
@@ -428,6 +433,7 @@
 	pwm: pwm@11006000 {
 		compatible = "mediatek,mt7622-pwm";
 		reg = <0 0x11006000 0 0x1000>;
+		#pwm-cells = <3>;
 		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&topckgen CLK_TOP_PWM_SEL>,
 			 <&pericfg CLK_PERI_PWM_PD>,

regards Frank

#11 lore raw
Quoted 4 lines

Gesendet: Freitag, 25. Juni 2021 um 11:22 Uhr
Von: "Daniel Golle" <[email protected]>

On Fri, Jun 25, 2021 at 10:16:43AM +0200, Frank Wunderlich wrote:

Quoted 8 lines
Quoted 1 line

Daniel from openwrt have some other mt7622 Boards maybe he can test the Fan approach below

I got Linksys E8450 aka. Belkin RT3200 ( https://fcc.io/K7S-03571 ) as well as Ubiquiti UniFi 6 LR ( https://fcc.io/SWX-U6LR ). Both got quite massive customized heatsinks (see internal photos on FCC submission), which results in much better heat dissipation than just having the naked chip like on the BPi-R64.
Hence I also can't test the fan approach on boards other than the R64.

Do your both mt7622 boards miss the fan-socket or is it not connected to pwm3? then we need to move the fan-parts to mt7622-bananapi-r64.dts instead of mt7622.dtsi

regards Frank

#12 lore raw

Hi Frank,

Quoted 6 lines · Frank Wunderlich
Quoted 6 lines

Gesendet: Freitag, 25. Juni 2021 um 11:22 Uhr
Von: "Daniel Golle" <[email protected]>

Quoted 1 line · Frank Wunderlich

Daniel from openwrt have some other mt7622 Boards maybe he can test the Fan approach below

Quoted 8 lines
Quoted 6 lines

I got Linksys E8450 aka. Belkin RT3200 ( https://fcc.io/K7S-03571 ) as well as Ubiquiti UniFi 6 LR ( https://fcc.io/SWX-U6LR ). Both got quite massive customized heatsinks (see internal photos on FCC submission), which results in much better heat dissipation than just having the naked chip like on the BPi-R64.
Hence I also can't test the fan approach on boards other than the R64.

Do your both mt7622 boards miss the fan-socket or is it not connected to pwm3? then we need to move the fan-parts to mt7622-bananapi-r64.dts instead of mt7622.dtsi

There is no fan intended on both devices.
E8450 has an unknown connector which **could** be for a fan, but I never tried if and how it is actually connected to the SoC. It could as well be an additional USB 2.0 (as it got 4 pins).

Hence I suggest to add the fan on PWM3 for the BPi-R64 only for now.

Cheers

Daniel

#13 lore raw
In reply to Frank Wunderlich

Hi Frank,

Quoted 6 lines · Frank Wunderlich

Hi,

Quoted 3 lines

Gesendet: Donnerstag, 24. Juni 2021 um 15:29 Uhr Von: "Eric Woudstra" <[email protected]> The SOC runs unthrotlled slowly to 80 degrees. This takes minutes.

Polling interval 1 second or less does not matter much when looking at these temperature rise times

Quoted 3 lines
Quoted 3 lines

After that in more then an hour it slowly creeps up to 85. I believe

the design is so that the SOC, under normal circumstances, can run at 1.35 GHz without throttling frequency, without heatsink. It just needs a safeguard for different circumstances.

Quoted 2 lines
Quoted 2 lines

Most of these SOCs can also run in industrial grade circumstances,

which means up to 85 degrees ambient temperature already . If not industrial then this would be 60 degrees ambient already

Quoted 5 lines
Quoted 2 lines

But only someone at Mediatek can confirm this

maybe Matthias knows anybody? get_maintainers-script shows no mtk employee for mtk_thermal driver,

added Sean and Ryder as common Linux-Contacts...

Quoted 2 lines

Daniel from openwrt have some other mt7622 Boards maybe he can test

the Fan approach below

Quoted 2 lines
Quoted 2 lines

On Jun 24, 2021, 12:21 PM, at 12:21 PM, Daniel Lezcano

Quoted 3 lines · <[email protected]> wrote:
Quoted 3 lines
Quoted 3 lines

Found that:

https://download.kamami.pl/p579344-MT7622A_Datasheet_for_BananaPi_Only%281%29.pdf

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Chapter 3.3 - Thermal Characteristics

Given the values I suggest:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

- Passive - 80°C

- Hot - 90°C

- Critical - 100°C

maybe adding FAN (r64, don't know for other mt7622 boards) for lower 2

trips (with adjusted temperature points) and cpu-throtteling for upper 2 trips

It depends what you want to achieve first:

- better / sustained performance, then fan before

- quiet device or power saving (on battery) then cpu throttling before

That is board specific, it should be tuned on DT board specific file.

Some comments below:

arch/arm64/boot/dts/mediatek/mt7622.dtsi

Quoted 3 lines

something like this (used the 70/80 trip points discussed before):

arch/arm64/boot/dts/mediatek/mt7622.dtsi +0 -0

You should not add the fan in the mt7622.dtsi itself but in the board specific file where there is a fan output on it. mt7622.dtsi is supposed to be the SoC itself AFAICT.

For instance:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n39

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n164

Quoted 31 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +9 -2
@@ -134,6 +134,13 @@
 		};
 	};
 
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		pwms = <&pwm 2 10000 0>;
+		cooling-levels = <0 102 170 230>;
+	};
+
 	thermal-zones {
 		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <1000>;
@@ -143,13 +150,13 @@
 
 			trips {
 				cpu_passive: cpu-passive {
-					temperature = <47000>;
+					temperature = <70000>;
 					hysteresis = <2000>;
 					type = "passive";
 				};
 
 				cpu_active: cpu-active {
-					temperature = <67000>;
+					temperature = <80000>;
 					hysteresis = <2000>;
 					type = "active";
 				};

arch/arm64/boot/dts/mediatek/mt7622.dtsi line 181

Quoted 7 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -2
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};

fan == active trip point

This is referring to the passive trip point. So it should point to the CPU as it is now. Note the order of mitigation is inverted regarding the proposal description.

Quoted 20 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
 				map1 {
 					trip = <&cpu_active>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};
 
 				map2 {
@@ -428,6 +433,7 @@
 	pwm: pwm@11006000 {
 		compatible = "mediatek,mt7622-pwm";
 		reg = <0 0x11006000 0 0x1000>;
+		#pwm-cells = <3>;
 		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&topckgen CLK_TOP_PWM_SEL>,
 			 <&pericfg CLK_PERI_PWM_PD>,

regards Frank

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#14 lore raw

Hi

Quoted 24 lines

Gesendet: Freitag, 25. Juni 2021 um 11:57 Uhr
Von: "Daniel Lezcano" <[email protected]>

You should not add the fan in the mt7622.dtsi itself but in the board specific file where there is a fan output on it. mt7622.dtsi is supposed to be the SoC itself AFAICT.

For instance:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n39

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n164

Review line 181

Quoted 8 lines
(quoted diff) +1 -2
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};

fan == active trip point

Quoted 3 lines

This is referring to the passive trip point. So it should point to the CPU as it is now. Note the order of mitigation is inverted regarding the proposal description.

but we need to disable the passive trip as cpu-trotteling starts there...the higher temperature trips are currently not reached

summary

moving fan and cpu_thermal-override to bananapi-r64.dts

passive-trip: cooling-device = <&cpu0/1 0 0> as in erics Patch active trip: cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; the other 2 unchanged

but i suggest changing the temperature points in mt7622 dtsi as this is SoC specific

so basicly:

arch/arm64/boot/dts/mediatek/mt7622.dtsi +5 -4
@@ -143,13 +143,13 @@ cpu_thermal: cpu-thermal {
 
                        trips {
                                cpu_passive: cpu-passive {
-                                       temperature = <47000>;
+                                       temperature = <70000>;
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
                                cpu_active: cpu-active {
-                                       temperature = <67000>;
+                                       temperature = <80000>;
                                        hysteresis = <2000>;
                                        type = "active";
                                };
@@ -170,8 +170,8 @@ cpu-crit {
                        cooling-maps {
                                map0 {
                                        trip = <&cpu_passive>;
-                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       cooling-device = <&cpu0 0 0>,
+                                                        <&cpu1 0 0>;
                                };
 
                                map1 {
@@ -428,6 +428,7 @@ uart3: serial@11005000 {
        pwm: pwm@11006000 {
                compatible = "mediatek,mt7622-pwm";
                reg = <0 0x11006000 0 0x1000>;
+               #pwm-cells = <3>;
                interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
                clocks = <&topckgen CLK_TOP_PWM_SEL>,
                         <&pericfg CLK_PERI_PWM_PD>,
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +16 -0
@@ -37,6 +37,13 @@ cpu@1 {
                };
        };
 
+       fan0: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               pwms = <&pwm 2 10000 0>;
+               cooling-levels = <0 102 170 230>;
+       };
+
        gpio-keys {
                compatible = "gpio-keys";
 
@@ -582,6 +589,29 @@ &u3phy {
        status = "okay";
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map1 {
+                       trip = <&cpu_active>;
+                       cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+               };
+       };
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins>;
#15 lore raw

I choose "hot* with CPU, because it was the best temperature. But it should really be passive only with the cooling device CPU but with a much higher temperature. For me 87 degrees is fine and tested. But for mainline we would better ask Mediatek for the correct maximum temperature.

⁣Get BlueMail for Android ​

Quoted 125 lines · Frank Wunderlich

Hi

Quoted 5 lines

Gesendet: Freitag, 25. Juni 2021 um 11:57 Uhr
Von: "Daniel Lezcano" <[email protected]>

You should not add the fan in the mt7622.dtsi itself but in the board specific file where there is a fan output on it. mt7622.dtsi is

supposed

Quoted 5 lines

to be the SoC itself AFAICT.

For instance:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n39

Quoted 2 lines

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n164

Quoted 11 lines

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 181

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -2
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};

fan == active trip point

Quoted 1 line

This is referring to the passive trip point. So it should point to

the

Quoted 1 line

CPU as it is now. Note the order of mitigation is inverted regarding

the

Quoted 1 line

proposal description.

but we need to disable the passive trip as cpu-trotteling starts there...the higher temperature trips are currently not reached

summary

moving fan and cpu_thermal-override to bananapi-r64.dts

passive-trip: cooling-device = <&cpu0/1 0 0> as in erics Patch active trip: cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
the other 2 unchanged

but i suggest changing the temperature points in mt7622 dtsi as this is SoC specific

so basicly:

arch/arm64/boot/dts/mediatek/mt7622.dtsi +4 -4
@@ -143,13 +143,13 @@ cpu_thermal: cpu-thermal {
 
                       trips {
                               cpu_passive: cpu-passive {
-                                       temperature = <47000>;
+                                       temperature = <70000>;
                                       hysteresis = <2000>;
                                       type = "passive";
                               };
 
                               cpu_active: cpu-active {
-                                       temperature = <67000>;
+                                       temperature = <80000>;
                                       hysteresis = <2000>;
                                       type = "active";
                               };
@@ -170,8 +170,8 @@ cpu-crit {
                       cooling-maps {
                               map0 {
                                       trip = <&cpu_passive>;
-                                       cooling-device = <&cpu0
 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&cpu1
 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       cooling-device = <&cpu0 0 0>,
+                                                        <&cpu1 0 0>;
                               };
                               map1 {
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -0
@@ -428,6 +428,7 @@ uart3: serial@11005000 {
       pwm: pwm@11006000 {
               compatible = "mediatek,mt7622-pwm";
               reg = <0 0x11006000 0 0x1000>;
+               #pwm-cells = <3>;
               interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
               clocks = <&topckgen CLK_TOP_PWM_SEL>,
                        <&pericfg CLK_PERI_PWM_PD>,
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +16 -0
@@ -37,6 +37,13 @@ cpu@1 {
               };
       };
 
+       fan0: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               pwms = <&pwm 2 10000 0>;
+               cooling-levels = <0 102 170 230>;
+       };
+
       gpio-keys {
               compatible = "gpio-keys";
 
@@ -582,6 +589,29 @@ &u3phy {
       status = "okay";
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map1 {
+                       trip = <&cpu_active>;
+                       cooling-device = <&fan0 THERMAL_NO_LIMIT
 THERMAL_NO_LIMIT>;
+               };
+       };
+};
+
 &uart0 {
       pinctrl-names = "default";
       pinctrl-0 = <&uart0_pins>;
#16 lore raw
In reply to Frank Wunderlich
Quoted 26 lines · Frank Wunderlich

Hi

Quoted 24 lines

Gesendet: Freitag, 25. Juni 2021 um 11:57 Uhr
Von: "Daniel Lezcano" <[email protected]>

You should not add the fan in the mt7622.dtsi itself but in the board specific file where there is a fan output on it. mt7622.dtsi is supposed to be the SoC itself AFAICT.

For instance:

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n39

https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi#n164

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 181

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -2
@@ -170,14 +177,12 @@
 			cooling-maps {
 				map0 {
 					trip = <&cpu_passive>;
-					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+					cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
 				};

fan == active trip point

Quoted 5 lines
Quoted 3 lines

This is referring to the passive trip point. So it should point to the CPU as it is now. Note the order of mitigation is inverted regarding the proposal description.

but we need to disable the passive trip as cpu-trotteling starts there...the higher temperature trips are currently not reached

Sorry, can you rephrase it ? I'm not getting the point.

Quoted 15 lines

summary

moving fan and cpu_thermal-override to bananapi-r64.dts

passive-trip: cooling-device = <&cpu0/1 0 0> as in erics Patch active trip: cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; the other 2 unchanged

but i suggest changing the temperature points in mt7622 dtsi as this is SoC specific

so basicly:

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 146

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
@@ -143,13 +143,13 @@ cpu_thermal: cpu-thermal {
 
                        trips {
                                cpu_passive: cpu-passive {
-                                       temperature = <47000>;
+                                       temperature = <70000>;

May be increase the passive temp to 75°C.

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 155

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
                                cpu_active: cpu-active {
-                                       temperature = <67000>;
+                                       temperature = <80000>;
                                        hysteresis = <2000>;
                                        type = "active";
                                };

Move the active trip 'cpu_active' to mt7622-bananapi-bpi-r64.dts. and set it to 70°C in the mt7622-bananapi-bpi-r64.dts, so the fan will act before the cpu throttling.

The behavior should be the following: The temperature reaches 70°C, the fan will start, if the temperature continues to increase, it will increase the speed. If the temperature reaches 75°C, the fan is still rotating at full speed but the cpu begins to be throttled.

AFAIU, it is a Cortex-A53 running @1.35GH, so except the board is in a black metal box under the sun, I don't see how we can reach this thermal limits.

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 174

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
@@ -170,8 +170,8 @@ cpu-crit {
                        cooling-maps {
                                map0 {
                                        trip = <&cpu_passive>;
-                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       cooling-device = <&cpu0 0 0>,
+                                                        <&cpu1 0 0>;

You should keep it untouched.

Quoted 45 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -0
                                };
 
                                map1 {
@@ -428,6 +428,7 @@ uart3: serial@11005000 {
        pwm: pwm@11006000 {
                compatible = "mediatek,mt7622-pwm";
                reg = <0 0x11006000 0 0x1000>;
+               #pwm-cells = <3>;
                interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
                clocks = <&topckgen CLK_TOP_PWM_SEL>,
                         <&pericfg CLK_PERI_PWM_PD>,
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +16 -0
@@ -37,6 +37,13 @@ cpu@1 {
                };
        };
 
+       fan0: pwm-fan {
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               pwms = <&pwm 2 10000 0>;
+               cooling-levels = <0 102 170 230>;
+       };
+
        gpio-keys {
                compatible = "gpio-keys";
 
@@ -582,6 +589,29 @@ &u3phy {
        status = "okay";
 };
 
+&cpu_thermal {
+       cooling-maps {
+               map1 {
+                       trip = <&cpu_active>;
+                       cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+               };
+       };
+};
+
 &uart0 {
        pinctrl-names = "default";
        pinctrl-0 = <&uart0_pins>;
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#17 lore raw
Quoted 6 lines

Gesendet: Freitag, 25. Juni 2021 um 13:47 Uhr
Von: "Daniel Lezcano" <[email protected]>

Quoted 1 line

but we need to disable the passive trip as cpu-trotteling starts there...the higher temperature trips are currently not reached

Sorry, can you rephrase it ? I'm not getting the point.

the problem currently is that passive is at 47degress Celsius and trottles cpu, active (67°C) and hot points are never reached this way. so at least we need to change temperatures in dtsi, and maybe disable cpu-trotteling on passive trip. imho fan will never start if it is in active and cpu is trottled before in passive

Quoted 34 lines
Quoted 15 lines

summary

moving fan and cpu_thermal-override to bananapi-r64.dts

passive-trip: cooling-device = <&cpu0/1 0 0> as in erics Patch active trip: cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; the other 2 unchanged

but i suggest changing the temperature points in mt7622 dtsi as this is SoC specific

so basicly:

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 146

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
@@ -143,13 +143,13 @@ cpu_thermal: cpu-thermal {
 
                        trips {
                                cpu_passive: cpu-passive {
-                                       temperature = <47000>;
+                                       temperature = <70000>;

May be increase the passive temp to 75°C.

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 155

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
                                cpu_active: cpu-active {
-                                       temperature = <67000>;
+                                       temperature = <80000>;
                                        hysteresis = <2000>;
                                        type = "active";
                                };
Quoted 8 lines

Move the active trip 'cpu_active' to mt7622-bananapi-bpi-r64.dts. and set it to 70°C in the mt7622-bananapi-bpi-r64.dts, so the fan will act before the cpu throttling.

The behavior should be the following: The temperature reaches 70°C, the fan will start, if the temperature continues to increase, it will increase the speed. If the temperature reaches 75°C, the fan is still rotating at full speed but the cpu begins to be throttled.

passive to 75 and active lower to 70? is this as intended that active comes before passive?

mt7622-bananapi-bpi-r64.dts:

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

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

	cooling-maps {
		map1 {
			trip = <&cpu_active>;
			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};
Quoted 4 lines

AFAIU, it is a Cortex-A53 running @1.35GH, so except the board is in a black metal box under the sun, I don't see how we can reach this thermal limits.

Quoted 10 lines

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 174

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
@@ -170,8 +170,8 @@ cpu-crit {
                        cooling-maps {
                                map0 {
                                        trip = <&cpu_passive>;
-                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       cooling-device = <&cpu0 0 0>,
+                                                        <&cpu1 0 0>;

You should keep it untouched.

then cpu is trottled at passive point (currently 47°C) and imho fan does not start at active

Quoted 1 line
Quoted 1 line
arch/arm64/boot/dts/mediatek/mt7622.dtsi +0 -0
                                };
#18 lore raw
Quoted 5 lines · Frank Wunderlich
Quoted 5 lines

Gesendet: Freitag, 25. Juni 2021 um 13:47 Uhr
Von: "Daniel Lezcano" <[email protected]>

Quoted 1 line

but we need to disable the passive trip as cpu-trotteling starts there...the higher temperature trips are currently not reached

Quoted 7 lines
Quoted 1 line

Sorry, can you rephrase it ? I'm not getting the point.

the problem currently is that passive is at 47degress Celsius and trottles cpu, active (67°C) and hot points are never reached this way. so at least we need to change temperatures in dtsi, and maybe disable cpu-trotteling on passive trip. imho fan will never start if it is in active and cpu is trottled before in passive

Ok, thanks for the clarification.

Quoted 38 lines
Quoted 38 lines
Quoted 15 lines

summary

moving fan and cpu_thermal-override to bananapi-r64.dts

passive-trip: cooling-device = <&cpu0/1 0 0> as in erics Patch active trip: cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; the other 2 unchanged

but i suggest changing the temperature points in mt7622 dtsi as this is SoC specific

so basicly:

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 146

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
@@ -143,13 +143,13 @@ cpu_thermal: cpu-thermal {
 
                        trips {
                                cpu_passive: cpu-passive {
-                                       temperature = <47000>;
+                                       temperature = <70000>;

May be increase the passive temp to 75°C.

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu_thermal: cpu-thermal { · line 155

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 -1
                                        hysteresis = <2000>;
                                        type = "passive";
                                };
 
                                cpu_active: cpu-active {
-                                       temperature = <67000>;
+                                       temperature = <80000>;
                                        hysteresis = <2000>;
                                        type = "active";
                                };

Move the active trip 'cpu_active' to mt7622-bananapi-bpi-r64.dts. and set it to 70°C in the mt7622-bananapi-bpi-r64.dts, so the fan will act before the cpu throttling.

Quoted 6 lines
Quoted 4 lines

The behavior should be the following: The temperature reaches 70°C, the fan will start, if the temperature continues to increase, it will increase the speed. If the temperature reaches 75°C, the fan is still rotating at full speed but the cpu begins to be throttled.

passive to 75 and active lower to 70? is this as intended that active comes before passive?

Yes. So there is a default passive mitigation temp for the SoC at 75°C. And the bpi has a setup with a fan mitigating before the cpu throttling.

Quoted 9 lines

mt7622-bananapi-bpi-r64.dts:

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

No need to add this trip point, it should be changed to 75°C in SoC DT mt7622.dtsi. This fragment of DT will concatenate with the previous one.

Quoted 35 lines
		cpu_active: cpu-active {
			temperature = <70000>;
			hysteresis = <2000>;
			type = "active";
		};
	};

	cooling-maps {
		map1 {
			trip = <&cpu_active>;
			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
		};
	};
};
Quoted 4 lines

AFAIU, it is a Cortex-A53 running @1.35GH, so except the board is in a black metal box under the sun, I don't see how we can reach this thermal limits.

Quoted 10 lines

arch/arm64/boot/dts/mediatek/mt7622.dtsi cpu-crit { · line 174

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622.dtsi +2 -2
@@ -170,8 +170,8 @@ cpu-crit {
                        cooling-maps {
                                map0 {
                                        trip = <&cpu_passive>;
-                                       cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-                                                        <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                                       cooling-device = <&cpu0 0 0>,
+                                                        <&cpu1 0 0>;

You should keep it untouched.

then cpu is trottled at passive point (currently 47°C) and imho fan does not start at active

Quoted 1 line
Quoted 1 line
arch/arm64/boot/dts/mediatek/mt7622.dtsi +0 -0
                                };
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog