public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Heiko Stuebner" <heiko@sntech.de>, "Lee Jones" <lee@kernel.org>,
	"William Breathitt Gray" <wbg@kernel.org>,
	"Damon Ding" <damon.ding@rock-chips.com>
Cc: kernel@collabora.com, Jonas Karlman <jonas@kwiboo.se>,
	Alexey Charkov <alchark@gmail.com>,
	linux-rockchip@lists.infradead.org, linux-pwm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v5 6/6] arm64: dts: rockchip: Add cooling fan to ROCK 4D
Date: Mon, 27 Apr 2026 19:17:57 +0200	[thread overview]
Message-ID: <El5M8EbxT4a3ZzcG9vKdNA@collabora.com> (raw)
In-Reply-To: <35afc21f-74c9-4f52-bdf1-18a34fb58578@rock-chips.com>

Hello,

On Sunday, 26 April 2026 09:23:01 Central European Summer Time Damon Ding wrote:
> Hi Nicolas,
> 
> On 4/20/2026 9:52 PM, Nicolas Frattaroli wrote:
> > The ROCK 4D has a header to connect a small cooling fan. This fan is
> > driven by one of the SoC's PWM outputs driving a transistor, that in
> > turn controls the fan's power.
> > 
> > With the introduction of PWM support, add a description of this cooling
> > fan, as well as the additional trips and cooling-maps for it.
> > 
> > Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> > ---
> >   arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts | 50 +++++++++++++++++++++++++
> >   1 file changed, 50 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
> > index 899a84b1fbf9..2d5ede010ad0 100644
> > --- a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
> > +++ b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts
> > @@ -45,6 +45,14 @@ rfkill {
> >   		shutdown-gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_HIGH>;
> >   	};
> >   
> > +	fan: pwm-fan {
> > +		compatible = "pwm-fan";
> > +		cooling-levels = <0 180 205 230 255>;
> > +		fan-supply = <&vcc_5v0_sys>;
> > +		pwms = <&pwm2_8ch_5 0 60000 0>;
> > +		#cooling-cells = <2>;
> > +	};
> > +
> >   	leds: leds {
> >   		compatible = "gpio-leds";
> >   		pinctrl-names = "default";
> > @@ -711,6 +719,36 @@ rgmii_phy0: ethernet-phy@1 {
> >   	};
> >   };
> >   
> > +&package_thermal {
> > +	polling-delay = <100>;
> > +
> > +	trips {
> > +		package_fan0: package-fan0 {
> > +			temperature = <50000>;
> > +			hysteresis = <2000>;
> > +			type = "active";
> > +		};
> > +
> > +		package_fan1: package-fan1 {
> > +			temperature = <60000>;
> > +			hysteresis = <2000>;
> > +			type = "active";
> > +		};
> > +	};
> > +
> > +	cooling-maps {
> > +		map1 {
> > +			trip = <&package_fan0>;
> > +			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
> > +		};
> > +
> > +		map2 {
> > +			trip = <&package_fan1>;
> > +			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
> > +		};
> > +	};
> > +};
> > +
> >   &pcie0 {
> >   	pinctrl-names = "default";
> >   	pinctrl-0 = <&pcie_reset>;
> > @@ -720,6 +758,13 @@ &pcie0 {
> >   };
> >   
> >   &pinctrl {
> > +	fan {
> > +		fan_pwm: fan-pwm {
> > +			rockchip,pins =
> > +				<4 RK_PC5 14 &pcfg_pull_down_drv_level_5>;
> > +		};
> > +	};
> > +
> >   	hym8563 {
> >   		hym8563_int: hym8563-int {
> >   			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
> > @@ -770,6 +815,11 @@ wifi_en_h: wifi-en-h {
> >   	};
> >   };
> >   
> > +&pwm2_8ch_5 {
> > +	pinctrl-0 = <&fan_pwm>;
> 
> May I ask why the pinctrl does not directly use &pwm2m1_ch5?
> 
> Is it because the default pin configuration cannot meet the requirements 
> of the fan?

Yes, I'm adding a strong pull down. The PWM pin controls a transistor,
and if it floats when not in use the fan can start spinning when no
PWM signal is present. If I recall correctly (it's been a while since
I wrote this DT patch) it could be left spinning when the board was
shut down with a `poweroff` command.

> 
> > +	status = "okay";
> > +};
> > +
> >   &sai6 {
> >   	status = "okay";
> >   };
> > 
> 
> Best regards,
> Damon
> 
> 

Kind regards,
Nicolas Frattaroli




  reply	other threads:[~2026-04-27 17:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 13:52 [PATCH v5 0/6] Add Rockchip RK3576 PWM Support Through MFPWM Nicolas Frattaroli
2026-04-20 13:52 ` [PATCH v5 1/6] dt-bindings: pwm: Add a new binding for rockchip,rk3576-pwm Nicolas Frattaroli
2026-04-20 13:52 ` [PATCH v5 2/6] mfd: Add Rockchip mfpwm driver Nicolas Frattaroli
2026-04-20 13:52 ` [PATCH v5 3/6] pwm: Add rockchip PWMv4 driver Nicolas Frattaroli
2026-04-26  9:44   ` Damon Ding
2026-04-26 13:06     ` Uwe Kleine-König
2026-04-27  1:20       ` Damon Ding
2026-04-26 10:09   ` Damon Ding
2026-04-20 13:52 ` [PATCH v5 4/6] counter: Add rockchip-pwm-capture driver Nicolas Frattaroli
2026-04-26 10:55   ` Damon Ding
2026-04-27 17:35     ` Nicolas Frattaroli
2026-04-20 13:52 ` [PATCH v5 5/6] arm64: dts: rockchip: add PWM nodes to RK3576 SoC dtsi Nicolas Frattaroli
2026-04-26  7:30   ` Damon Ding
2026-04-20 13:52 ` [PATCH v5 6/6] arm64: dts: rockchip: Add cooling fan to ROCK 4D Nicolas Frattaroli
2026-04-26  7:23   ` Damon Ding
2026-04-27 17:17     ` Nicolas Frattaroli [this message]
2026-04-21 15:56 ` [PATCH v5 0/6] Add Rockchip RK3576 PWM Support Through MFPWM Jonathan Cameron
2026-04-22 11:31   ` Nicolas Frattaroli
2026-04-24 10:43     ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=El5M8EbxT4a3ZzcG9vKdNA@collabora.com \
    --to=nicolas.frattaroli@collabora.com \
    --cc=alchark@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=damon.ding@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=robh@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=wbg@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox