I have absolutely no idea about that, but what I’ve managed to find so far is that LibreELEC is using kernel 6.6 and has libgpiod v2.2 present. I managed to control my PWM fan by hooking up the 5V wire (red) to pin 2, ground (black) to pin 6 and pwm-wire (blue) to pin 11 (GPIO4_C2). Then I can turn the fan on and off by performing gpioset -c 4 18=0
and gpioset -c 4 18=1
. I have tried a small bash script in which I simulate some sort of pulse which seem to be working:
for i in $(seq 1 500 ); do gpioset -p 10ms -t0 -c 4 18=1; gpioset -p 10ms -t0 -c 4 18=0; done
Below is a list of the pwm-folders on the system, as noticed there is no “pwm0”-folder present and when trying to enable it (echo 0 > /sys/class/pwm/pwmchip0/export
) you are faced with a Device or resource busy
error (maybe because it probably should be pwmchip4 and not pwmchip0, but no other chip is present in the folder).
Below you can see the folder structures (also posted on the LibreELEC-forum):
# 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
# 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
# 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
Br