As you are on a Pi5 you could consider using the PIO block - there is a pio-pwm driver that presents the usual kernel PWM interface in /sys/class/pwm:
Code:
$ dtoverlay -h pwm-pioName: pwm-pioInfo: Configures a GPIO pin as PIO-assisted PWM output. Unlike hardware PWM, this can be used on any RP1 GPIO in bank 0 (0-27). Up to 4 are supported, assuming nothing else is using PIO. Pi 5 only.Usage: dtoverlay=pwm-pio,<param>=<val>Params: gpio Output GPIO (0-27, default 4)Statistics: Posted by PhilE — Wed Jul 16, 2025 1:19 pm