Openwrt 24.10 R5S Fan Not Working

I recently purchased the FriendlyElec NanoPi R5S, which is now officially supported by OpenWRT. I have connected a 5V fan to the dedicated fan connector on the board. While testing it on FriendlyWRT 22.03, the fan worked perfectly—it automatically started when the CPU temperature increased. However, this behavior is not observed when using OpenWRT. Could someone guide me in the right direction? Perhaps my question is incorrect, or this functionality is not supported by the official OpenWRT firmware. Any assistance would be greatly appreciated, especially with the summer heat in India, as the board's idle temperature with just a heatsink is around 60°C.

This exists for the R2, so I imagine it's something identical for the R5.

/*
 *
 * Kernel 5.x
 *
*/
#define UNEXPORT_PWM0_PATH  "/sys/class/pwm/pwmchip0/unexport"
#define EXPORT_PWM0_PATH    "/sys/class/pwm/pwmchip0/export"
#define PWM0_PATH           "/sys/class/pwm/pwmchip0/pwm0"
#define ENABLE_PWM0_PATH    "/sys/class/pwm/pwmchip0/pwm0/enable"
#define POLARITY_PWM0_PATH  "/sys/class/pwm/pwmchip0/pwm0/polarity"
#define DUTY_PWM0_PATH      "/sys/class/pwm/pwmchip0/pwm0/duty_cycle"
#define PERIOD_PWM0_PATH    "/sys/class/pwm/pwmchip0/pwm0/period"
#define CPU_TEMP_PATH       "/sys/class/thermal/thermal_zone0/temp"
#define PWM0_PID            "/var/run/fan-monitor.pid"

First try something like

echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
echo 100000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle

To see whether it does what's needed.

There seems to be some init.d modifications to use as a starting point which can be integrated into openwrt here.

1 Like

Then again, there's 052-14-v6.11-arm64-dts-rockchip-enable-automatic-fan-control-on-Rock-5.patch which seems should have some effect, if it correctly applies.

See https://lore.kernel.org/all/20240617-rk-dts-additions-v5-4-c1f5f3267f1e@gmail.com/

1 Like

Have tried the other thing which you mentioned:[didn't work], except this init.d modification. I'll look more into this git and find any thing working. btw thanks for this fast response..

this is new to me, have to look in this too though I don't have any kernel level knowledge but i'll find something