Skip to contentSkip to conversation

arm64: dts: rockchip: add fan on Sapphire board

PATCH In review Vicente Bergas 2 participants 3 messages Sep 30, 2018 – Oct 30, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: rockchip: add fan on Sapphire board

The Sapphire board has a 12V fan. So, adding it to the DTS. There is no power supply directly connected, it needs the baseboard to work.
If the board is used standalone then a hardware modification is needed. On the Sapphire board there is an unpopulated resistor to connect it to VBUS_TYPEC, which is usually 5V (too low) and can range up to 20V (too high).
I tested it for a week connected to VCC_SYS which is 8.4V and proved to be more than enough for the required cooling needs. This is the connection described in the comment.

---
 .../boot/dts/rockchip/rk3399-sapphire.dtsi    | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +38 -0
index 5421e23760c3..90d813bdabde 100644
@@ -66,6 +66,19 @@
 		regulator-max-microvolt = <12000000>;
 	};
 
+	/*
+	 * The fan power supply comes from the baseboard.
+	 * For the standalone Sapphire one option is to connect a wire
+	 * from  R90030 DNP R0805 pin2  to  C90002 10uF C0805 pin1 (vcc_sys).
+	 */
+	fan0: gpio-fan {
+		#cooling-cells = <2>;
+		compatible = "gpio-fan";
+		gpio-fan,speed-map = <0 0 3000 1>;
+		gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
+		status = "okay";
+	};
+
 	keys: gpio-keys {
 		compatible = "gpio-keys";
 		autorepeat;
@@ -183,6 +196,24 @@
 	cpu-supply = <&vdd_cpu_b>;
 };
 
+&cpu_thermal {
+	trips {
+		cpu_hot: cpu_hot {
+			hysteresis = <10000>;
+			temperature = <55000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map2 {
+			cooling-device =
+				<&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+			trip = <&cpu_hot>;
+		};
+	};
+};
+
 &emmc_phy {
 	status = "okay";
 };
@@ -472,6 +503,13 @@
 		};
 	};
 
+	fan {
+		motor_pwr: motor-pwr {
+			rockchip,pins =
+				<RK_GPIO1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	pmic {
 		pmic_int_l: pmic-int-l {
 			rockchip,pins =
Signature · 1 line
2.19.0

A message that is not in the archive (sent off-list or not yet received): 20180930155033.31105-1-vicencb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 81 lines · Vicente Bergas

The Sapphire board has a 12V fan. So, adding it to the DTS. There is no power supply directly connected, it needs the baseboard to work.
If the board is used standalone then a hardware modification is needed. On the Sapphire board there is an unpopulated resistor to connect it to VBUS_TYPEC, which is usually 5V (too low) and can range up to 20V (too high).
I tested it for a week connected to VCC_SYS which is 8.4V and proved to be more than enough for the required cooling needs. This is the connection described in the comment.

---
 .../boot/dts/rockchip/rk3399-sapphire.dtsi    | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +38 -1
index 5421e23760c3..90d813bdabde 100644
@@ -66,6 +66,19 @@
                regulator-max-microvolt = <12000000>;
        };
 
+       /*
+        * The fan power supply comes from the baseboard.
+        * For the standalone Sapphire one option is to connect a wire
+        * from  R90030 DNP R0805 pin2  to  C90002 10uF C0805 pin1 (vcc_sys).
+        */
+       fan0: gpio-fan {
+               #cooling-cells = <2>;
+               compatible = "gpio-fan";
+               gpio-fan,speed-map = <0 0 3000 1>;
+               gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
+               status = "okay";
+       };
+
        keys: gpio-keys {
                compatible = "gpio-keys";
                autorepeat;
@@ -183,6 +196,24 @@
        cpu-supply = <&vdd_cpu_b>;
 };
 
+&cpu_thermal {
+       trips {
+               cpu_hot: cpu_hot {
+                       hysteresis = <10000>;
+                       temperature = <55000>;
+                       type = "active";
+               };
+       };
+
+       cooling-maps {
+               map2 {
+                       cooling-device =
+                               <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+                       trip = <&cpu_hot>;
+               };
+       };
+};
+
 &emmc_phy {
        status = "okay";
 };
@@ -472,6 +503,13 @@
                };
        };
 
+       fan {
+               motor_pwr: motor-pwr {
+                       rockchip,pins =
+                               <RK_GPIO1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
+               };
+       };
+
        pmic {
                pmic_int_l: pmic-int-l {
                        rockchip,pins =
--
Quoted 1 line

2.19.0

Hi,
can i kindly ask for feedback on this proposed patch?

Regards,
Vicenç.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#3 lore raw
In reply to a message not in the archive

Am Sonntag, 30. September 2018, 17:50:33 CET schrieb Vicente Bergas:

Quoted 11 lines

The Sapphire board has a 12V fan. So, adding it to the DTS. There is no power supply directly connected, it needs the baseboard to work.
If the board is used standalone then a hardware modification is needed. On the Sapphire board there is an unpopulated resistor to connect it to VBUS_TYPEC, which is usually 5V (too low) and can range up to 20V (too high).
I tested it for a week connected to VCC_SYS which is 8.4V and proved to be more than enough for the required cooling needs. This is the connection described in the comment.

Quoted 1 line

applied for 4.21 (or whatever it will get called)

Thanks
Heiko