From 508a0a0d4e2e7b547950b2adb15594a75654708f Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Mon, 2 Dec 2024 10:34:33 +0800
Subject: [PATCH] rockchip: add pwm-fan controller for nanopi r2s/r4s

Signed-off-by: sbwml <admin@cooluc.com>
---
 arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts | 8 ++++++++
 arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts | 8 ++++++++
 2 files changed, 16 insertions(+)

--- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
@@ -114,6 +114,14 @@
 		regulator-boot-on;
 		vin-supply = <&vdd_5v>;
 	};
+
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		cooling-levels = <0 18 60 100 255>;
+		#cooling-cells = <2>;
+		fan-supply = <&vdd_5v>;
+		pwms = <&pwm2 0 50000 0>;
+	};
 };
 
 &cpu0 {
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-r4s.dts
@@ -69,6 +69,14 @@
 		regulator-always-on;
 		regulator-boot-on;
 	};
+
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		cooling-levels = <0 18 60 100 255>;
+		#cooling-cells = <2>;
+		fan-supply = <&vdd_5v>;
+		pwms = <&pwm1 0 50000 0>;
+	};
 };
 
 &emmc_phy {