arm64: dts: rockchip: Add PWM fan for RockPro64
diff mbox series

Message ID 20190724191715.7668-1-andrius@stikonas.eu
State New
Headers show
Series
  • arm64: dts: rockchip: Add PWM fan for RockPro64
Related show

Commit Message

Andrius Štikonas July 24, 2019, 7:17 p.m. UTC
RockPro64 has a dedicated circuit for driving a 12V fan from PWM1.

At the moment this makes fan spin at full speed. fancontrol can be used
to control fan speed. E.g. the following config file works well:

INTERVAL=10
DEVPATH=hwmon0=devices/platform/pwm-fan
DEVNAME=hwmon0=pwmfan
FCTEMPS=hwmon0/device/pwm1=../thermal/thermal_zone0/temp
MINTEMP=hwmon0/device/pwm1=40
MAXTEMP=hwmon0/device/pwm1=60
MINSTART=hwmon0/device/pwm1=100
MINSTOP=hwmon0/device/pwm1=70

In the future it would be nice to define trip points in dts file,
so that kernel could adjust fan speed itself.

Signed-off-by: Andrius Štikonas <andrius@stikonas.eu>
---
 arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Heiko Stuebner July 25, 2019, 8:12 p.m. UTC | #1
Am Mittwoch, 24. Juli 2019, 21:17:15 CEST schrieb Andrius Štikonas:
> RockPro64 has a dedicated circuit for driving a 12V fan from PWM1.
> 
> At the moment this makes fan spin at full speed. fancontrol can be used
> to control fan speed. E.g. the following config file works well:
> 
> INTERVAL=10
> DEVPATH=hwmon0=devices/platform/pwm-fan
> DEVNAME=hwmon0=pwmfan
> FCTEMPS=hwmon0/device/pwm1=../thermal/thermal_zone0/temp
> MINTEMP=hwmon0/device/pwm1=40
> MAXTEMP=hwmon0/device/pwm1=60
> MINSTART=hwmon0/device/pwm1=100
> MINSTOP=hwmon0/device/pwm1=70
> 
> In the future it would be nice to define trip points in dts file,
> so that kernel could adjust fan speed itself.

patches welcome ;-)

> Signed-off-by: Andrius Štikonas <andrius@stikonas.eu>

applied for 5.4

Thanks
Heiko

Patch
diff mbox series

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
index eb5594062006..02cf5d0dbaed 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts
@@ -169,6 +169,14 @@ 
 		regulator-max-microvolt = <1400000>;
 		vin-supply = <&vcc5v0_sys>;
 	};
+
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		fan-supply = <&vcc12v_dcin>;
+		pwms = <&pwm1 0 50000 0>;
+	};
+
 };
 
 &cpu_l0 {
@@ -602,6 +610,10 @@ 
 	status = "okay";
 };
 
+&pwm1 {
+	status = "okay";
+};
+
 &pwm2 {
 	status = "okay";
 };