|
|
Log in / Subscribe / Register

pwm: New abstraction and userspace API

From:  Uwe Kleine-König <u.kleine-koenig-AT-baylibre.com>
To:  linux-pwm-AT-vger.kernel.org
Subject:  [PATCH 0/6] pwm: New abstraction and userspace API
Date:  Mon, 08 Jul 2024 12:52:26 +0200
Message-ID:  <cover.1720435656.git.u.kleine-koenig@baylibre.com>
Cc:  Steven Rostedt <rostedt-AT-goodmis.org>, Masami Hiramatsu <mhiramat-AT-kernel.org>, Mathieu Desnoyers <mathieu.desnoyers-AT-efficios.com>, linux-trace-kernel-AT-vger.kernel.org, Michael Hennerich <michael.hennerich-AT-analog.com>, Nuno Sá <nuno.sa-AT-analog.com>, Fabrice Gasnier <fabrice.gasnier-AT-foss.st.com>, Maxime Coquelin <mcoquelin.stm32-AT-gmail.com>, Alexandre Torgue <alexandre.torgue-AT-foss.st.com>, linux-stm32-AT-st-md-mailman.stormreply.com, linux-arm-kernel-AT-lists.infradead.org
Archive-link:  Article

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/...

The series bases on top of

        https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/... 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-...
.

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




Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds