Created
June 21, 2020 06:29
-
-
Save nuumio/06858ccd8df515569f386a7a00a1cb0d to your computer and use it in GitHub Desktop.
RK3399 "direct PWM" fan control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FILE:/etc/udev/rules.d/99-fan.rules | |
KERNEL=="ff420010.pwm", ACTION=="add", PROGRAM="/usr/local/sbin/fan-control.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# FILE:/usr/local/sbin/fan-control.sh | |
# Default PWM chip if not set (in udev rules for example) | |
PWMCHIP="${PWMCHIP:-pwmchip0}" | |
# Period of 55000 is about 18.2kHz | |
P=55000 | |
# Few duty cycles that don't cause annoying resonance in my setup | |
#D=27000 | |
#D=25600 | |
D=23850 | |
#D=22000 | |
#D=21500 | |
#D=20600 | |
#D=18800 | |
cd /sys/class/pwm/${PWMCHIP} && echo 0 > export && cd pwm0/ && echo $P > period && echo $D > duty_cycle && echo 1 > enable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment