lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250816093209.2600355-4-uwu@icenowy.me>
Date: Sat, 16 Aug 2025 17:32:09 +0800
From: Icenowy Zheng <uwu@...nowy.me>
To: Drew Fustini <fustini@...nel.org>,
	Guo Ren <guoren@...nel.org>,
	Fu Wei <wefu@...hat.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>
Cc: Han Gao <rabenda.cn@...il.com>,
	Yao Zi <ziyao@...root.org>,
	linux-riscv@...ts.infradead.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Icenowy Zheng <uwu@...nowy.me>
Subject: [PATCH 3/3] riscv: dts: thead: th1520: add soft PWM fan for Lichee Pi 4A

Because of the SoM+Dock design of Lichee Pi 4A, heat dissipation does
not work well; fortunately it comes with a fan port with PWM driving
capability.

As the hardware PWM controller of Lichee Pi 4A isn't ready yet, drive it
with pwm-gpio driver (software PWM) now.

A long PWM period is used, because not only software PWM is used, but
also the fan port is a 2-pin one and fast PWM might confuse the BLDC
driver on fans.

Signed-off-by: Icenowy Zheng <uwu@...nowy.me>
---
 .../boot/dts/thead/th1520-lichee-pi-4a.dts    | 53 +++++++++++++++++++
 arch/riscv/boot/dts/thead/th1520.dtsi         |  2 +-
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
index 4020c727f09e8..f696db01353c5 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts
@@ -4,6 +4,7 @@
  */
 
 #include "th1520-lichee-module-4a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Sipeed Lichee Pi 4A";
@@ -28,6 +29,58 @@ aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	gpio_pwm: gpio-pwm {
+		#pwm-cells = <3>;
+		compatible = "pwm-gpio";
+		gpios = <&gpio3 3 GPIO_ACTIVE_HIGH>;
+	};
+
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		pwms = <&gpio_pwm 0 100000000 0>;
+		cooling-levels = <0 66 196 255>;
+	};
+};
+
+&cpu_thermal_zone {
+	trips {
+		fan_trip0: fan-trip-0 {
+			temperature = <40000>;
+			hysteresis = <8000>;
+			type = "active";
+		};
+
+		fan_trip1: fan-trip-1 {
+			temperature = <50000>;
+			hysteresis = <8000>;
+			type = "active";
+		};
+
+		fan_trip2: fan-trip-2 {
+			temperature = <60000>;
+			hysteresis = <8000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map-active-0 {
+			cooling-device = <&fan 1 1>;
+			trip = <&fan_trip0>;
+		};
+
+		map-active-1 {
+			cooling-device = <&fan 2 2>;
+			trip = <&fan_trip1>;
+		};
+
+		map-active-2 {
+			cooling-device = <&fan 3 3>;
+			trip = <&fan_trip2>;
+		};
+	};
 };
 
 &padctrl0_apsys {
diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index a48eca5def606..5ac8044a05f1e 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -703,7 +703,7 @@ gpio4: gpio-controller@0 {
 	};
 
 	thermal-zones {
-		cpu-thermal {
+		cpu_thermal_zone: cpu-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <15000>;
 
-- 
2.50.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ