Commit graph

766 commits

Author SHA1 Message Date
Felix Wang
f46f921b7f drivers: pwm: Fix ASSERTION FAIL in pwm_mcux
In PWM_SetupPwm implementation, there is a check:
    temp = pwmClock / pwmFreq_Hz;
    assert(temp <= 0xFFFFU);
Currently pwmFreq_Hz is 1, makes assert failed with
high frequency pwmClock. Since VALx values is set
directly for edge aligned PWM, the pwmFreq_Hz here is
a dummy value, set pwmFreq_Hz equal to pwmClock
frequency to pass assert check.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-17 17:04:24 +01:00
Henrik Brix Andersen
7440bca13d drivers: pwm: shell: add command for getting cycles per second
Add PWM shell command for getting the number of cycles per second for a
given PWM controller/channel.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-01-13 15:21:21 +01:00
Hieu Nguyen
a437d3057a drivers: pwm: Initial support for RZ/A2M
Add PWM driver support for Renesas RZ/A2M

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-01-13 13:32:06 +01:00
Camille BAUD
396249fdd4 drivers: pwm: Add BFLB PWM 1 and 2
Adds BFLB PWMs

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-01-13 10:13:04 +01:00
Ha Duong Quang
3db533ae91 drivers: pwm: add support pwm(emios) for s32k5
Add support PWM(eMIOS) for S32K5

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
2026-01-06 13:37:15 +00:00
Nikodem Kastelik
64be8d84b1 drivers: pwm: nrf: fix nrfx instance being zeroed on suspend
PWM driver clears its runtime state on each suspend event.
However, since nrfx 4.0 integration nrfx driver instance is part
of the runtime state structure, so clear action must be limited.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-12-19 07:49:28 -06:00
McAtee Maxwell
6ad823ab8d drivers: pwm: add support for Infineon kit_pse84_eval
- Update the driver to support the kit_pse84_eval board
- Update to new peripheral clock allocation scheme

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2025-12-17 10:52:22 +02:00
Muhammed Asif
20d7d23d53 drivers: pwm: microchip: add support for pwm tc g1
Add pwm driver using tc g1 peripheral.
Adds the support for generating pwm output.
Supports 8-bit, 16-bit and 32-bit mode of tc peripheral

Signed-off-by: Muhammed Asif <muhammed.asif@microchip.com>
2025-12-15 17:07:24 +00:00
Ruibin Chang
d26ffeba9d drivers/pwm/it8xxx2: add pwm init output level property
When EC reboot, pwm pins go back to default GPI mode.
After we set pin mode to pwm mode at init(), it would
output low, so LED will be light (LED is low-activated).
And until set_cycles() is called to set output high,
then LED will be turn off the light (PWM-LED flicker).
So add the property to set PWM channel init output level.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2025-12-12 04:56:42 -05:00
Qingsong Gou
7c39469e17 drivers: pwm: sf32lb: add atim based pwm driver
add atim based pwm driver for sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2025-12-09 09:54:16 -05:00
Sreeram Tatapudi
5ecf248ba3 drivers: infineon: Drop cat1 from the files names
Drop cat1 from the file names to enable reuse by other
category devices as well

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-12-07 21:19:38 -05:00
Peter van der Perk
084f2a1dda drivers: pwm: Fix prescaler 256 overflow and get cycles
Setting a prescaler of 256 would overflow the uint8_t.
Also get cycles calculation was wrong.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-12-06 11:37:45 -05:00
Charles Hardin
5c70e93afd drivers: pwm: stm32: change the order of deadtime and enable all timers
For stm32h7 the order matters to get the pwm to output the values as
expected. As reported for the the H730 doesn't produce PWM output when
the LL_TIM_OC_SetDeadTime is called after LL_TIM_EnableAllOutputs. So,
switch the order of the calls and this doesn't impact the stm32f413zh
boards.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-12-06 07:10:01 -05:00
Jaro Van Landschoot
8407f1766f drivers: pwm: sam: Add period and fault events
The SAM4S pwm supports several events. This commit
implements the events when a channel period has ended
or a fault event has occured.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2025-12-04 14:05:13 -05:00
Jaro Van Landschoot
c6e64a1337 drivers: pwm: extend API to support events
Extend the PWM API to support events, as some
controllers allow interrupts if e.g., a pwm period
has ended or a fault occured.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2025-12-04 14:05:13 -05:00
Martin Hoff
ff3637bf83 soc: silabs: siwx91x: enabled clock control by default for siwx91x soc
Enable clock control by default for siwx91x SoCs. Moreover, most
drivers for siwx91x soc depend on clock control, but didn't declare
it.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-12-02 15:18:53 -05:00
Qingsong Gou
6211909b78 drivers: pwm: sf32lb: add gpt based pwm driver support
Add gpt based pwm driver for sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2025-12-01 12:23:17 -05:00
Aksel Skauge Mellbye
a83b19b3f9 soc: silabs: Fix clock control dependency declarations
Most drivers for Series 2 depend on clock control, but didn't
declare it. Enable clock control by default for Series 2 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-12-01 11:11:14 +01:00
Nikodem Kastelik
ad1e5ac253 nordic: update and align to nrfx 4.0.1
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-11-27 14:45:17 +01:00
Etienne Carriere
2f4962fa0a drivers: pwm: stm32: clean indentation in instance init macros
Clean indentation in IRQ_CONNECT_AND_ENABLE_BY_NAME(), IRQ_CONFIG_FUNC()
and IRQ_CONNECT_AND_ENABLE_DEFAULT() macros of STM32 PWM driver.
Remove a useless trailing semi column character in the interrupt function
defined with IRQ_CONFIG_FUNC() macro.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-11-26 11:03:50 +00:00
Charles Hardin
76c1d713c1 drivers: pwm: stm32: add device tree configuration for deadtime
When using an stm32 in a bridge circuit with complementary outputs,
the deadtime needs to be configurable to avoid shoot-thru current
on the circuit. So, the HAL has the configuration in the BDTR init
and use that api access to set the configuration.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2025-11-20 06:03:20 -05:00
Josuah Demangeon
30950b888d style: drivers: sort Kconfig and CMake includes
Use the "zephyr-keep-sorted-start/stop" comment to have CI check
the alphabetical order of includes, to help reducing the chance
of conflicts while contributing drivers.

Signed-off-by: Josuah Demangeon <me@josuah.net>
2025-11-17 13:48:03 -05:00
S Mohamed Fiaz
5828ba5ea1 driver: pwm: pwm_silabs_siwx91x: fix pm actions when PM is enabled
This fix addresses the issue encountered when power management (pm)
is enabled, as the PWM test suites utilize the GPIO driver, which
now incorporates the latest power domain enhancements and requires
CONFIG_POWER_DOMAIN to be enabled. Power domain functionality
manages device power actions such as turning on and off.

Accordingly, the pm device support for the pwm_silabs_siwx91x
driver has been updated to align with the recent power domain
improvements.

Signed-off-by: S Mohamed Fiaz <Fiaz.Mohamed@silabs.com>
2025-10-29 14:29:34 -04:00
Bjarki Arge Andreasen
beacd7c181 dts: drivers: nordic: nrf54h: Don't manage clocks from drivers
Clocks are requested automatically by hardware on the nRF54H.

Remove additional handling from device drivers, and disable
the now unmanaged clocks in the devicetree.

Updates:
  - can_nrf
  - counter_nrfx_timer
  - uart_nrfx_uarte
  - spi_nrfx_spim
  - spi_nrfx_spis

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-10-23 18:06:30 +02:00
Stoyan Bogdanov
afd2962dfc drivers: pwm: cc23x0: Add power management
Add PM support for PWM (LGPT0, LGPT1, LGPT2 and LGPT3) to cc23x0 SoC.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-10-22 18:07:42 -04:00
Felix Wang
190c6dd567 drivers: pwm: Fix qtmr set cycles bug.
The mcux_qtmr_pwm_set_cycles can not set 100% and 0%
duty cycle PWM wave.
Set output compare setting based on pulse_cycles and
period_cycles:
1. If pulse_cycles is 0, generate 0% duty cycle wave.
2. If pulse_cycles equals period_cycles but not 0,
   generate 100% duty cycle wave.
3. Otherwise toggle output when compare value matched.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2025-10-21 22:53:53 +03:00
Felix Wang
8af0f0387f drivers: pwm: enable pwm capture for qtmr driver
Supported mode: single capture, continus capture,
pulse capture, period capture.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2025-10-21 22:53:53 +03:00
Muhammed Asif
8f6b71312f drivers: pwm: microchip: add support for pwm tcc g1 IPs
Add pwm driver using tcc g1 peripheral.
Adds the support for generating pwm output.
Supports both 16-bit and 24bit mode of tcc peripheral

Signed-off-by: Muhammed Asif <muhammed.asif@microchip.com>
2025-10-21 17:23:02 +03:00
Tony Han
802fdc4dd3 drivers: pwm: pwm_sam: update to support Soc SAMA7G5
Redefine some macros due to different naming scheme in the header file.
Get the clock rate from the device tree when 'SOC_ATMEL_SAM_MCK_FREQ_HZ'
is not defined.

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-10-20 19:19:20 -04:00
Tahsin Mutlugun
36a3a4c1e0 drivers: pwm: max32: Simplify prescaler calculation
Replace the look-up table used to obtain the prescaler enumeration with
a simple multiplication.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-10-20 19:16:00 -04:00
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