Hi! First time posting, some time lurking.
First off, I am new to GPIO, PWM and working in /sys (new as in have read a bunch but very little practise) so please be patient in my noobiness.
I have a couple of Radxa Rock 4 SE's with some options for which I've designed and printed a chassis/case for, and since the units are now encapsulated I decided on adding a small Noctua 40mm 5V PWM-fan to help with air flow and cooling connected to pins 2=5V, 9=GND and 11=PWM0 (pinout table). The fan is currently running, albeit a bit loud, which makes me think that it is currently not being controlled.
I have found the following thread on the Radxa forum in which a user had submitted a script on GitHub that supposedly helps with this, but in order to use it he says that the PWM-pin need to be enabled in the OS (hence why I am here). Is this done already in LibreELEC or what would I need to do? I have found previous threads from 6 years ago in which it is stated that I would need to compile the kernel (kernel 4 was relevant back then) with some patches applied but I am not certain if that is necessary today.
I do see some stuff present regarding pwm in the sys folder
# find /sys -name pwm*
/sys/kernel/debug/pwm
/sys/class/pwm
/sys/class/pwm/pwmchip0
/sys/devices/platform/ff420020.pwm/pwm
/sys/devices/platform/ff420020.pwm/pwm/pwmchip0
/sys/bus/platform/drivers/pwm-clock
/sys/bus/platform/drivers/pwm-regulator
/sys/bus/platform/drivers/pwm-backlight
/sys/firmware/devicetree/base/pwm@ff420020
/sys/firmware/devicetree/base/pwm@ff420010
/sys/firmware/devicetree/base/pwm@ff420000
/sys/firmware/devicetree/base/pinctrl/pwm1
/sys/firmware/devicetree/base/pinctrl/pwm1/pwm1-pin
/sys/firmware/devicetree/base/pinctrl/pwm1/pwm1-pin-pull-down
/sys/firmware/devicetree/base/pinctrl/pwm3a
/sys/firmware/devicetree/base/pinctrl/pwm3a/pwm3a-pin
/sys/firmware/devicetree/base/pinctrl/pwm2
/sys/firmware/devicetree/base/pinctrl/pwm2/pwm2-pin
/sys/firmware/devicetree/base/pinctrl/pwm2/pwm2-pin-pull-down
/sys/firmware/devicetree/base/pinctrl/pwm0
/sys/firmware/devicetree/base/pinctrl/pwm0/pwm0-pin-pull-down
/sys/firmware/devicetree/base/pinctrl/pwm0/pwm0-pin
/sys/firmware/devicetree/base/pinctrl/pwm3b
/sys/firmware/devicetree/base/pinctrl/pwm3b/pwm3b-pin
/sys/firmware/devicetree/base/vdd-log/pwms
/sys/firmware/devicetree/base/vdd-log/pwm-supply
/sys/firmware/devicetree/base/__symbols__/pwm3a_pin
/sys/firmware/devicetree/base/__symbols__/pwm0_pin
/sys/firmware/devicetree/base/__symbols__/pwm3
/sys/firmware/devicetree/base/__symbols__/pwm3b_pin
/sys/firmware/devicetree/base/__symbols__/pwm1
/sys/firmware/devicetree/base/__symbols__/pwm1_pin
/sys/firmware/devicetree/base/__symbols__/pwm1_pin_pull_down
/sys/firmware/devicetree/base/__symbols__/pwm2_pin
/sys/firmware/devicetree/base/__symbols__/pwm2
/sys/firmware/devicetree/base/__symbols__/pwm2_pin_pull_down
/sys/firmware/devicetree/base/__symbols__/pwm0
/sys/firmware/devicetree/base/__symbols__/pwm0_pin_pull_down
/sys/firmware/devicetree/base/pwm@ff420030
Display More
# ls -lRt /sys/devices/platform/ff420020.pwm/
/sys/devices/platform/ff420020.pwm/:
total 0
lrwxrwxrwx 1 root root 0 Mar 25 08:29 consumer:platform:vdd-log -> ../../virtual/devlink/platform:ff420020.pwm--platform:vdd-log
lrwxrwxrwx 1 root root 0 Mar 25 08:29 driver -> ../../../bus/platform/drivers/rockchip-pwm
-rw-r--r-- 1 root root 4096 Mar 25 08:29 driver_override
-r--r--r-- 1 root root 4096 Mar 25 08:29 modalias
lrwxrwxrwx 1 root root 0 Mar 25 08:29 of_node -> ../../../firmware/devicetree/base/pwm@ff420020
drwxr-xr-x 2 root root 0 Mar 25 08:29 power
lrwxrwxrwx 1 root root 0 Mar 25 08:29 supplier:platform:pinctrl -> ../../virtual/devlink/platform:pinctrl--platform:ff420020.pwm
drwxr-xr-x 3 root root 0 Feb 27 2024 pwm
lrwxrwxrwx 1 root root 0 Feb 27 2024 subsystem -> ../../../bus/platform
-rw-r--r-- 1 root root 4096 Feb 27 2024 uevent
/sys/devices/platform/ff420020.pwm/power:
total 0
-rw-r--r-- 1 root root 4096 Mar 25 08:29 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 Mar 25 08:29 control
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_active_time
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_status
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_suspended_time
/sys/devices/platform/ff420020.pwm/pwm:
total 0
drwxr-xr-x 3 root root 0 Feb 27 2024 pwmchip0
/sys/devices/platform/ff420020.pwm/pwm/pwmchip0:
total 0
--w------- 1 root root 4096 Mar 25 09:59 export
lrwxrwxrwx 1 root root 0 Mar 25 08:29 device -> ../../../ff420020.pwm
-r--r--r-- 1 root root 4096 Mar 25 08:29 npwm
drwxr-xr-x 2 root root 0 Mar 25 08:29 power
--w------- 1 root root 4096 Mar 25 08:29 unexport
lrwxrwxrwx 1 root root 0 Feb 27 2024 subsystem -> ../../../../../class/pwm
-rw-r--r-- 1 root root 4096 Feb 27 2024 uevent
/sys/devices/platform/ff420020.pwm/pwm/pwmchip0/power:
total 0
-rw-r--r-- 1 root root 4096 Mar 25 08:29 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 Mar 25 08:29 control
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_active_time
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_status
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_suspended_time
Display More
# ls -lRt /sys/class/pwm/pwmchip0/
/sys/class/pwm/pwmchip0/:
total 0
--w------- 1 root root 4096 Mar 25 09:59 export
lrwxrwxrwx 1 root root 0 Mar 25 08:29 device -> ../../../ff420020.pwm
-r--r--r-- 1 root root 4096 Mar 25 08:29 npwm
drwxr-xr-x 2 root root 0 Mar 25 08:29 power
--w------- 1 root root 4096 Mar 25 08:29 unexport
lrwxrwxrwx 1 root root 0 Feb 27 2024 subsystem -> ../../../../../class/pwm
-rw-r--r-- 1 root root 4096 Feb 27 2024 uevent
/sys/class/pwm/pwmchip0/power:
total 0
-rw-r--r-- 1 root root 4096 Mar 25 08:29 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 Mar 25 08:29 control
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_active_time
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_status
-r--r--r-- 1 root root 4096 Mar 25 08:29 runtime_suspended_time
Display More
I can see in the script linked above that it wants to access /sys/class/pwm/pwmchip0/pwm0 but I seem to be missing that path. Does LibreELEC handle PWM differently or should I have that path?
I cannot find anything regarding PWM in dmesg.
Thanks in advance.