Skip to contentSkip to conversation

arm64: dts: meson: radxa-zero2: add pwm-fan support

PATCH Superseded Christian Hewitt 2 participants 2 messages Oct 28, 2023 – Nov 27, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: meson: radxa-zero2: add pwm-fan support

The A311D on Zero2 needs active cooling and the board includes a header to connect a simple fan. Add pwm-fan support with basic thermal properties so the fan runs when connected.

---
 .../dts/amlogic/meson-g12b-radxa-zero2.dts    | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts +27 -0
index 890f5bfebb03..895b6ea67180 100644
@@ -33,6 +33,15 @@ memory@0 {
 		reg = <0x0 0x0 0x0 0x80000000>;
 	};
 
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		cooling-min-state = <0>;
+		cooling-max-state = <4>;
+		cooling-levels = <0 64 128 192 255>;
+		pwms = <&pwm_AO_ab 0 40000 0>;
+	};
+
 	gpio-keys-polled {
 		compatible = "gpio-keys-polled";
 		poll-interval = <100>;
@@ -286,6 +295,24 @@ &cpu103 {
 	clock-latency = <50000>;
 };
 
+&cpu_thermal {
+	cooling-maps {
+		map0 {
+			trip = <&cpu_passive>;
+			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
+&ddr_thermal {
+	cooling-maps {
+		map0 {
+			trip = <&ddr_passive>;
+			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &frddr_a {
 	status = "okay";
 };
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 41 lines · Christian Hewitt

The A311D on Zero2 needs active cooling and the board includes a header to connect a simple fan. Add pwm-fan support with basic thermal properties so the fan runs when connected.

---
  .../dts/amlogic/meson-g12b-radxa-zero2.dts    | 27 +++++++++++++++++++
  1 file changed, 27 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts +16 -0
index 890f5bfebb03..895b6ea67180 100644
@@ -33,6 +33,15 @@ memory@0 {
  		reg = <0x0 0x0 0x0 0x80000000>;
  	};
 
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		cooling-min-state = <0>;
+		cooling-max-state = <4>;
+		cooling-levels = <0 64 128 192 255>;
+		pwms = <&pwm_AO_ab 0 40000 0>;
+	};
+
  	gpio-keys-polled {
  		compatible = "gpio-keys-polled";
  		poll-interval = <100>;
@@ -286,6 +295,24 @@ &cpu103 {
  	clock-latency = <50000>;
  };
 
+&cpu_thermal {
+	cooling-maps {
+		map0 {
+			trip = <&cpu_passive>;
+			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};

arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts &cpu103 { · line 314

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts +10 -0
+};
+
+&ddr_thermal {
+	cooling-maps {
+		map0 {
+			trip = <&ddr_passive>;
+			cooling-device = <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
+};

You should instead add a new active trips, and use them for the fan cooling-map.

Look at how it's done on the Khadas VIM3s or Odroid boards.

Neil

Quoted 4 lines
arch/arm64/boot/dts/amlogic/meson-g12b-radxa-zero2.dts +1 -0
+
  &frddr_a {
  	status = "okay";
  };