[2/2] arm64: dts: rockchip: rk3588-rock-5b: Add pwm-fan

Message ID 20230403105052.426135-3-cristian.ciocaltea@collabora.com
State New
Headers
Series Add PWM fan support to Rock 5B board |

Commit Message

Cristian Ciocaltea April 3, 2023, 10:50 a.m. UTC
  Add the necessary DT changes for the Rock 5B board to enable support for
the PWM controlled heat sink fan.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Comments

Chris Morgan April 3, 2023, 5:56 p.m. UTC | #1
On Mon, Apr 03, 2023 at 01:50:52PM +0300, Cristian Ciocaltea wrote:
> Add the necessary DT changes for the Rock 5B board to enable support for
> the PWM controlled heat sink fan.

Honest question, but should we be adding this to the board file if not
every device has a PWM fan (they all have the socket for the fan, but
not the fan)? For example I have a passively cooled case that doesn't
include a fan.

Thank you,
Chris Morgan.

> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> index 95805cb0adfa..bd74d9da2c17 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> @@ -17,6 +17,14 @@ chosen {
>  		stdout-path = "serial2:1500000n8";
>  	};
>  
> +	fan: pwm-fan {
> +		compatible = "pwm-fan";
> +		cooling-levels = <0 95 145 195 255>;
> +		fan-supply = <&vcc5v0_sys>;
> +		pwms = <&pwm1 0 50000 0>;
> +		#cooling-cells = <2>;
> +	};
> +
>  	vcc5v0_sys: vcc5v0-sys-regulator {
>  		compatible = "regulator-fixed";
>  		regulator-name = "vcc5v0_sys";
> @@ -27,6 +35,10 @@ vcc5v0_sys: vcc5v0-sys-regulator {
>  	};
>  };
>  
> +&pwm1 {
> +	status = "okay";
> +};
> +
>  &sdhci {
>  	bus-width = <8>;
>  	no-sdio;
> -- 
> 2.40.0
>
  
Peter Geis April 3, 2023, 7:27 p.m. UTC | #2
On Mon, Apr 3, 2023 at 1:56 PM Chris Morgan <macroalpha82@gmail.com> wrote:
>
> On Mon, Apr 03, 2023 at 01:50:52PM +0300, Cristian Ciocaltea wrote:
> > Add the necessary DT changes for the Rock 5B board to enable support for
> > the PWM controlled heat sink fan.
>
> Honest question, but should we be adding this to the board file if not
> every device has a PWM fan (they all have the socket for the fan, but
> not the fan)? For example I have a passively cooled case that doesn't
> include a fan.

Active cooling should be set up to take effect before throttling. If
it is there great, (especially if it has feedback), if it doesn't
exist it really doesn't affect anything because the throttling will
kick in as necessary.

>
> Thank you,
> Chris Morgan.
>
> >
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
> > ---
> >  arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> > index 95805cb0adfa..bd74d9da2c17 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> > +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> > @@ -17,6 +17,14 @@ chosen {
> >               stdout-path = "serial2:1500000n8";
> >       };
> >
> > +     fan: pwm-fan {
> > +             compatible = "pwm-fan";
> > +             cooling-levels = <0 95 145 195 255>;
> > +             fan-supply = <&vcc5v0_sys>;
> > +             pwms = <&pwm1 0 50000 0>;
> > +             #cooling-cells = <2>;
> > +     };
> > +
> >       vcc5v0_sys: vcc5v0-sys-regulator {
> >               compatible = "regulator-fixed";
> >               regulator-name = "vcc5v0_sys";
> > @@ -27,6 +35,10 @@ vcc5v0_sys: vcc5v0-sys-regulator {
> >       };
> >  };
> >
> > +&pwm1 {
> > +     status = "okay";
> > +};
> > +
> >  &sdhci {
> >       bus-width = <8>;
> >       no-sdio;
> > --
> > 2.40.0
> >
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
  
Heiko Stübner April 3, 2023, 9:55 p.m. UTC | #3
Am Montag, 3. April 2023, 19:56:26 CEST schrieb Chris Morgan:
> On Mon, Apr 03, 2023 at 01:50:52PM +0300, Cristian Ciocaltea wrote:
> > Add the necessary DT changes for the Rock 5B board to enable support for
> > the PWM controlled heat sink fan.
> 
> Honest question, but should we be adding this to the board file if not
> every device has a PWM fan (they all have the socket for the fan, but
> not the fan)? For example I have a passively cooled case that doesn't
> include a fan.

We also set up the sdmmc host without knowing if the user will plug in
an sd-card ;-) .

So especially in the case where there is a dedicated socket for it,
as you write, we should definitly add it for the board.

By the way, am I correct in thinking that patch 1 and 2 are actually
independent of each other? So I'd just pick patch2 for the Rockchip tree
(as we do have a text-binding) and you can handle the yaml conversion
in a followup or whatever?

Thanks
Heiko
  
Cristian Ciocaltea April 4, 2023, 7:06 a.m. UTC | #4
On 4/4/23 00:55, Heiko Stübner wrote:
> Am Montag, 3. April 2023, 19:56:26 CEST schrieb Chris Morgan:
>> On Mon, Apr 03, 2023 at 01:50:52PM +0300, Cristian Ciocaltea wrote:
>>> Add the necessary DT changes for the Rock 5B board to enable support for
>>> the PWM controlled heat sink fan.
>>
>> Honest question, but should we be adding this to the board file if not
>> every device has a PWM fan (they all have the socket for the fan, but
>> not the fan)? For example I have a passively cooled case that doesn't
>> include a fan.
> 
> We also set up the sdmmc host without knowing if the user will plug in
> an sd-card ;-) .
> 
> So especially in the case where there is a dedicated socket for it,
> as you write, we should definitly add it for the board.
> 
> By the way, am I correct in thinking that patch 1 and 2 are actually
> independent of each other? So I'd just pick patch2 for the Rockchip tree
> (as we do have a text-binding) and you can handle the yaml conversion
> in a followup or whatever?

Yes, the bindings conversion can be handled independently.

Thanks,
Cristian
  
Christopher Obbard April 4, 2023, 8:56 a.m. UTC | #5
Hi Cristian,

On Mon, 2023-04-03 at 13:50 +0300, Cristian Ciocaltea wrote:
> Add the necessary DT changes for the Rock 5B board to enable support for
> the PWM controlled heat sink fan.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>

> ---
>  arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> index 95805cb0adfa..bd74d9da2c17 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
> @@ -17,6 +17,14 @@ chosen {
>                 stdout-path = "serial2:1500000n8";
>         };
>  
> +       fan: pwm-fan {
> +               compatible = "pwm-fan";
> +               cooling-levels = <0 95 145 195 255>;
> +               fan-supply = <&vcc5v0_sys>;
> +               pwms = <&pwm1 0 50000 0>;
> +               #cooling-cells = <2>;
> +       };
> +
>         vcc5v0_sys: vcc5v0-sys-regulator {
>                 compatible = "regulator-fixed";
>                 regulator-name = "vcc5v0_sys";
> @@ -27,6 +35,10 @@ vcc5v0_sys: vcc5v0-sys-regulator {
>         };
>  };
>  
> +&pwm1 {
> +       status = "okay";
> +};
> +
>  &sdhci {
>         bus-width = <8>;
>         no-sdio;
> -- 
> 2.40.0
> 
>
  

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
index 95805cb0adfa..bd74d9da2c17 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
@@ -17,6 +17,14 @@  chosen {
 		stdout-path = "serial2:1500000n8";
 	};
 
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		cooling-levels = <0 95 145 195 255>;
+		fan-supply = <&vcc5v0_sys>;
+		pwms = <&pwm1 0 50000 0>;
+		#cooling-cells = <2>;
+	};
+
 	vcc5v0_sys: vcc5v0-sys-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc5v0_sys";
@@ -27,6 +35,10 @@  vcc5v0_sys: vcc5v0-sys-regulator {
 	};
 };
 
+&pwm1 {
+	status = "okay";
+};
+
 &sdhci {
 	bus-width = <8>;
 	no-sdio;