diff mbox series

arm64: dts: rockchip: Add PWM fan for NanoPC-T4

Message ID c5a0100395d44fe460c460bb4f8e8d7324ae63b3.1552611953.git.robin.murphy@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: dts: rockchip: Add PWM fan for NanoPC-T4 | expand

Commit Message

Robin Murphy March 15, 2019, 1:05 a.m. UTC
NanoPC-T4 has a dedicated circuit for driving a 12V fan from PWM1,
so let's add that along with some rough empirically-derived thermal
settings for the benefit of anyone determined enough to hook one up.

The vendor does not currently offer a suitable fan, but this seems as
good a place as any to note that pre-terminated 3-pin JST GH connectors
are readily available online, and if you even have to ask, then splicing
one of those really will be orders of magnitude cheaper and simpler than
getting set up to crimp the teeny-tiny things by hand.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts    | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)

Comments

Heiko Stübner March 16, 2019, 7:50 p.m. UTC | #1
Am Freitag, 15. März 2019, 02:05:53 CET schrieb Robin Murphy:
> NanoPC-T4 has a dedicated circuit for driving a 12V fan from PWM1,
> so let's add that along with some rough empirically-derived thermal
> settings for the benefit of anyone determined enough to hook one up.
> 
> The vendor does not currently offer a suitable fan, but this seems as
> good a place as any to note that pre-terminated 3-pin JST GH connectors
> are readily available online, and if you even have to ask, then splicing
> one of those really will be orders of magnitude cheaper and simpler than
> getting set up to crimp the teeny-tiny things by hand.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

applied for 5.2

Thanks
Heiko
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
index 84433cf02be9..b10cf44f590c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -52,6 +52,69 @@ 
 		pinctrl-names = "default";
 		pinctrl-0 = <&ir_rx>;
 	};
+
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		/*
+		 * With 20KHz PWM and an EVERCOOL EC4007H12SA fan, these levels
+		 * work out to 0, ~1200, ~3000, and 5000RPM respectively.
+		 */
+		cooling-levels = <0 12 18 255>;
+		#cooling-cells = <2>;
+		fan-supply = <&vcc12v0_sys>;
+		pwms = <&pwm1 0 50000 0>;
+	};
+};
+
+&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>;
+		};
+	};
+};
+
+&gpu_thermal {
+	trips {
+		gpu_warm: gpu_warm {
+			temperature = <55000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+		gpu_hot: gpu_hot {
+			temperature = <65000>;
+			hysteresis = <2000>;
+			type = "active";
+		};
+	};
+	cooling-maps {
+		map1 {
+			trip = <&gpu_warm>;
+			cooling-device = <&fan THERMAL_NO_LIMIT 1>;
+		};
+		map2 {
+			trip = <&gpu_hot>;
+			cooling-device = <&fan 2 THERMAL_NO_LIMIT>;
+		};
+	};
 };
 
 &pinctrl {