pwm: New abstraction and userspace API
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest8 patches 13 repliesIn review
- v47 patches 16 repliesSuperseded
- v38 patches 10 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 8 patches | 14 replies | Superseded | |
| v1 | 6 patches | 10 replies | Superseded |
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | pwm: Add more lockingdrivers/ include/ | +105 | 0 replies | |
| 2/8 | pwm: New abstraction for PWM waveformsdrivers/ include/ | +249 | 3 replies | |
| 3/8 | pwm: Provide new consumer API functions for waveformsdrivers/ include/ | +266 | 3 replies | |
| 4/8 | pwm: Add tracing for waveform callbacksdrivers/ include/ | +146 | 0 replies | |
| 5/8 | pwm: axi-pwmgen: Implementation of the waveform callbacksdrivers/ | +108 | 1 reply | |
| 6/8 | pwm: stm32: Implementation of the waveform callbacksdrivers/ | +391 | 3 replies | |
| 7/8 | pwm: Reorder symbols in core.cdrivers/ | +156 | 0 replies | |
| 8/8 | pwm: Add support for pwmchip devices for faster and easier userspace accessdrivers/ include/ include/ | +311 | 3 replies |
Reviews trailers per patch
None of the 8 patches has a Reviewed-by or Acked-by.
| Patch | Trevor Gamblin |
|---|---|
| 1/8 | |
| 2/8 | T-b |
| 3/8 | T-b |
| 4/8 | |
| 5/8 | T-b |
| 6/8 | |
| 7/8 | |
| 8/8 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 0/8] pwm: New abstraction and userspace API
Hello,
here comes v5 of the series to add support for duty offset in PWM waveforms. With that (and using two PWMs of a single chip) the following waveform pair can be configured:
______ ______ ______ ______
PWM #0 ___/ \_______/ \_______/ \_______/ \_______
__ __ __ __
PWM #1 _____/ \___________/ \___________/ \___________/ \_________
^ ^ ^ ^
This is required for an adc driver by Trevor Gamblin[1]. The last patch also adds a new userspace API using a character device per pwm_chip (if the underlaying lowlevel driver support the new waveform callbacks). Compared to the earlier revisions of this series it was moved to the last patch because I don't intend to apply it during the next development cycle. The reason that makes me hesitate is that the return value convention by the .round_waveform_tohw() callback is unusual: It returns either 0 or 1 or a negative error value. These return values are passed to userspace as the return value of the added ioctl() calls and so are not changable any more once they are considered part of the userspace API. So for now the pwm internal convention stays unusual as it was before, but can still be easily adapted if practise showed the convention to be too bad to keep.
If you want to test this series, the current state is available at
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/chardev .
Changes since v4 which is available at
https://lore.kernel.org/linux-pwm/[email protected]
:
- As described above: New patch to reorder symbols in core.c and the character device patch is moved to the end.
- PWM_IOCTL_REQUEST is now mandatory before using a pwm device via the pwmchip character device. Thanks to David for input here. The libpwm repo[2] is updated accordingly.
- PWM_IOCTL_REQUEST and PWM_IOCTL_FREE calling convention changed. Before you had to do:
someuint = 3; ioctl(pwmchipfd, PWM_IOCTL_REQUEST, &someuint);
Now it's just:
ioctl(pwmchipfd, PWM_IOCTL_REQUEST, 3);
- There is a new patch that reorders functions in drivers/pwm/core.c. The motivation for that was a locking issue in the ioctl code where pwm_lock was taken twice on PWM_IOCTL_FREE. So a new variant of pwm_put() was introduced that relies on the caller to have grabbed the lock already. To not have to declare this new function, it had to be moved further up in core.c
- Some debugging code removed. (huh, thanks to David for noticing.)
- Additions to comments (also kernel doc) and commit logs for several patches to (hopefully) make things clearer.
- Refactored how the input is validated for the PWM_IOCTL_SET*WF ioctls to remove code duplication. (IIRC this was feedback on an earlier revision. But I only remembered it and couldn't find it in my mailbox. I think it was Fabrice who wrote that, but I'm not entirely sure. Thanks to whoever it was.)
Unless something grave pops up, I intend to add this series (without the last patch) to next after the merge window closes to give it some more exposure and testing. I'm pretty sure the code still has to be fixed and improved here and there, but I will do that in-tree then. Once I'm sure it will go in, I'll create a tag for Jonathan to merge into his iio tree to allow him to apply Trevor's adc driver.
@Jonathan: What's your desired timing? I'd target for around -rc3 time to create that tag for you. Is that early enough for you?
Best regards
Uwe
[1] https://lore.kernel.org/linux-iio/[email protected]
[2] https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/libpwm.git
Uwe Kleine-König (8):
pwm: Add more locking
pwm: New abstraction for PWM waveforms
pwm: Provide new consumer API functions for waveforms
pwm: Add tracing for waveform callbacks
pwm: axi-pwmgen: Implementation of the waveform callbacks
pwm: stm32: Implementation of the waveform callbacks
pwm: Reorder symbols in core.c
pwm: Add support for pwmchip devices for faster and easier userspace access
drivers/pwm/core.c | 1144 +++++++++++++++++++++++++++++----- drivers/pwm/pwm-axi-pwmgen.c | 154 +++-- drivers/pwm/pwm-stm32.c | 612 +++++++++++------- include/linux/pwm.h | 58 +- include/trace/events/pwm.h | 134 +++- include/uapi/linux/pwm.h | 32 + 6 files changed, 1693 insertions(+), 441 deletions(-) create mode 100644 include/uapi/linux/pwm.h
base-commit: d242feaf81d63b25d8c1fb1a68738dc33966a376
Signature · 1 line
2.45.2