mbox series

[v2,0/8] pwm: New abstraction and userspace API

Message ID cover.1721040875.git.u.kleine-koenig@baylibre.com
Headers show
Series pwm: New abstraction and userspace API | expand

Message

Uwe Kleine-König July 15, 2024, 11:16 a.m. UTC
Hello,

here comes v2 of the series, (implicit) v1 can be found at
https://lore.kernel.org/linux-pwm/cover.1720435656.git.u.kleine-koenig@baylibre.com/.

It 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:

         __                 __                 __
        /  \_______________/  \_______________/  \_________
        ^    __            ^    __            ^    __
        ____/  \_______________/  \_______________/  \_____
        ^                  ^                  ^

Compared to the previous submission the following things changed:

 - rebase to current pwm/for-next

 - Some more simplifications and cleanups upfront

 - new commit to provide API functions for consumers
   These were added as needed in the respective commits (and not exported)
   before, but it should be easier to review this way.

 - Add padding to the userspace struct pwmchip_waveform

 - shifted the introduction of some helper functions to earlier commits to have
   less code that is introduced in one patch and then refactored in a later one.

 - stricter input validation

 - implement PWM_IOCTL_ROUNDWF ioctl

 - Commit #6 got a change log and sign-off (was #4 before) 🙄

I updated the pwm/chardev branch to hold this series.

I dropped Trevor's R-b tag for patch #5 (patch #3 before) because the
patch was modified in non-trivial ways. I hesitated to keep his T-b for
patch #7 (patch #5 before), because while the axi-pwmgen patch didn't
change, it builds on top of the previous patches. I kept it anyhow.

Thanks to Trevor and Nuno for feedback to the previous submission.

Best regards
Uwe

Uwe Kleine-König (8):
  pwm: Simplify pwm_capture()
  pwm: Add more locking
  pwm: New abstraction for PWM waveforms
  pwm: Provide new consumer API functions for 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           | 809 +++++++++++++++++++++++++++++++++--
 drivers/pwm/pwm-axi-pwmgen.c | 148 +++++--
 drivers/pwm/pwm-stm32.c      | 605 ++++++++++++++++----------
 include/linux/pwm.h          |  57 ++-
 include/trace/events/pwm.h   | 134 +++++-
 include/uapi/linux/pwm.h     |  25 ++
 6 files changed, 1470 insertions(+), 308 deletions(-)
 create mode 100644 include/uapi/linux/pwm.h


base-commit: 240b129d597cb8a8880eb3a381ff10eb98ca0c07
prerequisite-patch-id: 0e21153cd012f41ba9db52357fd08219af53e26c
prerequisite-patch-id: b22c91bbc4e3412f8e7e1f796ed18570ae021c96