From: Trevor Gamblin <tgamblin@baylibre.com>
To: linux-pwm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, u.kleine-koenig@pengutronix.de,
michael.hennerich@analog.com, nuno.sa@analog.com,
tgamblin@baylibre.com, dlechner@baylibre.com
Subject: [RFC PATCH 0/3] pwm: add support for duty_offset
Date: Thu, 4 Apr 2024 20:30:22 -0400 [thread overview]
Message-ID: <20240405003025.739603-1-tgamblin@baylibre.com> (raw)
This series extends the PWM subsystem to support the duty_offset feature
found on some PWM devices. It includes a patch to enable this feature
for the axi-pwmgen driver, which can also serve as an example of how to
implement it for other devices. It also contains a patch adding a new
pwm_config_full() function mirroring the behavior of pwm_config() but
with duty_offset included, to help maintain compatibility for drivers
that don't support the feature.
The series was tested on actual hardware using a Zedboard. An
oscilloscope was used to validate that the generated PWM signals matched
the requested ones. The libpwm [1] tool was also used for testing the
char device functionality.
The series is marked RFC as there are some outstanding questions about
implementation:
1. In drivers/pwm/core.c, __pwm_apply() was modified to check that the
sum of state->duty_offset + state->duty_cycle does not exceed
state->period, but in the character device section these values are
being checked separately. Is this intentional? What is the intended
behavior?
2. Should __pwm_apply() explicitly disallow PWM_POLARITY_INVERSED and
duty_offset together?
3. Are there other places that would need duty_offset handling which
have been missed?
Note that in addition to the other patches in this series, the changes
to the axi-pwmgen driver rely on [2] and [3], which haven't been picked
up yet.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/libpwm.git/
[2] https://lore.kernel.org/linux-pwm/20240301173343.1086332-1-tgamblin@baylibre.com/
[3] https://lore.kernel.org/linux-pwm/20240314204722.1291993-1-tgamblin@baylibre.com/
Trevor Gamblin (3):
pwm: add duty offset support
pwm: axi-pwmgen: add duty offset support
pwm: add pwm_config_full to pwm.h
drivers/pwm/core.c | 75 +++++++++++++++++++++++++++++++++---
drivers/pwm/pwm-axi-pwmgen.c | 35 +++++++++++++----
include/linux/pwm.h | 52 ++++++++++++++++++++++---
include/trace/events/pwm.h | 6 ++-
4 files changed, 147 insertions(+), 21 deletions(-)
--
2.44.0
next reply other threads:[~2024-04-05 0:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 0:30 Trevor Gamblin [this message]
2024-04-05 0:30 ` [RFC PATCH 1/3] pwm: add duty offset support Trevor Gamblin
2024-04-05 0:30 ` [RFC PATCH 2/3] pwm: axi-pwmgen: " Trevor Gamblin
2024-04-05 0:30 ` [RFC PATCH 3/3] pwm: add pwm_config_full to pwm.h Trevor Gamblin
2024-04-05 6:23 ` [RFC PATCH 0/3] pwm: add support for duty_offset Uwe Kleine-König
2024-04-05 14:19 ` Trevor Gamblin
2024-04-05 15:14 ` Uwe Kleine-König
2024-04-05 17:03 ` David Lechner
2024-04-05 19:55 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240405003025.739603-1-tgamblin@baylibre.com \
--to=tgamblin@baylibre.com \
--cc=dlechner@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).