[PATCH 0/6] pwm: New abstraction and userspace API
Uwe Kleine-König
u.kleine-koenig at baylibre.com
Mon Jul 8 03:52:26 PDT 2024
Hello,
this series implements a new abstraction to model the output waveform of
a PWM. The main improvement is that it defines a duty_offset instead of
a polarity and so allows to model more wave forms. The motivation for
this is that we need a PWM channel to have an offset compared to another
channel from the same chip, that is something like that:
__ __ __
/ \_______________/ \_______________/ \_________
^ __ ^ __ ^ __
____/ \_______________/ \_______________/ \_____
^ ^ ^
The kernel API for that is still missing (so it cannot be used yet from
the iio driver we intend to use it), but there is a userspace API that
makes use of it.
This is actually the 2nd series that implements a userspace API using a
chardev, the userspace lib from the last iteration is updated
accordingly. See
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/libpwm.git
The series bases on top of
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
plus the patch
pwm: Make info in traces about affected pwm more useful
available at
https://lore.kernel.org/linux-pwm/20240705211452.1157967-2-u.kleine-koenig@baylibre.com/
.
Unfortunately this requires a new set of callbacks for lowlevel drivers.
In this series axi-pwmgen and stm32 are converted accordingly.
The documentation situation is not optimal yet, and I expect that the
locking patch triggers a lockdep warning for the meson driver. This is
however a false positive and a problem that needs addressing in the clk
subsystem.
Looking forward to your feedback,
Uwe Kleine-König
Uwe Kleine-König (6):
pwm: Add more locking
pwm: New abstraction for PWM waveforms
pwm: Add support for pwmchip devices for faster and easier userspace
access
pwm: Add tracing for waveform callbacks
pwm: axi-pwmgen: Implementation of the waveform callbacks
pwm: stm32: Implementation of the waveform callbacks
drivers/pwm/core.c | 678 +++++++++++++++++++++++++++++++++--
drivers/pwm/pwm-axi-pwmgen.c | 148 +++++---
drivers/pwm/pwm-stm32.c | 605 +++++++++++++++++++------------
include/linux/pwm.h | 51 +++
include/trace/events/pwm.h | 134 ++++++-
include/uapi/linux/pwm.h | 24 ++
6 files changed, 1334 insertions(+), 306 deletions(-)
create mode 100644 include/uapi/linux/pwm.h
base-commit: 120a528213b6693214e3cbc24a9c3052a4b1024b
prerequisite-patch-id: 0e21153cd012f41ba9db52357fd08219af53e26c
--
2.43.0
More information about the linux-arm-kernel
mailing list