Skip to content

driver: pwm: create ambiq pwm driver #92214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AlessandroLuo
Copy link
Contributor

@AlessandroLuo AlessandroLuo commented Jun 26, 2025

This PR adds a new Ambiq PWM driver based on the on-chip timer/ctimer peripherals and integrates it into Zephyr’s build and DT infrastructure.

@AlessandroLuo AlessandroLuo requested a review from Copilot June 26, 2025 07:42
Copilot

This comment was marked as outdated.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for Ambiq PWM via both TIMER and CTIMER peripherals, including driver implementations, device tree bindings, and board/sample overlays.

  • Introduce two new PWM drivers (pwm_ambiq_timer and pwm_ambiq_ctimer) with full Zephyr driver API implementations
  • Add DTS binding schemas (ambiq,timer-pwm.yaml, ambiq,ctimer-pwm.yaml) and include <zephyr/dt-bindings/pwm/pwm.h> in Ambiq SoC DTS files
  • Update Kconfig, CMakeLists, and board/sample overlays to enable and test the new PWM controllers

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
drivers/pwm/pwm_ambiq_timer.c Implements TIMER-based PWM driver and init logic
drivers/pwm/pwm_ambiq_ctimer.c Implements CTIMER-based PWM driver and init logic
dts/bindings/pwm/ambiq,timer-pwm.yaml Defines binding schema for ambiq,timer-pwm
dts/bindings/pwm/ambiq,ctimer-pwm.yaml Defines binding schema for ambiq,ctimer-pwm
drivers/pwm/Kconfig.ambiq_timer Adds Kconfig entries for both Ambiq PWM drivers
drivers/pwm/CMakeLists.txt Registers new PWM drivers in build
dts/arm/ambiq/ambiq_apollo510.dtsi Includes PWM DTS entries under timer@… nodes

Copy link
Contributor

@pdgendt pdgendt left a comment

Choose a reason for hiding this comment

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

DEVICE_API already provides const struct

@pdgendt pdgendt dismissed their stale review June 26, 2025 09:38

comment addressed

@AlessandroLuo AlessandroLuo force-pushed the ambiq-pwm-merge branch 2 times, most recently from c7d67cd to 8db324d Compare June 26, 2025 10:48
@AlessandroLuo AlessandroLuo marked this pull request as ready for review June 26, 2025 12:29
@github-actions github-actions bot added area: Samples Samples area: LED Label to identify LED subsystem area: Counter area: PWM Pulse Width Modulation platform: Ambiq Ambiq area: Timer Timer labels Jun 26, 2025
@AlessandroLuo
Copy link
Contributor Author

@kartben please help to review this PR, thank you!

@kartben kartben removed their assignment Jun 26, 2025
@kartben
Copy link
Contributor

kartben commented Jun 26, 2025

@kartben please help to review this PR, thank you!

It looks reasonable but would be good to have PWM people review as I know close to nothing about PWM :)

@kartben
Copy link
Contributor

kartben commented Jun 26, 2025

@AlessandroLuo Also, it's highly unlikely this can make the cut for tomorrow's feature freeze given this will have been in review for less than two days by then. Release managers might allow exceptions though :)

aaronyegx
aaronyegx previously approved these changes Jun 27, 2025
@AlessandroLuo AlessandroLuo dismissed stale reviews from aaronyegx and RichardSWheatley via 8a7a1fe June 27, 2025 09:21
@AlessandroLuo AlessandroLuo force-pushed the ambiq-pwm-merge branch 2 times, most recently from 8a7a1fe to 42bdc29 Compare June 27, 2025 09:33
RichardSWheatley and others added 5 commits June 30, 2025 10:38
Restructured counter and timer.
CTimer/Timer is now parent to pwm and counter.
Created PWM driver and tied to pwm and pwm-led

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
Move clk-source from pwm to timer
change associated files to match

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
check for max number of children in timer.

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
changed variable names from timer to ctimer

Signed-off-by: Hao Luo <hluo@ambiq.com>
This commit adds support for Apollo510 pwm driver

Signed-off-by: Hao Luo <hluo@ambiq.com>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Counter area: LED Label to identify LED subsystem area: PWM Pulse Width Modulation area: Samples Samples area: Timer Timer platform: Ambiq Ambiq
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants