Commit graph

672 commits

Author SHA1 Message Date
Henrik Brix Andersen
d8780274b5 drivers: pwm: add driver for the NEORV32 PWM controller
Add driver for the NEORV32 PWM controller.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-04-29 13:00:17 +02:00
Titan Chen
31f5d2826d drivers: pwm: rts5912: port pwm driver on Zephyr
Add PWM driver support for Realtek RTS5912

Signed-off-by: Titan Chen <titan.chen@realtek.com>
2025-04-28 08:34:18 +02:00
Krzysztof Chruściński
fc77abc8ae drivers: pwm: nrfx: Add protection against wrong configuration
Do not allow CONFIG_PM_DEVICE_SYSTEM_MANAGED when fast PWM instance
is used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-04-14 13:06:54 +02:00
Peter van der Perk
886a99e736 kinetis-tpm: Implement pulse_cycles directly instead of duty cycle
When using low PWM frequency i.e 50Hz the resolution of pulse_cycles
got lost from converting pulse_cycles to duty cycle % and then back to
pulse_cycles again.

Furthermore TPM_UpdateChnlEdgeLevelSelect call would restart the pwm
constantly on a mcux_tpm_set_cycles call now only call
TPM_UpdateChnlEdgeLevelSelect when changing the polarity

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-04-12 00:02:48 +02:00
Raffael Rostagno
4b8dc5f3ff drivers: esp32: Update for shared intc
Drivers update to use shared interrupt allocator for Xtensa
and RISCV devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-04-02 19:02:27 +02:00
Peter van der Perk
d2160e4f3b kinetis-tpm: don't enable AON/WU clocks on IMX9596
On IMX9596 the AON/WU clocks aren't controllable are on by default.
But TPM1 and TPM3 uses the clocks, by not enabling these clocks
on both TPM1/TPM3 will initialize succesfully.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2025-03-19 20:26:55 +01:00
Ayush Singh
8a4fd9bb1f drivers: cc13xx_cc26xx: pwm: Fix pm bug
- The current code will cause stall if some other subsystem (like subg)
  also needs to manage pm states.
- So add a check to only re-enable suspend if it was disabled by PWM.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-03-15 13:06:39 +01:00
Sai Santhosh Malae
935c8e4701 drivers: pwm: siwx91x: Add siwx91x PWM driver
Implement PWM driver for siwx91x device

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-03-15 06:43:58 +01:00
Khoa Nguyen
c768144002 drivers: Correct value of event macro for all Renesas SoC
Since the RA2L1 uses the macro "ICU_EVENT" instead of
"ELC_EVENT" (which is currently used) to input into
the IELSR register, the ek_ra2l1 board cannot assign
any interrupts for any driver.

This commit aim to correct the Event macro to input correct
value for IELSR register on all the Renesas SoC by using
"BSP_PRV_IELS_ENUM" macro.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-28 18:29:17 +01:00
Hieu Nguyen
3a7ccecdcd drivers: pwm: Initial support for RZ/G3S
Add PWM driver support for Renesas RZ/G3S

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Binh Nguyen <binh.nguyen.xw@renesas.com>
2025-02-05 17:49:00 +01:00
Michał Stasiak
a71f042a36 drivers: pwm: nrfx: 0/100% duty for PWM120
Fast PWM120 prevents GPIO from driving pin with low/high
state when PWM duty is 0% or 100%. In such case, regular
PWM signal generation needs to be used.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2025-02-05 01:12:02 +01:00
Benjamin Cabé
d29798f3cf drivers: pwm: sam0: Add missing semicolon in PWM initialization macro
Add missing ; that was causing the driver to fail compiling.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-03 01:03:09 +01:00
Pieter De Gendt
f1c4760304 drivers: Update APIs to use DEVICE_API macro
Some drivers APIs were not wrapped using the DEVICE_API macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-24 01:15:19 +01:00
Fabio Baltieri
0bc123da11 drivers: drop few redundant device_is_ready
Drop few redundant device_is_ready for functions that are only used as
argument to shell_device_filter, as shell_device_filter checks for that
alrady.

Suggested-by: Yishai Jaffe <yishai1999@gmail.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-22 05:40:11 +01:00
Raffael Rostagno
fc8119deed drivers: pwm_led: esp32: Add inverted flag
Add inverted flag to bindings, as pwms field is supposed
to be used by application only.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
17752adfd9 drivers: pwm_led: esp32: Clang check
Clang check for formatting.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
10360e1e77 drivers: pwm_led: esp32: Clock management update
Update clock management to better support new devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
56d7dcc121 drivers: pwm_led: esp32: Timer sharing control
Include condition to block pwm_set operation when the same timer
is shared but a different frequency is requested. First set
operation will take precedence.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
0c17da0ebf drivers: pwm_led: esp32: Cleanup and functions organization
Cleanup and functions organization. Clock source selection added
to init to allow proper setting of default level when signal is
inverted.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
9d9ec2dab3 drivers: pwm_led: esp32: Change duty and PWM transitions
Disable PWM output for duty 0% or 100%, to allow using max timers
resolution. Move timer reset to init function in order to ensure
smooth frequency transitions.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Raffael Rostagno
58aef30acb drivers: pwm_led: esp32: Fix frequency config
At driver init channels frequency are unknown, thus timer config
may take place only at set_cycles(). To avoid phase shifts,
timers are only reconfigured if a new frequency is requested.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-01-18 02:36:05 +01:00
Armin Kessler
2c5b791b26 drivers: pwm_led: esp32: fix 100 percent pwm and init state
Set pwm init state to value defined in flags field.
Furthermore 100 percent is now actually 100 percent and not 99.

Signed-off-by: Armin Kessler <ake@espros.com>
2025-01-18 02:36:05 +01:00
Armin Kessler
babaaa6a19 drivers: pwm_led: esp32: add inverted pwm polarity
This PR enables the PWM to be inverted by making use of the
`PWM_POLARITY_INVERTED` flag.
It also fixes an overflow bug when setting duty-cycle to 100 percent.

Signed-off-by: Armin Kessler <ake@espros.com>
2025-01-18 02:36:05 +01:00
Dat Nguyen Duy
5014a204cf dts: arm: nxp: add support pwm emios for nxp s32z SoC
This adds support PWM EMIOS for NXP S32Z SoC, both PWM pulse
generate and pulse capture are supported

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2025-01-18 02:32:50 +01:00
Dat Nguyen Duy
e72af321d5 drivers: emios_pwm: do not configure period, duty and polarity at boot
Removing period, duty and polarity configuration from
channel devicetree. At boot time, only minimal setup like
pinctrl, prescaler, etc should be initialized. PWM signal
is produced by using pwm_set* API

Also after this change, PWM period, duty are changed at the
next counter period boundary

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2025-01-18 02:32:50 +01:00
Michał Stasiak
2c89ed5441 drivers: pwm: nrfx: add global hsfll request for fast PWM
Added clock control api for global hsfll used in fast PWM120 driver.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2025-01-17 20:06:50 +01:00
Henrik Brix Andersen
7fec3d7f12 soc: atmel: samx7x: refactor SoC support for the Atmel SAM E70/V71
Refactor and merge the SoC support files for the Atmel SAM E70 and SAM V71
product series. These SoCs are part of a larger product family (SAM
E70/S70/V70/V71) and share a common set of peripherals.

Support for the two remaining product series (SAM S70/V70) is not part of
this refactoring as these will require further additions to the Atmel HAL.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-01-16 22:39:25 +01:00
Henrik Brix Andersen
fd5b97690d drivers: pwm: sam: move SAM V71 register fixup from SoC to PWM driver
Move the SAM V71 register name fixup from the SoC code into the PWM driver
next to the other PWM driver fixup.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-01-14 20:50:20 +01:00
Mathieu Choplain
7e1074631e drivers: pwm: stm32: add support for STM32WB0
This commit adds support for the STM32WB0 series to
the existing STM32 PWM driver.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-01-14 20:49:30 +01:00
Gerson Fernando Budke
ea7922195b clocks: atmel: sam0: Fix gclk and mclk clock bindings
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and
MCLK. The old devices had defined the peripheral clock enable bit at PM.
On the newer devices this was extracted on a dedicated memory section
called Master Clock (MCLK). This change excludes the dedicated bindings
in favor of a generic approach that cover all cases.

Now the clocks properties is complemented by the atmel,assigned-clocks
property. It gives the liberty to user to customize the clock source
from a generic clock or configure the direct connections.

All peripherals drivers were reworked with the newer solution.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-01-14 20:49:03 +01:00
Manuel Argüelles
c16ccf8e7d dts: bindings: rename nxp,kinetis-ftm-pwm compatible
Rename "nxp,kinetis-ftm-pwm" compatible to "nxp,ftm-pwm" to remove the
device family from its name.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-12-20 23:53:14 +02:00
Danh Doan
2e0688878b drivers: pwm: update namming of pwm driver for RA family
- update namming for pwm driver.

Signed-off-by: Danh Doan <danh.doan.ue@bp.renesas.com>
2024-12-20 18:31:12 +01:00
Raffael Rostagno
0cb755a0e3 drivers: mcpwm: esp32c6: Add support
Add MCPWM support to ESP32C6

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-12-20 18:30:59 +01:00
Jun Lin
bc98a06771 driver: pwm: npcx: use CONFIG_PWM_LOG_LEVEL
This commit replaces the hard-coded log level with CONFIG_PWM_LOG_LEVEL.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-12-19 04:18:34 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Teresa Zepeda Ventura
830fe6ec19 drivers: pwm: add a SAM0 TC based PWM driver
This runs the Timer/counter in 'normal' PWM mode (for 8-bits)
and in 'match' PWM mode (for 16-bits).

Signed-off-by: Teresa Zepeda Ventura <teresa.zvent@gmail.com>
2024-12-17 23:14:32 +01:00
Raffael Rostagno
b313344e22 drivers: mcpwm: esp32: Clock update for new devices
Update clock configuration to support newer devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-12-17 23:14:19 +01:00
Raffael Rostagno
15cb7d3d74 drivers: mcpwm: esp32: Driver update for new HAL
Remove deprecated functions to comply with new HAL versions.
Handle capture interrupts more appropriately by clearing status
bit for only one channel.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-12-17 23:14:19 +01:00
Pieter De Gendt
a0eb112774 drivers: Move device driver APIs into iterable sections
These device driver APIs were merged after the DEVICE_API macro was
introduced.
Cleanup these leftover drivers.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-17 02:02:54 +01:00
Nathan Olff
c152453a72 drivers: pwm: implement fake-pwm driver
implement fake-pwm driver with binding using fff

Signed-off-by: Nathan Olff <nathan@kickmaker.net>
2024-12-14 16:14:57 +01:00
Yishai Jaffe
3775e197e6 pwm: shell: filter device lookup using DEVICE_API macros
Filter for PWM devices when looking them up in dynamic shell commands.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-06 12:13:28 +01:00
Yishai Jaffe
e5017da2b0 drivers: pwm: Place API into iterable section
Add wrapper DEVICE_API macro to all pwm_driver_api instances.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-06 12:13:28 +01:00
Gerard Marull-Paretas
813fc4d6bb drivers: all: cc12xx_cc26xx: select PINCTRL
select PINCTRL when needed instead of relying on board-level options.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-12-05 15:18:01 +01:00
Gerard Marull-Paretas
f3a125e018 drivers: all: telink-b91: select PINCTRL
Select PINCTRL as needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-12-05 15:17:47 +01:00
Tim Lin
54b91c7748 drivers: pwm: it8801: Add I2C-based PWM device driver
Add I2C-based PWM device driver. Supports 7 open-drain/push-pull
outputs.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-12-03 19:56:50 +01:00
McAtee Maxwell
3024392d35 SOC: Remove config PINCTRL from xmc4xxx soc
- Move selection of CONFIG_PINCTRL from soc to individual
	  drivers
	- in accordance with issue #78619

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2024-12-02 22:05:16 +00:00
Michał Stasiak
d04b3e0323 drivers: pwm: nrfx: add pin retention
Add pin retenion if GPD is enabled for nRF54H20.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2024-12-02 14:25:09 +01:00
Michał Stasiak
085a4fa92e drivers: pwm: nrfx: adjust PWM driver to fast PWM120
Fast PWM120 instance works with 320MHz clock, thus
pwm_nrfx_get_cycles_per_sec needs to be adjusted,
applying correct clock frequency.
Also, it uses cachable RAM, thus sys_cache function
needs to be added to flush the cached sequence.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2024-12-02 14:25:09 +01:00
Maximilian Werner
66df541d6c drivers: pwm: mcux_tpm: allow configuring the clock prescaler
Allow configuring the clock prescaler divider for the NXP Kinetis
Timer/PWM Module (TPM). Setting the prescaler to a lower value
allows for higher resolution for the generated PWM waveforms.
This change is inspired from the pwm_mcux_ftm driver:

Link: https://github.com/zephyrproject-rtos/zephyr/pull/25396

Signed-off-by: Maximilian Werner <maximilian.werner96@gmail.com>
2024-12-02 01:33:59 +01:00
TOKITA Hiroshi
88149afff7 soc: raspberrypi: Drop PINCTRL from Kconfig.defconfig
The `Kconfig.defconfig` is not good place for put `select PINCTRL`.
Drop `select PINCTL` from `Kconfig.defconfig` and add it at each
driver's Kconfig.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-11-25 14:42:01 +01:00