PWM device busy, can't echo to period/duty cycle

la7lowla7low New Member Posts: 1
edited April 13 in UP Board Linux

Hello,

I was using PWM to control a cooling fan with the up2 for a while now and it was working until a recent system update (with updates to linux and linux-firmware).
I get 'Device or resource busy' error, see:

$ echo 0 > /sys/class/pwm/pwmchip0/export
$ echo 3413333 > /sys/class/pwm/pwmchip0/pwm0/period
/usr/bin/echo: write error: Device or resource busy
$ echo 1706667 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
/usr/bin/echo: write error: Invalid argument
$ echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable 

I am on arch linux:

$ uname -a                                                                                                                                                                    
Linux up2 5.6.3-arch1-1 #1 SMP PREEMPT Wed, 08 Apr 2020 07:47:16 +0000 x86_64 GNU/Linux
$ sudo pacman -Qs linux-firmware                                                                                                                                              
local/linux-firmware 20200316.8eb0b28-1
    Firmware files for Linux

The latest 5.0 BIOS is used with restored/optimized defaults, except quiet boot is disabled and at IGD panel two settings are disabled.

In dmesg there are three 'pwm' related messages:

$ dmesg | grep -i pwm                                                                                                                                                         
[  +0.105524] pwm-lpss 0000:00:1a.0: can't derive routing for PCI INT A
[  +0.000005] pwm-lpss 0000:00:1a.0: PCI INT A: not connected
[Apr13 11:46] pwm-lpss 0000:00:1a.0: PWM_SW_UPDATE was not cleared

Does anyone have a suggestion what might prevent me from echoing to the files in pwm0? What could be blocking the channel?
I tried also pwm pin 33, channel 1 but got the same error.

Thanks a lot in advance!

PS. I have some udev rules that lets the gpiousers group access to the pwmchip directory so I do not need sudo (in case you wondered), see:

$ cat /etc/udev/rules.d/50-pwm.rules                                                                                                                                          
SUBSYSTEM=="pwm", PROGRAM="/bin/sh -c '\
    chown -R root:gpiouser /sys/class/pwm && chmod -R 770 /sys/class/pwm;\
    chown -R root:gpiouser /sys/devices/pci0000:00/0000:00:1a.0/pwm/pwmchip* && chmod -R 770 /sys/devices/pci0000:00/0000:00:1a.0/pwm/pwmchip*;\
'"
Tagged:
Sign In or Register to comment.