Skip to content

!drivers/pwm: remove PWM_MULTICHAN option - #18864

Merged
linguini1 merged 1 commit into
apache:masterfrom
raiden00pl:pwm_refactor
May 18, 2026
Merged

linguini1 merged 1 commit into
apache:masterfrom
raiden00pl:pwm_refactor

Conversation

@raiden00pl

@raiden00pl raiden00pl commented May 11, 2026 •

Copy link
Copy Markdown
Member

Summary

BREAKING CHANGE: remove PWM_MULTICHAN option

PWM_MULTICHAN option is redundant, we can just set CONFIG_PWM_NCHANNELS > 1. This is the first step to simplify PWM implementation and make it more portable.

apps part apache/nuttx-apps#3475

Impact

simplify API, no functional changes. old CONFIG_PWM_MULTICHAN=n is now achieved with CONFIG_PWM_NCHANNELS = 1

Testing

CI

@raiden00pl
raiden00pl marked this pull request as ready for review May 11, 2026 09:14
@raiden00pl raiden00pl added the breaking change This change requires a mitigation entry in the release notes. label May 11, 2026
@github-actions github-actions Bot added Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture and removed breaking change This change requires a mitigation entry in the release notes. labels May 11, 2026
@raiden00pl

raiden00pl commented May 11, 2026 •

Copy link
Copy Markdown
Member Author

CI run with nuttx-apps branch is here: https://github.com/raiden00pl/manual-nuttx-ci/actions/runs/25676150035

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@raiden00pl please fix:

Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/at32/at32_pwm.c:2171:1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/at32/at32_pwm.c:3307:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/efm32/efm32_pwm.c:366:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/efm32/efm32_pwm.c:406:85: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/ht32f4[91](https://github.com/apache/nuttx/actions/runs/25661234964/job/75322078800?pr=18864#step:3:92)x3/ht32f491x3_pwm.c:348:84: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/kinetis/kinetis_pwm.c:368:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/kl/kl_pwm.c:334:79: error: Long line found
Warning: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/lpc17xx_40xx/lpc17_40_mcpwm.c:272:62: warning: Wrong column position of comment right of code
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/ra4/ra_pwm.c:559:81: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/s32k1xx/s32k1xx_pwm.c:363:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32/stm32_pwm.c:3459:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32f0l0g0/stm32_pwm.c:1099:82: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32f0l0g0/stm32_pwm.c:1383:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32f0l0g0/stm32_pwm.h:108:1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32f0l0g0/stm32_pwm.h:339:1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32f7/stm32_pwm.c:3035:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32h5/stm32_pwm.c:19[94](https://github.com/apache/nuttx/actions/runs/25661234964/job/75322078800?pr=18864#step:3:95):1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32h5/stm32_pwm.c:3132:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32h7/stm32_pwm.c:3135:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32l4/stm32l4_pwm.c:3032:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/stm32l4/stm32l4_pwm.c:3156:1: error: Missing blank line before comment found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/tlsr82/tlsr82_pwm.c:337:81: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/risc-v/src/litex/litex_pwm.c:264:84: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/nrf53/thingy53/src/nrf53_rgbled.c:44:1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/nrf53/thingy53/src/nrf53_rgbled.c:52:1: error: Too many blank lines
Error: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/nrf53/thingy53/src/nrf53_rgbled.c:[102](https://github.com/apache/nuttx/actions/runs/25661234964/job/75322078800?pr=18864#step:3:103):1: error: Too many blank lines
Warning: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/stm32/common/src/stm32_xen1210.c:229:44: warning: Wrong column position of comment right of code
Error: /home/runner/work/nuttx/nuttx/nuttx/boards/arm/stm32/photon/src/stm32_rgbled.c:60:1: error: Too many blank lines

jerpelea
jerpelea previously approved these changes May 11, 2026

@michallenc michallenc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so far LGTM, I can test on SAMv7 later today.

acassis
acassis previously approved these changes May 11, 2026
@raiden00pl
raiden00pl force-pushed the pwm_refactor branch 2 times, most recently from 4c46b05 to 95fef1f Compare May 12, 2026 07:27
michallenc
michallenc previously approved these changes May 12, 2026

@michallenc michallenc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on SAMv7, all looks good.

Comment thread arch/arm/src/at32/at32_pwm.c Resolved
Comment thread arch/arm/src/ht32f491x3/Kconfig Resolved
Comment thread arch/arm/src/nrf53/nrf53_pwm.c Resolved
Comment thread arch/arm/src/stm32/stm32_pwm.c Resolved
Comment thread arch/arm/src/stm32f0l0g0/stm32_pwm.c Resolved
Comment thread arch/arm/src/stm32f7/stm32_pwm.c Resolved
Comment thread arch/arm/src/stm32h5/stm32_pwm.c Resolved
BREAKING CHANGE: remove PWM_MULTICHAN option

PWM_MULTICHAN option is redundant, we can just set CONFIG_PWM_NCHANNELS > 1.
At default CONFIG_PWM_NCHANNELS is set to 1, so the default behavior is preserved.
Access to single channel API is now `info->channels[0].XXX` instead of `info->XXX`

This is the first step to simplify PWM implementation and make it more portable.

Signed-off-by: raiden00pl <[email protected]>
@raiden00pl

Copy link
Copy Markdown
Member Author

CI for this PR and apps part (https://github.com/raiden00pl/manual-nuttx-ci/actions/runs/25676150035) pass: https://github.com/raiden00pl/manual-nuttx-ci/actions/runs/25676150035

If we merge this before release 13.0, I can try to separate common PWM driver from pulse count PWM, as discussed here: #12381 (comment)

@linguini1

Copy link
Copy Markdown
Contributor

So this is one of those PRs that needs apps + kernel merge at once? Looks good to me!

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @raiden00pl :-)

@linguini1
linguini1 merged commit 4df80e1 into apache:master May 18, 2026
19 of 54 checks passed
@raiden00pl
raiden00pl deleted the pwm_refactor branch May 18, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Arch: arm64 Issues related to ARM64 (64-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Area: Audio Board: arm Board: risc-v Board: xtensa Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants