Commit graph

686 commits

Author SHA1 Message Date
Felix Wang
94f525eeb9 dirvers: pwm: Fix pwm_mcux_tpm build error.
Combine mode is not for all TPM IP depneds
on IP version, which is necessary for PWM capture feature.
Add pre-process check and wrap
mcux_tpm_capture_data with CONFIG_PWM_CAPTURE macro.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2025-10-16 17:09:56 +03:00
Felix Wang
705a015b53 drivers: pwm: Enable PWM capture feature for TPM
This implementation refers to the code from FTM,
which supports to capture pulse and period.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2025-10-14 12:51:33 +03:00
Guillaume Gautier
d76e0004fe drivers: pwm: stm32: kconfig: remove ll_tim selection
Usage of stm32xxxx_ll_tim.c has been removed so we can also remove the
selection of USE_STM32_LL_TIM from the Kconfig.
Also remove the LL_RCC that plays no part in the driver.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-02 21:58:55 +02:00
Muhammed Asif
67a25f245d drivers: pwm: sam0: Add support for tc 32 bit mode
- Added logic for updating the registers for 32 bit when
   32-bit counter size is selected.

Signed-off-by: Muhammed Asif <asifp3104@gmail.com>
2025-09-26 13:23:07 +02:00
Franck Duriez
cfbe64934e driver: pwm/pca9685: remove unimplemented misleading property
Invert property was not implemented and is now redundant with the flag
pwm-cell which is more flexible in case you want some IO to be inverted
and some not

Signed-off-by: Franck Duriez <franck.lucien.duriez@gmail.com>

# Conflicts:
#	doc/releases/migration-guide-4.3.rst
2025-09-25 14:17:15 -04:00
Franck Duriez
ae889020bc driver: pwm/pca9685: handle POLARITY flag
Handle polarity flag in pca9685 driver

Signed-off-by: Franck Duriez <franck.lucien.duriez@gmail.com>
2025-09-25 14:17:15 -04:00
Jun Lin
55cdcdce86 drivers: pwm: npcx: fix word register access check placement
Because the PWM module mixes byte and word register together, the driver
adds an assertion check by writing a pattern to the 2-byte register
`PRSC`, reading it back, and performing a comparison. However,
the `PRSC` register cannot be written when the bit 7 (the PWR bit) in
register `PMWCTLn` is set to 1. This commit moves the assertion check to
a proper place to ensure the write is valid.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2025-09-22 13:29:53 -04:00
Alejandro Perea
fa07a03155 drivers: pwm: flexpwm: Fix consecutive PWM setup
If two pwm_set_pulse_dt calls are put consecutive to each other,
the period has already been configured and they refer to the same module
but different submodule (PWM A & B), the second call fails.

LDOK with ReloadImmediate should result in immediate change of the
buffered registers, but it doesn't seem like that's the case.

To fix this, we busywait on LDOK clearance before setting new pulse values.

Fixes zephyrproject-rtos/zephyr#95653

Signed-off-by: Alejandro Perea <alejandro.perea@classified-cycling.cc>
2025-09-22 13:28:39 -04:00
Khoa Tran
c2bb4bd80e drivers: pwm: Add initial polarity value for Renesas RA GPT PWM
Add initial polarity value for Renesas RA GPT PWM

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
2025-09-22 09:52:27 +02:00
Guillaume Gautier
24dcfb22f0 drivers: pwm: stm32: remork complementary channel logic
Align the definition of the complementary channels to the normal channels.
That way, it is consistent for all arrays, we use channel-1 as index, and
no other operation is necessary.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-09-19 12:46:46 -04:00
Guillaume Gautier
c82a2b2b58 drivers: pwm: stm32: reduce pointer level from cfg->timer to timer
This change reduces the level of pointer indirection, which minimizes
repeated dereferencing and helps reduce the overall code size, in the same
way as commit 48e326a5520ec884f38f6a7ac4e88c59a01ceb95 for UART.

This also fixes the type complimentary -> complementary.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-09-19 12:46:46 -04:00
Guillaume Gautier
a5531f5d98 drivers: pwm stm32: remove init struct
Remove the calls to LL_TIM_xx_StructInit and LL_TIM_xx_Init in the PWM
driver. This avoids calling functions from stm32xxxx_ll_tim.c.
They are replaced by a set of simpler functions from the header file.

OC Init in particular is much simpler now. The init structure needed to be
filled out with the complementary channel (if it existed), even though its
configuration didn't change.
The new init is much more direct and only touches what needs to be
modified.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-09-19 12:46:46 -04:00
Laurentiu Mihalcea
8eb26dca8b drivers: pwm: mcux_tpm: support MMU-based architectures
On MMU-based systems, the address space of the IP needs to be mapped
before it can be used, otherwise the system will fault. Furthermore,
since the HAL driver uses the base address of the IP to perform various
operations (e.g. clock ungating), the map between the physical and
virtual addresses needs to be 1:1.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2025-09-18 15:41:37 +01:00
Bill Waters
db410b754c drivers: pwm: ifx_tcpwm: mark unused args
There are two functions with unused arguments
that were not marked.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2025-09-17 08:45:24 +02:00
Khoa Nguyen
db981f65e9 drivers: Add assign event for current core for all Renesas drivers
Add assign event for current core for all Renesas drivers

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-09-11 09:53:13 +02:00
Bill Waters
7973535ec6 drivers: pwm: Infineon: PWM driver improvements and bug fixes
This change makes improvements and bug fixes for the Infineon PWM
driver.  These include:

* Removes hard coded register addresss from driver.
* Addresses issues causing pwm_api and pwm_gpio_loopback tests to
fail, as well as functional failures.
* Restructures device tree file to better represent the hardware
architecture of the tcpwm module.
* Allows configuration of hardware behavior when PWM is disabled.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2025-09-10 16:38:19 +02:00
Bill Waters
8e1f2c70de drivers: pwm: Infineon: replace cat1 naming with tcpwm
* Changes driver naming to reflect hardware IP being used (TCPWM)
instead of referencing cat1.  Cat1 is an internal infineon
reference which has little meaning to users and is being phased
phased out.

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2025-09-10 16:38:19 +02:00
S Mohamed Fiaz
e8fd6b1a12 driver: pwm: pwm_silabs_siwx91x: Add pm device support for pwm driver
This commit enables the pm device driver support
for the pwm_silabs_siwx91x driver.

Signed-off-by: S Mohamed Fiaz <fiaz.mohamed@silabs.com>
2025-09-08 14:37:36 +02:00
Furkan Akkiz
f94ab07118 drivers: pwm: Fix prescaler configuration
This commit fixes the bug in the prescaler configuration formula.
Prescaler enumarations values are not consecutive numbers, so this
formula does not work correctly. This commit adds prescaler enums into
an array and sets PWM prescaler from this array with using
prescaler_index parameter.

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
2025-09-05 17:11:07 +02:00
Benjamin Cabé
89fef8aa6d doc: correct the spelling of "comparison"
s/comparision/comparison/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-09-03 17:04:13 +02:00
Anisetti Avinash Krishna
e018a7e8dd drivers: pwm: Enable PWM support for PTL-h
Enable PWM support on PTL-h and add 64bit
address support for PWM driver.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2025-08-29 19:18:28 -04:00
Raffael Rostagno
382ce7cbd3 drivers: mcpwm: esp32: Fix duty rounding
Duty value in the driver is calculated from timer cycles, which
can introduce precision loss when converting from pwm_set() to
pwm_set_cycles(). To avoid truncating values with a fractional
part ≥ 0.5 and further drifting the effective duty, round the
computed duty to the nearest integer.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-08-26 22:08:11 +02:00
Peter Marheine
26ab6d858e soc: rp2350: support PWM channels >8
RP2350 adds four more PWM slices from the eight available on RP2040,
which are only broken out to package pins on RP2350B. This change fixes
the driver to support the correct number of slices on RP2350.

Tested by confirming that PWM can correctly be configured on GPIO 44 of
RP2350B.

Signed-off-by: Peter Marheine <peter@taricorp.net>
2025-08-22 03:32:16 +02:00
Guillaume Gautier
308e219ea5 drivers: pwm: stm32: use kernel clock instead of dedicated function
Now that the timer kernel clocks are defined in device tree, use the
clock get API to fetch the clock frequency instead of calculating the
value in the driver.
Removes the now unused function get_tim_clk.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-08-21 13:06:58 +02:00
Tomasz Bursztyka
347fb0a75a drivers: pwm: Use DEVICE_API relevantly on mspm0 driver
It was missing thus it was not possible to get a valid answer
from DEVICE_API_IS().

Signed-off-by: Tomasz Bursztyka <tobu@bang-olufsen.dk>
2025-08-21 06:52:34 +02:00
Hieu Nguyen
8e40b8a057 drivers: pwm: Add PWM support for Renesas RZ/A3UL
Add PWM driver support for Renesas RZ/A3UL

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-08-15 10:30:49 +01:00
Hieu Nguyen
7aa3266840 drivers: pwm: Add PWM support for Renesas RZ/T2M, N2L, V2L
Add PWM driver support for Renesas RZ/T2M, N2L, V2L

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-08-14 10:40:07 +03:00
Khoa Nguyen
3aa72e4e9e drivers: Update p_context for all Renesas drivers
The p_context no longer has the const type, so all
Renesas-supported drivers need to be updated accordingly.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-08-08 11:52:13 +03:00
Emilio Benavente
8467f557f9 drviers: pwm: Update flexio pwm update duty cycle
Updated the nxp flexio pwm driver to account
for when the duty cycle is 100% or 0%.
We switch off the counter of the flexio and
manually set the GPIO High or Low. Otherwise
Flexio Peripheral with default to a 50% duty
cycle behavior.
Factored out timerOutput variable.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2025-08-07 20:54:15 -04:00
Raffael Rostagno
f9260ae2e5 drivers: pwm: ledc: esp32: Fix RC_FAST and REF_TICK
Depending on clock config init, some devices might be initialized
with RC_FAST clock enabled but not calibrated. Logic to detect if
clock is calibrated was fixed for this reason. Also, logic to set
RC_FAST and REF_TICK for devices with timer specific clocks (ESP32
and ESP32-S2) was also fixed.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-07-30 17:30:50 -04:00
Bjarki Arge Andreasen
2b0d1ae4d0 soc: nordic: nrf54h: transition from gpd to zephyr pinctrl and pds
Transition nrf54h away from the soc specific gpd
(global power domain) driver which mixed power domains, pinctrl
and gpio pin retention into a non scalable solution, forcing soc
specific logic to bleed into nrf drivers.

The new solution uses zephyrs PM_DEVICE based power domains to
properly model the hardware layout of device and pin power domains,
and moves pin retention logic out of drivers into pinctrl and
gpio, which are the components which manage pins (pads).

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-29 09:03:37 -04:00
Michał Bainczyk
2e06c4ed20 drivers: nrf: add build asserts for memory-regions property
Add build asserts for "memory-regions" property in nrf drivers which is
required on targets with DMM for saadc, pdm, pwm, twim, twim_rtio, twis,
tdm, uarte, spim and spis. On targets where the property is not required
the assertion macro expands to nothing.

Signed-off-by: Michał Bainczyk <michal.bainczyk@nordicsemi.no>
2025-07-28 04:27:25 -04:00
Stoyan Bogdanov
ff2328522a drivers: pwm: Add support for cc23x0 LGPT PWM
Add PWM support for LGPT0, LGPT1, LGPT2 and LGPT3 for cc23x0 SoC.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-07-21 07:26:18 -04:00
Saravanan Sekar
e051ec23ca drivers: pwm: Add a support for TI MSPM0 PWM capture
TI MSPM0 timer module has capture block used to capture timings of input
signal. Add a support for TI MSPM0 PWM capture.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2025-07-21 07:25:10 -04:00
Hao Luo
4b3565d958 drivers: pwm: Add support for Apollo510 pwm
This commit adds support for Apollo510 pwm driver

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-07-19 15:31:08 -04:00
Hao Luo
eea4aa9f52 drivers: pwm: changed ambiq ctimer variable names
changed variable names from timer to ctimer

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-07-19 15:31:08 -04:00
Richard Wheatley
902005e0ef drivers: add assert to check for max children in timer
check for max number of children in timer.

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2025-07-19 15:31:08 -04:00
Richard Wheatley
7cd378d9c9 dts: bindings: move clk-source to parent
Move clk-source from pwm to timer
change associated files to match

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2025-07-19 15:31:08 -04:00
Richard Wheatley
e81a241678 driver: pwm: create ambiq pwm driver
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>
2025-07-19 15:31:08 -04:00
Guillaume Gautier
70b910981d drivers: pwm: stm32: fix four channel pwm capture
With the four-channel-capture-support property enabled, the STM32 PWM
driver was missing every other frames during PWM capture.

The counter values are now reset just after getting the pulse and the
period of the cycle, instead of waiting the next interrupt to do so, and
thus missing a cycle.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-07-10 16:01:23 -05:00
Fabrice DJIATSA
24af0c8ee1 drivers: pwm: stm32: add stm32h7rs bus prescalers
The clock tree of the STM32H7RS series uses the ppre1
and ppre2 naming convention instead of apb1_prescaler
and apb2_prescaler for bus prescaler.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-07-08 13:40:50 -05:00
Pieter De Gendt
d4139d3d8d drivers: pwm: Place device APIs in linker sections
Use DEVICE_API macro to place driver API instances into a linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-27 10:09:32 -05:00
Steven Chang
7ce78aa294 drivers: pwm: pwm driver
Add pwm driver for ENE KB106X

Signed-off-by: Steven Chang <steven@ene.com.tw>
2025-06-27 10:57:20 +02:00
Saravanan Sekar
f7df5e84e3 drivers: pwm: Add a support for TI MSPM0 Timer PWM
TI MSPM0 SoC series has General Purpose Timer and Advanced control timers
with Compare block which is used to generate time expiry and output
waveform like PWM. Add driver support for MSPM0 PWM output.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2025-06-27 10:57:05 +02:00
Aksel Skauge Mellbye
fccc0a7544 drivers: pwm: silabs: Add TIMER PWM driver for Series 2
Add PWM driver for the Timer peripheral on Series 2.
The TIMER uses the high-frequency EM01 Group A clock, and has
a 16- or 32-bit counter. It supports PWM period and pulse capture
on channel 0, and PWM output on all channels.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-25 14:07:40 +02:00
Aksel Skauge Mellbye
566fc7a7db drivers: pwm: silabs: Add LETIMER PWM driver for Series 2
Add PWM driver for the Low Energy Timer peripheral on Series 2.
The LETIMER runs at up to 32 kHz and has a 24-bit counter. It
only supports PWM output, it does not support input capture.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-06-25 14:07:40 +02:00
Phi Tran
d8ab33ae96 drivers: pwm: Add support for PWM driver on RSK_RX130_512KB
This is initial commit to support PWM driver
on Renesas RX130 with MTU modules.

Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
2025-06-25 10:52:34 +02:00
Benjamin Cabé
6c4ed097ff drivers: pwm: Fix priority handling for Renesas RA
Fixed a typo causing interrupt priority from DT to be ignored.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-19 14:00:21 +02:00
Benjamin Cabé
cd78920785 drivers: pwm: adopt SHELL_HELP
Adopt SHELL_HELP macro for pwm_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 10:17:55 -07:00
Bjarki Arge Andreasen
979a565289 drivers: clock_control: nrf2: align with hw binding names
Currently there is a mismatch between the naming of the hardware and
the drivers targetting the hardware. nrf2_ is used instead of
the actual bindings names, like nrf2_audiopll instead of
nrfs_audiopll. This makes it hard to map drivers to the hardware
they are targetting.

There is historical reason for some of this, namely the same binding
name was used for different hardware, which is why nrf2_ was used
on newer platforms. This is no longer the case though, so drivers
and configs can be named according to the hardware without conflict.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-13 11:12:43 +02:00