Banana pi R3 fan with PWM

Have you tried the patch i suggested (using different top clock)? Which kernel (5.15 vs. 6.1).

I thought this patch was included in the last snapshot. Should I build an image with the patch? Otherwise the kernel is 5.15.126.

No, we have to know first if it solves your issueā€¦have you tried kernel 6.1?

How to try kernel 6.1? master is 5.15.

Same problem here with the RC3 And i donā€™t know how to build a firmware, so even less how to apply a patch :rofl:

You mean PWM doesnā€™t work for you either. Right?

5.15 is known not working

I guess because backported pwm/clock support is different to mainline

The pwm node i upstreamed works for me in mainline kernel without openwrt. So we need someone who can test pwm with openwrt with kernel 6.1 which (hopefully) does not have any openwrt-specific backports for r3

1 Like

The fan start runing when i boot the BPI, after 10/15 seconds it stop. i can start/stop the fan by sending some echo commands, so i donā€™t know if it is runing as expected, i mean starting alone when the temp is high.

Hi @frank-w, I can change the clock in 5.15 dts, but I need some instructions? Do I have to build new image?

Iā€™m experienced in Linux. :grin:

Yes you have to build openwrt from code and stop after patches are applied and then change the clock in dts and continue build-process. I do not know openwrt build tools enough if this is possible without adding an own patch file in the folder structure

Maybe @dangowrt can explain steps? Or maybe test this and add the patch?

1 Like

Try

echo 2 > /sys/class/thermal/cooling_device0/cur_state

Does it turn on the fan? Can you post your boot log?

@Dale Nope. It does not start.

And some more info:

root@openwrt:~# cat /sys/kernel/debug/pwm 
platform/10048000.pwm, 2 PWM devices
 pwm-0   (pwm-fan             ): requested enabled period: 10000 ns duty: 9999 ns polarity: normal
 pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normal

Can you run the same command right after you run the command I suggested?

yes, it turns about 5s and stop.

I use openwrt 23.05.0 RC3 with kernel 5.15.127

Then you have no problem, the thing is the trip points has changed and the fan will only start at 85cā€¦ it has to be changed

1 Like

@Rooot can you also try:

echo 1 > /sys/class/thermal/cooling_device0/cur_state

Do you use snapshot or 23-rc?

i did it already and the fan turns indefinitly (i think)

here it is : https://sharetext.me/209j4zgcdj

@frank-w , as you can see this guy has the pwm clk error on boot log and it still works for him. Perhaps the init has retries? I havenā€™t looked at the code