Commit graph

766 commits

Author SHA1 Message Date
Davide Di Lello
82741b2614 drivers: infineon: Update copyright for Infineon
Update structure of the copyright

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-05-12 22:19:02 +02:00
Sylvio Alves
36ac2822f5 soc: espressif: sync with latest hal_espressif
Update hal_espressif revision and adapt drivers and linker
scripts to the new HAL APIs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-05-12 17:16:50 +02:00
Nhut Nguyen
ce0ab92159 drivers: pwm: renesas: Fix missing last period in event sample
Fix missing last period when running samples/drivers/pwm/event. The last
period was incomplete because it is stopped immediately before the new
period became effective.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-05-12 09:00:20 +02:00
Nhut Nguyen
4084433d1b drivers: pwm: renesas: Add support for PWM event API
Implement PWM event API for Renesas RA

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-05-12 09:00:20 +02:00
Srinivas Edireswarapu
ae3473eb51 drivers: pwm: mchp_xec: fix switch-case break indentation
Fix misaligned break statements in pwm_xec_pm_action() switch-case
block to match the case indentation level.

Signed-off-by: Srinivas Edireswarapu <srinivas.edireswarapu@microchip.com>
2026-05-11 21:02:18 -05:00
Srinivas Edireswarapu
2e5597b09d drivers: pwm: mchp_xec: refactor for encoded DT properties
Refactor the Microchip XEC PWM driver to use DTS-encoded PCR
property via soc_xec_pcr_sleep_en_clear(), replacing per-SoC
ifdefs for PCR init. Move PCR enable before pinctrl apply in
the init sequence.

Signed-off-by: Srinivas Edireswarapu <srinivas.edireswarapu@microchip.com>
2026-05-11 21:02:18 -05:00
Michał Stasiak
e547706430 drivers: pwm: pwm_nrfx: handle uninitialized period cycles
If first PWM sequence is set to 100% glitch free duty
cycle, period_cycles will remain uninitialized while
all used channels will use PWM. If following
sequences request non-100% duty cycle, period
cycles will have to be changed. Improve error
condition to allow changing period cycles for
running PWM if these are equal to 0.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2026-05-08 14:42:52 +01:00
Matthias Plöger
82acd3ef37 drivers: pwm: stm32: refactor ARR preload generation into device init
Avoids set of ARR value without enabled preload once counter is enabled.

Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
2026-05-07 18:04:01 -05:00
Matthias Plöger
1853c1a106 drivers: pwm: stm32: Avoid update generation in master-update mode
When the following conditions are met:
- center aligned mode
- trigger generation on update event
an additional update event is avoided during channel activation.
This may cause (depending on the up/down counting direction) a
de-synchronisation between pwm polarity and generated trigger.
Problematic  when e.g. the adc should trigger during high- and
low phase of a pwm signal.

Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
2026-05-07 18:04:01 -05:00
Yuzhuo Liu
a6f802b9b1 drivers: pwm: add Realtek Bee series driver
Add PWM driver support for Realtek Bee series SoCs,
including RTL87x2G and RTL8752H.

This driver supports:
- Pulse width modulation output
- Period and pulse width configuration
- Polarity inversion

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-05-01 09:50:16 +02:00
Stefan Gloor
ece9ac4213 drivers: pwm: add generic gpio bitbang pwm
Add a generic software PWM driver as a fallback
when no dedicated hardware PWM pins are available.
This implementation leverages a single hardware
timer interrupt as a time base to derive an
arbitrary number of software-controlled PWM channels.
The period is the same for all channels.

This enables use of LED brightness and blink APIs.
Tested on Nucleo H563ZI with this overlay:

/ {
    status_leds: status_leds {
        compatible = "pwm-leds";

        status_led_1: status_led_1 {
            pwms = <&soft_pwm 0 PWM_MSEC(10) PWM_POLARITY_NORMAL>;
            label = "1";
        };
    };

    soft_pwm: soft_pwm {
        compatible = "zephyr,pwm-bitbang";
        #pwm-cells = <3>;
        timer = <&tim6_counter>;
        pwm-gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
    };
};

&timers6 {
    status = "okay";
    st,prescaler = <24999>;
    tim6_counter: counter {
        status = "okay";
    };
};

Assisted-by: GitHub Copilot:claude-opus-4.6
Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>
2026-04-28 00:26:06 +01:00
Fin Maaß
bf9d688deb drivers: pwm: litex: use mem_addr_t
use mem_addr_t for register addresses.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-15 17:15:46 -04:00
Erwan Gouriou
5ac8a0e2ae Revert "drivers: pwm: add support for enabling DMA requests"
This reverts commit 311a841620.
+ related changes done in 841e4d4597

Proposed API change result in vendor specific details of the DMA leaking
into application code, which prevents usage with portable code.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2026-03-31 13:58:55 -05:00
Pisit Sawangvonganan
f5512a6907 drivers: fix typo in (mipi_dbi, misc, mm, mspi, pcie, ptp_clock, pwm)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/mipi_dbi`
- `drivers/misc`
- `drivers/mm`
- `drivers/mspi`
- `drivers/pcie`
- `drivers/ptp_clock`
- `drivers/pwm`

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-03-27 20:21:24 -04:00
Raffael Rostagno
37aef33e64 pm: drivers: pwm_ledc: esp32: Add device PM
Add code for device PM to the driver.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-23 17:37:48 -05:00
John Batch
c3f8820e95 drivers: pwm: infineon: Adding support for PWM events
Adds implementation of the PWM_EVENT api options.  The Infineon TCPWM
Module supports the PWM_EVENT_TYPE_COMPARE_CAPTURE and
PWM_EVENT_TYPE_PERIOD events.

Assisted-by: GitHub Copilot:claude-opus-4.6
Signed-off-by: John Batch <john.batch@infineon.com>
2026-03-23 10:18:00 +01:00
Sylvio Alves
06be42d138 drivers: pwm: add esp32c5 support
Extend the ESP32 LEDC PWM driver to support ESP32-C5. Clear the
gamma RAM fade function on SoCs that have it to prevent stale
fade parameters from affecting duty cycle output.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-19 14:53:05 -05:00
Guillaume Gautier
1235b49fba drivers: pwm: stm32: update pwm driver for stm32 hal2
In STM32 HAL2, some define have been renamed.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-03-19 14:52:01 -05:00
Christopher Smith
b30a5a9f11 drivers: pwm: esp32: add pinctrl initialization for mcpwm capture
The ESP32 MCPWM driver does not initialize the pinctrl configuration if
only the capture units of MCPWM are used and no other MCPWM outputs are
used. This leads to pwm capture requests timing out. Fix this by applying
the pinctrl configuration during module initialization.

Signed-off-by: Christopher Smith <christophersmith107@gmail.com>
2026-03-18 17:46:32 -05:00
William Markezana
d547042bf9 drivers: bflb: extend shared drivers with BL70XL SoC support
Add CONFIG_SOC_SERIES_BL70XL to preprocessor conditionals across
existing Bouffalo Lab drivers that share register-compatible code
paths with BL60x/BL70x:

- cache: L1C flush-enable workaround applies to BL70XL
- flash: XIP address defines, L1C wrap, QPI JEDEC ID support
- gpio: BL70XL includes, fix BIT() usage for pin set/clear
- i2c: clock source calculation
- serial: UART clock divider, guard UART1 (BL70XL has only UART0)
- spi: GLB address and FIFO size, clock calculation
- syscon: efuse SAHB clock selection
- input: IR receiver pin mapping and clock divider

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-03-18 17:40:26 -05:00
Felix Wang
d1e8dca27c drivers: pwm: Fix capture support bug
Refactor the PWM capture interrupt handler to properly support all
three capture channels (A, B, and X).

Clear capture FIFOs by reading CVAL registers during enable_capture

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-03-18 12:47:33 +09:00
Felix Wang
1b3c4aef72 drivers: pwm: mcux: Guard input filter functions with feature check
Add feature check to ensure these functions are only called when the
hardware supports input filter capture registers.

Update device tree binding documentation to clarify that the
input-filter-count and input-filter-period properties only take
effect when the capture input filter register is available.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-03-18 12:47:33 +09:00
Jacob Wienecke
a983ea808e pwm: mcux_sctimer: apply pinctrl in PM
Apply PINCTRL_STATE_SLEEP on suspend and PINCTRL_STATE_DEFAULT
on resume. If a sleep pinctrl state is defined in the board DTS,
pins will be reconfigured on suspend. If not defined, the call
is a no-op.

Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
2026-03-18 11:03:32 +09:00
Cherrence Sarip
79e6e32f79 drivers: pwm: add support for MAX2221X pwm
Implements PWM driver support for the MAX22216/MAX22217 device.
This driver integrates with the Zephyr PWM API and uses the parent
MFD device to perform register access.

Signed-off-by: Cherrence Sarip <cherrence.sarip@analog.com>
2026-03-16 10:09:16 -04:00
Ryan Wiebe
7a5b256d66 driver: pwm: max32: Added support for PWM Events
Max32 PWM already has built-in support for interrupts at the end of
each PWM period so added baseline support for the PERIOD event type
in CONFIG_PWM_EVENT. Updated PWM Event sample to support
Max32672EvKit.

Signed-off-by: Ryan Wiebe <ryan.wiebe@analog.com>
2026-03-14 05:59:33 +01:00
Sylvio Alves
c64a74e711 espressif: adapt to hal_espressif IDF master sync
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.

Main changes:
- clock control: delegate peripheral clock gating to HAL
  layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
  allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
  object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
  MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
  DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-13 11:38:18 +01:00
Vincent Surkijn
311a841620 drivers: pwm: add support for enabling DMA requests
Extend the PWM API with optional API functions for enabling DMA requests

Possible solution for #88670

Signed-off-by: Vincent Surkijn <vincent.surkijn@siemens.com>
2026-03-11 11:38:01 +01:00
Alberto Escolar Piedras
a30ac3bc35 drivers: pwm: stm32: Fix builds without mastermode support
Correct an #if which otherwise is always true, so we do not
refer to a function which does not exist otherwise.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-03-05 04:44:58 +01:00
Manojkumar Konisetty
9cfc87619a drivers: pwm: infineon: add dedicated PWM driver for PSoC4
Add PWM driver for the Infineon PSoC4 family.
This includes SoC-specific register configurations, API calls,
and hardware instance mapping required for PSoC4 compatibility.

Signed-off-by: Surya Prakash T <suryat@aerlync.com>
Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2026-03-05 04:42:21 +01:00
Matthias Plöger
bb16624662 drivers: pwm: stm32: Add trigger output configuration
- Add new dts binding for configurable master mode
- Add exception for LP timers (not supported)
- Add required defines for configuration options
- Implement configuration of master mode during device init

Signed-off-by: Matthias Plöger <matthias.ploeger@phoenixcontact.com>
2026-02-25 13:04:05 +01:00
Mathieu Choplain
a11688fab5 drivers: *: stm32: don't check if clock device is ready
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-13 18:59:16 +00:00
Pieter De Gendt
f91399d2f5 drivers: pwm: Put driver APIs into iterable section
Use the DEVICE_API macro to put the PWM driver APIs into the correct
iterable section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-02-12 14:33:20 +00:00
Felix Wang
1dd18e8763 drivers: pwm: add support for FlexPWM channel X output
1.Extend the NXP MCUX PWM driver to support three channels (A, B, and X)
instead of two.
2.Add special handling for channel X  polarity control via the OCTRL
register, as it uses VAL0 for pulse width instead of the VAL2/VAL3 pair
used by channels A and B.
3.Restore VAL0 when configuring channels A/B to preserve channel X pulse
4.Adjust LDOK timeout to one PWM period
5.Get clock frequency in init function

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-02-06 11:12:09 +01:00
Benjamin Cabé
d4d355632c drivers: pwm: use proper essential type in boolean variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Albort Xue
807f5e8f1f drivers: pwm: nxp_flexio: Add clock configuration and enable
Add explicit clock configuration and enable calls during driver
initialization.

Note: -ENOSYS is temporarily ignored as not all clock control
drivers currently implement the configure API. This handling
should be removed once all clock drivers support configure.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-02-04 13:55:30 +01:00
Hoang Nguyen
eaf655126a drivers: pwm: renesas: Initialize p_reg in extended configuration
Initialize p_reg with the register base address from devicetree.

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-02-03 09:29:36 +01:00
Missael Maciel
9cbc6616c1 drivers: pwm: sctimer: Add PowerManagement support
pwm_mcux_sctimer driver doesn't support power management actions.
PM Actions added, as well support to save/restore for pwm channels
configurations after exitig from PM3.

Signed-off-by: Missael Maciel <davidmissael.maciel@nxp.com>
2026-01-30 18:02:27 +01:00
Jamie McCrae
80f19801b2 soc: sifive: sifive_freedom: Fix SoC Kconfig naming and issues
Fixes the Kconfig name of this so that it matches the value from
soc.yml, and deprecates the old name - this is required to support
future build system features. Additionally, it fixes an issue in
Kconfigs of this SoC of duplicating existing symbols

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-01-29 17:20:11 +01:00
Charles Hardin
4c23db41ee drivers: pwm: stm32: show the period cycles for the 16-bit limit error
The settings and calculations are often done in micro or nano seconds
and the result is not always shown. So, just add the period cycles as
part of the error message to get the calculated value.

Signed-off-by: Charles Hardin <ckhardin@gmail.com>
2026-01-29 09:04:39 +01:00
Felix Wang
e8dafd27d9 drivers: pwm: Add PWM mode support for tpm
Add support for center-aligned PWM mode in addition to the existing
edge-aligned mode. When center-aligned mode is configured, adjust
pulse and period cycles by dividing by 2 to maintain correct timing.

Add validation checks in PWM capture functionality to edge-aligned
mode only, as capture is not supported in center-aligned mode.

Assign the value directly to avoid re-calculating period_cycles
based on pwm_freq in TPM_SetupPwm, which could lead to precision loss.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-28 16:13:11 +01:00
Felix Wang
f0acc1d770 drivers: pwm: Fix bugs in tpm
Replace interrupt register checks with explicit capture_active flag
to track capture state. This provides more reliable state management
and fixes potential race conditions when checking if capture is active.

Also optimize TPM_SetupPwm call to only configure the specific channel
being set instead of all channels, improving efficiency.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-28 16:13:11 +01:00
John Batch
9d4ae9b399 drivers: infineon: tcpwm: counter and pwm clock updates
Updates the Infineon Counter and PWM drivers based on the TCPWM device
to connect with a clock.  This update allows multiple devices to connect
to the same peripheral clock, and supports the TCPWM architecture of the
PSC3 device family.

Corrects initialization of the PWM on the PSC3 family to select the
correct output type.

Signed-off-by: John Batch <john.batch@infineon.com>
2026-01-27 08:06:28 +01:00
Albort Xue
dba5c5081f drivers: pwm: mcux_tpm: Add clock configuration support
Add clock_control_configure() call during initialization to properly
configure the TPM clock. The driver now attempts to configure the
clock and handles cases where configuration is not supported by the
platform (-ENOTSUP/-ENOSYS) by continuing with default settings.
Real configuration errors are logged and cause initialization to fail.

Note: -ENOSYS is temporarily ignored as not all clock control
drivers currently implement the configure API. This handling
should be removed once all clock drivers support configure.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-01-20 20:10:19 -05:00
Pieter De Gendt
eee57d48cb drivers: pwm: mcux: Print status value on error
When PWM_SetupPwm returns an error, add the value of status to the error
log message.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-01-19 18:47:25 -06:00
Felix Wang
88d4709b45 drivers: pwm: mcux_ctimer: Fix multi-line assertion message formatting
Fix formatting of the __ASSERT message in
mcux_ctimer_pwm_get_cycles_per_sec to properly concatenate the
string across multiple lines.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-19 15:18:20 +01:00
Hieu Nguyen
4890a26f1c drivers: pwm: Update driver for RZ devices
Implement interrupt settings to expand the driver to RZ/V2H, V2N SoCs

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2026-01-19 12:13:58 +01:00
Felix Wang
e72d11e903 drivers: pwm: Add input capture support to nxp,sctimer-pwm
Implement PWM input capture functionality for the NXP SCTimer
driver with support for both pulse width and period measurement
in single-shot and continuous modes.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-17 17:05:00 +01:00
Felix Wang
e7840a9d27 drivers: pwm: Fix polarity update on duty cycle change
1.Add mcux_sctimer_pwm_update_polarity() function to properly
reconfigure PWM output polarity when duty cycle is updated.
2.Update Match Reload Value register when Match register is
set.
3.Stop timer before update to prevent bus error

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-17 17:05:00 +01:00
Felix Wang
fa48bee6c4 drivers: pwm: fix prescaler calculation for pwm_mcux_ctimer
The prescaler divides the clock by (prescaler + 1), not by the prescaler
value directly. Update the calculation to correctly account for this.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-17 17:04:44 +01:00
Felix Wang
8dcd7579eb drivers: pwm: Add PWM capture functionality for pwm_mcux
Add support for PWM input capture functionality to the NXP MCUX PWM
driver. This enables measurement of pulse width and period of external
PWM signals.

Key features added:
- PWM capture configuration and control APIs
- Interrupt-driven capture with overflow handling
- Support for both pulse width and period measurement
- Configurable input filtering
- Support for continuous and one-shot capture modes

The implementation uses FlexPWM channel X as the dedicated input
capture channel, while channels 0 and 1 remain available for PWM
output. Capture functionality is conditionally compiled based on
CONFIG_PWM_CAPTURE configuration option.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-01-17 17:04:24 +01:00