[PATCH 0/2 v3] pwm: add support for duty_offset

Trevor Gamblin posted 2 patches 1 year, 8 months ago
drivers/pwm/core.c           | 79 +++++++++++++++++++++++++++++++++---
drivers/pwm/pwm-axi-pwmgen.c | 20 ++++++++-
include/linux/pwm.h          | 15 +++++++
include/trace/events/pwm.h   |  6 ++-
4 files changed, 112 insertions(+), 8 deletions(-)
[PATCH 0/2 v3] pwm: add support for duty_offset
Posted by Trevor Gamblin 1 year, 8 months ago
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.

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. 

Note that in addition to the other patches in this series, the changes
to the axi-pwmgen driver rely on [1], which hasn't been picked up yet.

[1] https://lore.kernel.org/linux-pwm/20240424125850.4189116-1-tgamblin@baylibre.com/

---
v3 changes:
* rebased on top of latest pwm/for-next
* removed changes related to cdev to match current pwm tree
* fixed minor whitespace issue caught by checkpatch

Link to v2: https://lore.kernel.org/linux-pwm/20240409174126.1296318-1-tgamblin@baylibre.com/

v2 changes:
* Address feedback for driver in v1:
  * Remove supports_offset flag in pwm_chip struct, and references to it
    in the axi-pwmgen driver patch
  * Drop pwm_config_full patch entirely
  * Don't return EINVAL when state->duty_offset + state->duty_cycle >
    state->period in __pwm_apply(), since this is valid as long as
    neither is greater than state->period on its own
  * Add a check to disallow setting the PWM signal as inverse and a
    nonzero duty_offset at the same time in __pwm_apply(), with a
    comment explaining why

Link to v1 (RFC): https://lore.kernel.org/linux-pwm/20240405003025.739603-1-tgamblin@baylibre.com/

Trevor Gamblin (2):
  pwm: add duty offset support
  pwm: axi-pwmgen: add duty offset support

 drivers/pwm/core.c           | 79 +++++++++++++++++++++++++++++++++---
 drivers/pwm/pwm-axi-pwmgen.c | 20 ++++++++-
 include/linux/pwm.h          | 15 +++++++
 include/trace/events/pwm.h   |  6 ++-
 4 files changed, 112 insertions(+), 8 deletions(-)

-- 
2.45.1
Re: [PATCH 0/2 v3] pwm: add support for duty_offset
Posted by Uwe Kleine-König 1 year, 7 months ago
Hello Trevor,

On Tue, May 21, 2024 at 03:49:14PM -0400, Trevor Gamblin wrote:
> 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.
> 
> 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. 
> 
> Note that in addition to the other patches in this series, the changes
> to the axi-pwmgen driver rely on [1], which hasn't been picked up yet.
> 
> [1] https://lore.kernel.org/linux-pwm/20240424125850.4189116-1-tgamblin@baylibre.com/

I'm working on a more complete variant of that. It works in a prototype
stage, I hope to be able to send it out later today. I'll drop this
series from patchwork.

Best regards
Uwe
Re: [PATCH 0/2 v3] pwm: add support for duty_offset
Posted by Uwe Kleine-König 1 year, 8 months ago
Hello Trevor,

On Tue, May 21, 2024 at 03:49:14PM -0400, Trevor Gamblin wrote:
> 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.
> 
> 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. 
> 
> Note that in addition to the other patches in this series, the changes
> to the axi-pwmgen driver rely on [1], which hasn't been picked up yet.
> 
> [1] https://lore.kernel.org/linux-pwm/20240424125850.4189116-1-tgamblin@baylibre.com/

You can do yourself a favour and use git format-patch's --base option to
(additionally) tell this in a way that the autobuild bots understand.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |