diff mbox series

[v2,2/4] arm64: dts: allwinner: h6: Add cooling map for GPU

Message ID 20220821173051.155038-3-peron.clem@gmail.com (mailing list archive)
State New, archived
Headers show
Series Allwinner H6 GPU devfreq | expand

Commit Message

Clément Péron Aug. 21, 2022, 5:30 p.m. UTC
Add a simple cooling map for the GPU.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Samuel Holland Aug. 23, 2022, 3:16 a.m. UTC | #1
On 8/21/22 12:30 PM, Clément Péron wrote:
> Add a simple cooling map for the GPU.

It would be good to document where the trip point temperatures came from.

> Signed-off-by: Clément Péron <peron.clem@gmail.com>

Acked-by: Samuel Holland <samuel@sholland.org>

> ---
>  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 22 ++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> index 5a28303d3d4c..943ae5374dd6 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> @@ -186,6 +186,7 @@ gpu: gpu@1800000 {
>  			clocks = <&ccu CLK_GPU>, <&ccu CLK_BUS_GPU>;
>  			clock-names = "core", "bus";
>  			resets = <&ccu RST_BUS_GPU>;
> +			#cooling-cells = <2>;
>  			status = "disabled";
>  		};
>  
> @@ -1075,6 +1076,27 @@ gpu-thermal {
>  			polling-delay-passive = <0>;
>  			polling-delay = <0>;
>  			thermal-sensors = <&ths 1>;
> +
> +			trips {
> +				gpu_alert: gpu-alert {
> +					temperature = <85000>;
> +					hysteresis = <2000>;
> +					type = "passive";
> +				};
> +
> +				gpu-crit {
> +					temperature = <100000>;
> +					hysteresis = <0>;
> +					type = "critical";
> +				};
> +			};
> +
> +			cooling-maps {
> +				map0 {
> +					trip = <&gpu_alert>;
> +					cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +				};
> +			};
>  		};
>  	};
>  };
>
Clément Péron Aug. 27, 2022, 4:49 p.m. UTC | #2
Hi Samuel,

On Tue, 23 Aug 2022 at 05:16, Samuel Holland <samuel@sholland.org> wrote:
>
> On 8/21/22 12:30 PM, Clément Péron wrote:
> > Add a simple cooling map for the GPU.
>
> It would be good to document where the trip point temperatures came from.

If I remember correctly, I got those when getting the dtb from my
Beelink GS1 when it was running vendor Android with the oldest
Allwinner kernel.

But now that you ask I double check with the "new" vendor kernel source:
https://github.com/Allwinner-Homlet/H6-BSP4.9-linux/blob/master/arch/arm64/boot/dts/sunxi/sun50iw6p1.dtsi#L2034-L2053

And It's different from what I got in the past.
The throttling starts when the GPU is already very hot (95, 100 and
105°C) and seems to only disable the highest frequency (756, 624 and
576MHz).
Which let the GPU running at 0.91V @ 540MHz.

Which is far to be the lowest possible consumption for the GPU (0.81V
@ 336MHz would be better in the hottest situation)

I'm not an expert but either I could just try to copy/paste the same
behavior or try to have a more smooth cooling map (70, 85, 100°C).

What do you think?

Thanks,
Clement



>
> > Signed-off-by: Clément Péron <peron.clem@gmail.com>
>
> Acked-by: Samuel Holland <samuel@sholland.org>
>
> > ---
> >  arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 22 ++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > index 5a28303d3d4c..943ae5374dd6 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
> > @@ -186,6 +186,7 @@ gpu: gpu@1800000 {
> >                       clocks = <&ccu CLK_GPU>, <&ccu CLK_BUS_GPU>;
> >                       clock-names = "core", "bus";
> >                       resets = <&ccu RST_BUS_GPU>;
> > +                     #cooling-cells = <2>;
> >                       status = "disabled";
> >               };
> >
> > @@ -1075,6 +1076,27 @@ gpu-thermal {
> >                       polling-delay-passive = <0>;
> >                       polling-delay = <0>;
> >                       thermal-sensors = <&ths 1>;
> > +
> > +                     trips {
> > +                             gpu_alert: gpu-alert {
> > +                                     temperature = <85000>;
> > +                                     hysteresis = <2000>;
> > +                                     type = "passive";
> > +                             };
> > +
> > +                             gpu-crit {
> > +                                     temperature = <100000>;
> > +                                     hysteresis = <0>;
> > +                                     type = "critical";
> > +                             };
> > +                     };
> > +
> > +                     cooling-maps {
> > +                             map0 {
> > +                                     trip = <&gpu_alert>;
> > +                                     cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> > +                             };
> > +                     };
> >               };
> >       };
> >  };
> >
>
Samuel Holland Sept. 4, 2022, 3:24 a.m. UTC | #3
On 8/27/22 11:49 AM, Clément Péron wrote:
> Hi Samuel,
> 
> On Tue, 23 Aug 2022 at 05:16, Samuel Holland <samuel@sholland.org> wrote:
>>
>> On 8/21/22 12:30 PM, Clément Péron wrote:
>>> Add a simple cooling map for the GPU.
>>
>> It would be good to document where the trip point temperatures came from.
> 
> If I remember correctly, I got those when getting the dtb from my
> Beelink GS1 when it was running vendor Android with the oldest
> Allwinner kernel.
> 
> But now that you ask I double check with the "new" vendor kernel source:
> https://github.com/Allwinner-Homlet/H6-BSP4.9-linux/blob/master/arch/arm64/boot/dts/sunxi/sun50iw6p1.dtsi#L2034-L2053
> 
> And It's different from what I got in the past.
> The throttling starts when the GPU is already very hot (95, 100 and
> 105°C) and seems to only disable the highest frequency (756, 624 and
> 576MHz).
> Which let the GPU running at 0.91V @ 540MHz.
> 
> Which is far to be the lowest possible consumption for the GPU (0.81V
> @ 336MHz would be better in the hottest situation)
> 
> I'm not an expert but either I could just try to copy/paste the same
> behavior or try to have a more smooth cooling map (70, 85, 100°C).
> 
> What do you think?

I would generally prefer something conservative, to be appropriate for most
boards. But I do not have any strong opinion on the exact trip points used; I am
fine with adjusting them.

Mostly I want to know the source of the cooling map -- where the numbers came
from, and what changes were made. That provides context if we want to change the
map in the future, or if we run in to issues on some other board.

Regards,
Samuel
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
index 5a28303d3d4c..943ae5374dd6 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
@@ -186,6 +186,7 @@  gpu: gpu@1800000 {
 			clocks = <&ccu CLK_GPU>, <&ccu CLK_BUS_GPU>;
 			clock-names = "core", "bus";
 			resets = <&ccu RST_BUS_GPU>;
+			#cooling-cells = <2>;
 			status = "disabled";
 		};
 
@@ -1075,6 +1076,27 @@  gpu-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 			thermal-sensors = <&ths 1>;
+
+			trips {
+				gpu_alert: gpu-alert {
+					temperature = <85000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				gpu-crit {
+					temperature = <100000>;
+					hysteresis = <0>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&gpu_alert>;
+					cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
 		};
 	};
 };