linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
@ 2021-07-30 15:17 Peter Geis
  2021-08-13  8:51 ` Heiko Stuebner
  2021-08-13 12:59 ` Daniel Lezcano
  0 siblings, 2 replies; 7+ messages in thread
From: Peter Geis @ 2021-07-30 15:17 UTC (permalink / raw)
  To: Rob Herring, Heiko Stuebner
  Cc: Robin Murphy, Peter Geis, devicetree, linux-arm-kernel,
	linux-rockchip, linux-kernel

The rockpro64 had a fan node since
commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
however it was never tied into the thermal driver for automatic control.

Add the links to the thermal node to permit the kernel to handle this
automatically.
Borrowed from the (rk3399-khadas-edge.dtsi).

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
---

Changelog:
v3:
Removed the gpu nodes to prevent in-fighting (thanks Robin!)

v2:
Adjusted fan setpoints for less noise

 .../boot/dts/rockchip/rk3399-rockpro64.dtsi   | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
index 6bff8db7d33e..83db4ca67334 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
@@ -69,6 +69,7 @@ diy_led: led-1 {
 
 	fan: pwm-fan {
 		compatible = "pwm-fan";
+		cooling-levels = <0 100 150 200 255>;
 		#cooling-cells = <2>;
 		fan-supply = <&vcc12v_dcin>;
 		pwms = <&pwm1 0 50000 0>;
@@ -245,6 +246,34 @@ &cpu_b1 {
 	cpu-supply = <&vdd_cpu_b>;
 };
 
+&cpu_thermal {
+	trips {
+		cpu_warm: cpu_warm {
+			temperature = <55000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+
+		cpu_hot: cpu_hot {
+			temperature = <65000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map2 {
+			trip = <&cpu_warm>;
+			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+		};
+
+		map3 {
+			trip = <&cpu_hot>;
+			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &emmc_phy {
 	status = "okay";
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-07-30 15:17 [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64 Peter Geis
@ 2021-08-13  8:51 ` Heiko Stuebner
  2021-08-13 12:59 ` Daniel Lezcano
  1 sibling, 0 replies; 7+ messages in thread
From: Heiko Stuebner @ 2021-08-13  8:51 UTC (permalink / raw)
  To: Rob Herring, Peter Geis
  Cc: Heiko Stuebner, linux-arm-kernel, Robin Murphy, linux-kernel,
	devicetree, linux-rockchip

On Fri, 30 Jul 2021 11:17:27 -0400, Peter Geis wrote:
> The rockpro64 had a fan node since
> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
> however it was never tied into the thermal driver for automatic control.
> 
> Add the links to the thermal node to permit the kernel to handle this
> automatically.
> Borrowed from the (rk3399-khadas-edge.dtsi).

Applied, thanks!

[1/1] arm64: dts: rockchip: add thermal fan control to rockpro64
      commit: 440f361af90acff36eb3d89c1f03debeab7b3fb8

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-07-30 15:17 [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64 Peter Geis
  2021-08-13  8:51 ` Heiko Stuebner
@ 2021-08-13 12:59 ` Daniel Lezcano
  2021-08-13 13:51   ` Robin Murphy
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2021-08-13 12:59 UTC (permalink / raw)
  To: Peter Geis, Rob Herring, Heiko Stuebner
  Cc: Robin Murphy, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel

On 30/07/2021 17:17, Peter Geis wrote:
> The rockpro64 had a fan node since
> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
> however it was never tied into the thermal driver for automatic control.
> 
> Add the links to the thermal node to permit the kernel to handle this
> automatically.
> Borrowed from the (rk3399-khadas-edge.dtsi).
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
> 
> Changelog:
> v3:
> Removed the gpu nodes to prevent in-fighting (thanks Robin!)
> 
> v2:
> Adjusted fan setpoints for less noise
> 
>  .../boot/dts/rockchip/rk3399-rockpro64.dtsi   | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> index 6bff8db7d33e..83db4ca67334 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
> @@ -69,6 +69,7 @@ diy_led: led-1 {
>  
>  	fan: pwm-fan {
>  		compatible = "pwm-fan";
> +		cooling-levels = <0 100 150 200 255>;
>  		#cooling-cells = <2>;
>  		fan-supply = <&vcc12v_dcin>;
>  		pwms = <&pwm1 0 50000 0>;
> @@ -245,6 +246,34 @@ &cpu_b1 {
>  	cpu-supply = <&vdd_cpu_b>;
>  };
>  
> +&cpu_thermal {
> +	trips {
> +		cpu_warm: cpu_warm {
> +			temperature = <55000>;
> +			hysteresis = <2000>;
> +			type = "active";
> +		};
> +
> +		cpu_hot: cpu_hot {
> +			temperature = <65000>;
> +			hysteresis = <2000>;
> +			type = "active";
> +		};
> +	};
> +

Why two trip points ?

Why not one functioning temperature and no lower / upper limits for the
cooling maps ?


> +	cooling-maps {
> +		map2 {
> +			trip = <&cpu_warm>;
> +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
> +		};
> +
> +		map3 {
> +			trip = <&cpu_hot>;
> +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
> +		};
> +	};
> +};
> +
>  &emmc_phy {
>  	status = "okay";
>  };
> 


-- 
<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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-08-13 12:59 ` Daniel Lezcano
@ 2021-08-13 13:51   ` Robin Murphy
  2021-08-13 14:54     ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Robin Murphy @ 2021-08-13 13:51 UTC (permalink / raw)
  To: Daniel Lezcano, Peter Geis, Rob Herring, Heiko Stuebner
  Cc: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel

On 2021-08-13 13:59, Daniel Lezcano wrote:
> On 30/07/2021 17:17, Peter Geis wrote:
>> The rockpro64 had a fan node since
>> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
>> however it was never tied into the thermal driver for automatic control.
>>
>> Add the links to the thermal node to permit the kernel to handle this
>> automatically.
>> Borrowed from the (rk3399-khadas-edge.dtsi).
>>
>> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
>> ---
>>
>> Changelog:
>> v3:
>> Removed the gpu nodes to prevent in-fighting (thanks Robin!)
>>
>> v2:
>> Adjusted fan setpoints for less noise
>>
>>   .../boot/dts/rockchip/rk3399-rockpro64.dtsi   | 29 +++++++++++++++++++
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
>> index 6bff8db7d33e..83db4ca67334 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
>> @@ -69,6 +69,7 @@ diy_led: led-1 {
>>   
>>   	fan: pwm-fan {
>>   		compatible = "pwm-fan";
>> +		cooling-levels = <0 100 150 200 255>;
>>   		#cooling-cells = <2>;
>>   		fan-supply = <&vcc12v_dcin>;
>>   		pwms = <&pwm1 0 50000 0>;
>> @@ -245,6 +246,34 @@ &cpu_b1 {
>>   	cpu-supply = <&vdd_cpu_b>;
>>   };
>>   
>> +&cpu_thermal {
>> +	trips {
>> +		cpu_warm: cpu_warm {
>> +			temperature = <55000>;
>> +			hysteresis = <2000>;
>> +			type = "active";
>> +		};
>> +
>> +		cpu_hot: cpu_hot {
>> +			temperature = <65000>;
>> +			hysteresis = <2000>;
>> +			type = "active";
>> +		};
>> +	};
>> +
> 
> Why two trip points ?
> 
> Why not one functioning temperature and no lower / upper limits for the
> cooling maps ?

Certainly when I first did this for NanoPC-T4, IIRC it was to avoid the 
fan ramping up too eagerly, since level 1 for my fan is effectively 
silent but still cools enough to let a moderate load eventually settle 
to a steady state below the second trip.

Robin.

>> +	cooling-maps {
>> +		map2 {
>> +			trip = <&cpu_warm>;
>> +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
>> +		};
>> +
>> +		map3 {
>> +			trip = <&cpu_hot>;
>> +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
>> +		};
>> +	};
>> +};
>> +
>>   &emmc_phy {
>>   	status = "okay";
>>   };
>>
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-08-13 13:51   ` Robin Murphy
@ 2021-08-13 14:54     ` Daniel Lezcano
  2021-08-13 15:10       ` Peter Geis
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Lezcano @ 2021-08-13 14:54 UTC (permalink / raw)
  To: Robin Murphy, Peter Geis, Rob Herring, Heiko Stuebner
  Cc: devicetree, linux-arm-kernel, linux-rockchip, linux-kernel


Hi Robin,


On 13/08/2021 15:51, Robin Murphy wrote:
> On 2021-08-13 13:59, Daniel Lezcano wrote:
>> On 30/07/2021 17:17, Peter Geis wrote:
>>> The rockpro64 had a fan node since
>>> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
>>> however it was never tied into the thermal driver for automatic control.
>>>
>>> Add the links to the thermal node to permit the kernel to handle this
>>> automatically.
>>> Borrowed from the (rk3399-khadas-edge.dtsi).
>>>
>>> Signed-off-by: Peter Geis <pgwipeout@gmail.com>

[ ... ]

>>>   +&cpu_thermal {
>>> +    trips {
>>> +        cpu_warm: cpu_warm {
>>> +            temperature = <55000>;
>>> +            hysteresis = <2000>;
>>> +            type = "active";
>>> +        };
>>> +
>>> +        cpu_hot: cpu_hot {
>>> +            temperature = <65000>;
>>> +            hysteresis = <2000>;
>>> +            type = "active";
>>> +        };
>>> +    };
>>> +
>>
>> Why two trip points ?
>>
>> Why not one functioning temperature and no lower / upper limits for the
>> cooling maps ?
> 
> Certainly when I first did this for NanoPC-T4, IIRC it was to avoid the
> fan ramping up too eagerly, since level 1 for my fan is effectively
> silent but still cools enough to let a moderate load eventually settle
> to a steady state below the second trip.

Thanks for your answer.

What would be the governor for this setup ?




-- 
<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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-08-13 14:54     ` Daniel Lezcano
@ 2021-08-13 15:10       ` Peter Geis
  2021-08-13 15:46         ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Geis @ 2021-08-13 15:10 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Robin Murphy, Rob Herring, Heiko Stuebner, devicetree,
	arm-mail-list, open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List

On Fri, Aug 13, 2021 at 10:54 AM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
>
> Hi Robin,
>
>
> On 13/08/2021 15:51, Robin Murphy wrote:
> > On 2021-08-13 13:59, Daniel Lezcano wrote:
> >> On 30/07/2021 17:17, Peter Geis wrote:
> >>> The rockpro64 had a fan node since
> >>> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
> >>> however it was never tied into the thermal driver for automatic control.
> >>>
> >>> Add the links to the thermal node to permit the kernel to handle this
> >>> automatically.
> >>> Borrowed from the (rk3399-khadas-edge.dtsi).
> >>>
> >>> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
>
> [ ... ]
>
> >>>   +&cpu_thermal {
> >>> +    trips {
> >>> +        cpu_warm: cpu_warm {
> >>> +            temperature = <55000>;
> >>> +            hysteresis = <2000>;
> >>> +            type = "active";
> >>> +        };
> >>> +
> >>> +        cpu_hot: cpu_hot {
> >>> +            temperature = <65000>;
> >>> +            hysteresis = <2000>;
> >>> +            type = "active";
> >>> +        };
> >>> +    };
> >>> +
> >>
> >> Why two trip points ?
> >>
> >> Why not one functioning temperature and no lower / upper limits for the
> >> cooling maps ?
> >
> > Certainly when I first did this for NanoPC-T4, IIRC it was to avoid the
> > fan ramping up too eagerly, since level 1 for my fan is effectively
> > silent but still cools enough to let a moderate load eventually settle
> > to a steady state below the second trip.

That's the same issue I had on the rockpro64.

>
> Thanks for your answer.
>
> What would be the governor for this setup ?
>

The default governor when using arm64_defconfig is step_wise.

>
>
>
> --
> <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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64
  2021-08-13 15:10       ` Peter Geis
@ 2021-08-13 15:46         ` Daniel Lezcano
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2021-08-13 15:46 UTC (permalink / raw)
  To: Peter Geis
  Cc: Robin Murphy, Rob Herring, Heiko Stuebner, devicetree,
	arm-mail-list, open list:ARM/Rockchip SoC...,
	Linux Kernel Mailing List

On 13/08/2021 17:10, Peter Geis wrote:
> On Fri, Aug 13, 2021 at 10:54 AM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>>
>> Hi Robin,
>>
>>
>> On 13/08/2021 15:51, Robin Murphy wrote:
>>> On 2021-08-13 13:59, Daniel Lezcano wrote:
>>>> On 30/07/2021 17:17, Peter Geis wrote:
>>>>> The rockpro64 had a fan node since
>>>>> commit 5882d65c1691 ("arm64: dts: rockchip: Add PWM fan for RockPro64")
>>>>> however it was never tied into the thermal driver for automatic control.
>>>>>
>>>>> Add the links to the thermal node to permit the kernel to handle this
>>>>> automatically.
>>>>> Borrowed from the (rk3399-khadas-edge.dtsi).
>>>>>
>>>>> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
>>
>> [ ... ]
>>
>>>>>   +&cpu_thermal {
>>>>> +    trips {
>>>>> +        cpu_warm: cpu_warm {
>>>>> +            temperature = <55000>;
>>>>> +            hysteresis = <2000>;
>>>>> +            type = "active";
>>>>> +        };
>>>>> +
>>>>> +        cpu_hot: cpu_hot {
>>>>> +            temperature = <65000>;
>>>>> +            hysteresis = <2000>;
>>>>> +            type = "active";
>>>>> +        };
>>>>> +    };
>>>>> +
>>>>
>>>> Why two trip points ?
>>>>
>>>> Why not one functioning temperature and no lower / upper limits for the
>>>> cooling maps ?
>>>
>>> Certainly when I first did this for NanoPC-T4, IIRC it was to avoid the
>>> fan ramping up too eagerly, since level 1 for my fan is effectively
>>> silent but still cools enough to let a moderate load eventually settle
>>> to a steady state below the second trip.
> 
> That's the same issue I had on the rockpro64.
> 
>>
>> Thanks for your answer.
>>
>> What would be the governor for this setup ?
>>
> 
> The default governor when using arm64_defconfig is step_wise.

Ok, thanks


-- 
<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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-13 15:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 15:17 [PATCH v3] arm64: dts: rockchip: add thermal fan control to rockpro64 Peter Geis
2021-08-13  8:51 ` Heiko Stuebner
2021-08-13 12:59 ` Daniel Lezcano
2021-08-13 13:51   ` Robin Murphy
2021-08-13 14:54     ` Daniel Lezcano
2021-08-13 15:10       ` Peter Geis
2021-08-13 15:46         ` Daniel Lezcano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).