In this guide, we'll show you how to set PWM for fan control using the SYSFS method.
Open a terminal and type sudo su
to gain root access.
Type cd /boot/dtb/rockchip
to navigate to the rockchip directory. Next, rename the existing .dtb file by typing mv rk3588s-9tripod-linux.dtb rk3588s-9tripod-linux.dtb.bak
.
Download the new .dtb file from rk3588s-9tripod-linux.dtb and save it in the rockchip directory (/boot/dtb/rockchip). You can do so by using:
curl https://cdn.discordapp.com/attachments/1072231684096933888/1099028185502461992/rk3588s-9tripod-linux.dtb -o /boot/dtb/rockchip/rk3588s-9tripod-linux.dtb
Type reboot
to reboot your device.
Open a terminal and gain root access again by typing sudo su
. Next, navigate to the PWM directory by typing cd /sys/class/pwm/pwmchip15
.
Type echo 0 >export
to export the PWM. If this returns an error, this may already be active - so try skipping this step. Next, navigate to pwm0 by typing cd pwm0
. Set how many time slices to slice each interval of the duty cycle into by entering echo 1000000 >period
. Set the duty cycle to 50% (this is how much of each tiny time slice to send power over the pin) by typing echo 500000 >duty_cycle
.
NOTE: As of this writing, the PWM pins on the Armbian build for the Nova are initiated as inverse polarity, which means that higher numbers on the duty cycle will cause the fan to spin more slowly and lower numbers will cause it to spin faster.
Step 7: Enable the PWM: Type echo 0 >enable
to enable the PWM. At this point, your fan should start spinning! If not, it is possible the polarity is not set to inverse, so try issuing the above command again with a 1 instead of a 0.
Step 8: Add the Fan Control Section to the .dtb File To add the fan control section to the above-referenced .dtb file for automatic fan control based on temperatures, add the following section to that file:
fan0: pwm-fan {
compatible = "pwm-fan";
#cooling-cells = <2>;
pwms = <&pwm11 0 10000 0>;
cooling-levels = <0 64 128 255>;
};
&pwm11 {
pinctrl-0 = <&pwm11m1_pins>;
status = "okay";
};
The above example uses pin 4 for power, 6 for ground, and 8 for PWM control. Thanks again to macroalpha for this information.