-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport the upstream PWM GPIO driver from 6.11 to rpi-6.6.y #6450
Conversation
commit 7f61257 upstream. Add a software PWM which toggles a GPIO from a high-resolution timer. This will naturally not be as accurate or as efficient as a hardware PWM, but it is useful in some cases. I have for example used it for evaluating LED brightness handling (via leds-pwm) on a board where the LED was just hooked up to a GPIO, and for a simple verification of the timer frequency on another platform. Since high-resolution timers are used, sleeping GPIO chips are not supported and are rejected in the probe function. Signed-off-by: Vincent Whitchurch <[email protected]> Co-developed-by: Stefan Wahren <[email protected]> Signed-off-by: Stefan Wahren <[email protected]> Co-developed-by: Linus Walleij <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Tim Gover <[email protected]> pwm: Backport pwm-gpio.c to rpi-6.6.y
The usual set of defconfigs is:
We don't use |
Enable the PWM GPIO module in Raspberry Pi kernels. Signed-off-by: Tim Gover <[email protected]>
Signed-off-by: Tim Gover <[email protected]>
07ee2d3
to
5567cb3
Compare
@Gadgetoid FYI, the backport of the pwm-gpio should be in rpi-update relatively soon. It worked ok on a Pi5 with a MG946 servo and seemed solid under normal loads. Maxing out the PCIe link can cause a very small but observable wobble on the servo. |
Thank you! Can confirm this works from source (rpi-update hasn't got the memo just yet). From my earlier testing jitter and accuracy were lightyears ahead of the common userspace software PWM alternatives. It's just a shame the |
See: raspberrypi/linux#6450 kernel: dts: 2712: Drop some numa options from bootargs See: raspberrypi/linux#6434
See: raspberrypi/linux#6450 kernel: dts: 2712: Drop some numa options from bootargs See: raspberrypi/linux#6434
Backport this driver to provide bit bashed PWM support on an arbitrary GPIO pin.
On Pi5 this is considerably faster than doing this from user space but this is still constrained somewhat by PCIe latency and jitter if the PCIe link is under a high load (e.g. USB3). This should still be suitable for simple applications like servos.