Hi,

pwmfan0 doesn't attach on RockPro64 because there are no cooling levels defined in the device tree:

pwmfan0 at mainbus0: no cooling levels

Also the dtb thermal zone does not care about the fan.

I added the cooling levels and tried to overwrite the default rk3399.dtsi thermal zone in rk3399-rockpro64.dtsi.

This seems to work pretty well now.

OK?

To me it seems a bit impractical to hardcode cooling levels because different fans might react differently.

Would it be a good idea to add a r/w sysctl knob for each cooling device ? Or maybo only for cooling devices which are fans?


Christopher


Index: patch-arch_arm64_boot_dts_rockchip_rk3399-rockpro64_dtsi
===================================================================
RCS file: 
/cvs/ports/sysutils/dtb/patches/patch-arch_arm64_boot_dts_rockchip_rk3399-rockpro64_dtsi,v
retrieving revision 1.1
diff -u -p -r1.1 patch-arch_arm64_boot_dts_rockchip_rk3399-rockpro64_dtsi
--- patch-arch_arm64_boot_dts_rockchip_rk3399-rockpro64_dtsi    12 Apr 2020 
10:59:07 -0000      1.1
+++ patch-arch_arm64_boot_dts_rockchip_rk3399-rockpro64_dtsi    4 Dec 2021 
23:25:06 -0000
@@ -3,12 +3,99 @@ $OpenBSD: patch-arch_arm64_boot_dts_rock
 Index: arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
 --- arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi.orig
 +++ arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dtsi
-@@ -11,7 +11,7 @@
+@@ -17,7 +17,7 @@
+       };
- / {
        chosen {
 -              stdout-path = "serial2:1500000n8";
 +              stdout-path = "serial2:115200n8";
        };
clkin_gmac: external-gmac-clock {
+@@ -71,9 +71,86 @@
+               compatible = "pwm-fan";
+               #cooling-cells = <2>;
+               fan-supply = <&vcc12v_dcin>;
++              cooling-levels = <0 50 70 90 255>;
+               pwms = <&pwm1 0 50000 0>;
+       };
+ ++ thermal_zones: thermal-zones {
++              cpu_thermal: cpu-thermal {
++                      polling-delay-passive = <100>;
++                      polling-delay = <1000>;
++
++                      thermal-sensors = <&tsadc 0>;
++
++                      trips {
++                              cpu_alert0: cpu_alert0 {
++                                      temperature = <40000>;
++                                      hysteresis = <2000>;
++                                      type = "passive";
++                              };
++                              cpu_alert1: cpu_alert1 {
++                                      temperature = <75000>;
++                                      hysteresis = <2000>;
++                                      type = "passive";
++                              };
++                              cpu_crit: cpu_crit {
++                                      temperature = <95000>;
++                                      hysteresis = <2000>;
++                                      type = "critical";
++                              };
++                      };
++
++                      cooling-maps {
++                              map0 {
++                                      trip = <&cpu_alert0>;
++                                      cooling-device =
++                                              <&fan 1 3>,
++                                              <&cpu_b0 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_b1 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
++
++                              };
++                              map1 {
++                                      trip = <&cpu_alert1>;
++                                      cooling-device =
++                                              <&fan 4 THERMAL_NO_LIMIT>,
++                                              <&cpu_l0 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_l1 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_l2 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_l3 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_b0 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>,
++                                              <&cpu_b1 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
++                              };
++                      };
++              };
++
++              gpu_thermal: gpu-thermal {
++                      polling-delay-passive = <100>;
++                      polling-delay = <1000>;
++
++                      thermal-sensors = <&tsadc 1>;
++
++                      trips {
++                              gpu_alert0: gpu_alert0 {
++                                      temperature = <75000>;
++                                      hysteresis = <2000>;
++                                      type = "passive";
++                              };
++                              gpu_crit: gpu_crit {
++                                      temperature = <95000>;
++                                      hysteresis = <2000>;
++                                      type = "critical";
++                              };
++                      };
++
++                      cooling-maps {
++                              map0 {
++                                      trip = <&gpu_alert0>;
++                                      cooling-device =
++                                              <&gpu THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
++                              };
++                      };
++              };
++      };
+       sdio_pwrseq: sdio-pwrseq {
+               compatible = "mmc-pwrseq-simple";
+               clocks = <&rk808 1>;

Reply via email to