Commit graph

639 commits

Author SHA1 Message Date
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
Aymeric Aillet
d41ce536c5 drivers: rcar: Select CONFIG_PINCTRL
Select PINCTRL for drivers: pwm, sdhc, serial

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2024-11-22 17:41:02 +01:00
cyliang tw
355d032baa boards: nuvoton: numaker: Drop PINCTRL from board defconfig
To remove CONFIG_PINCTRL from board side for numaker boards.
The Drivers using Pinctrl should be turning Pinctrl on
instead of the responsibility of the board.

Fixes #78619

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-11-20 08:23:58 -05:00
Rafał Kuźnia
e18410944e modules: hal_nordic: add NRFX_GPPI config
The nrfx_gppi module is an abstraction over nrfx_ppi and nrfx_dppi
drivers. It now has a Kconfig option that is separate from nrfx_dppi and
by default it enables all PPI/DPPI instances, if available.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2024-11-19 09:53:10 -05:00
Jun Lin
69e85b25fe board: npcx: remove CONFIG_PINCTRL from defconfig of npcx boards
The CONFIG_PINCTRL is removed from the board's defconfig files.
Drivers which use pin control function should add "select PINCTRL"
in their Kconfig files.

Fixes #78619

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-11-07 08:59:14 -08:00
Thao Luong
c66dcd52db drivers: Select PINCTRL for renesas RA drivers
Select PINCTRL for drivers: adc, i2c, pwm, serial and spi

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2024-11-06 09:59:32 -08:00
Raffael Rostagno
b9fc4cc415 drivers: pwm: ledc: esp32c2: esp32c6: Fix clock frequency
Fix clock frequency for both devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-11-05 15:25:21 -06:00
Gerson Fernando Budke
0cc8f93e8a soc: atmel: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:43:26 -06:00
Gerson Fernando Budke
52d21d7bf0 soc: gd32: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.gd32.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:40:42 -06:00
Bill Waters
abca729367 driver: pwm: infineon: cyw920829m2evk_02 pwm
- Enable PWM for the cyw920829m2evk_02 board

Signed-off-by: Bill Waters <bill.waters@infineon.com>
2024-10-26 03:57:41 +01:00
David Brown
5969a10c30 drivers: pwm: rpi_pico: Convert clk calculations to fixed-point
Remove the use of floating point to calculate in
`pwm_rpi_get_cycles_per_sec` to fixed point calculations that result in the
same value.  There is still a division here, which is somewhat slow still,
but the end result about twice fast for the whole path through the led pwm
code.

Even better would be to cache these values, since there is no interface in
this driver to change the configuration past init time.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-10-25 18:11:14 -07:00
Gerard Marull-Paretas
1b0840e910 drivers: pwm: nrf_sw: always default to yes
There's no need to add conditions to CONFIG_PWM_NRF_SW, because it is
already conditioned to DT status. Right now, if any system uses both
normal PWM and "SW PWM", it needs to manually enable the driver
Kconfig.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-10-24 03:47:23 +01:00
Emilio Benavente
82a192c8a9 boards: nxp: Removing CONFIG_PINCTRL from the boards defconfig
The Drivers using Pinctrl should be turning Pinctrl on
this should not be the responsibility of the board. This
commit removes CONFIG_PINCTRL from the boards side for nxp boards.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-15 19:09:45 -04:00
Tim Lin
7fa962589f ITE: it8xxx2: Remove CONFIG_PINCTRL from soc defconfig file
The driver Kconfig determines whether pinctrl is enabled
instead of soc defconfig.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-10-15 13:52:55 +02:00
Krzysztof Chruściński
e11d050b23 drivers: pwm: nrfx: Improve runtime PM
Rework PM handling to use pm_device_driver_init(). Shim is not using
put and get internally as there is no api that disables or stops
pwm so it is hard to determine when to put the device. There are cases
when PWM peripheral is stopped but PWM is still active because
duty cycle is 100% or 0% and pin is driven by GPIO and not PWM.

If user want to use runtime PM with PWM it is possible and getting
the device will initialize internal data and putting will suspend
by forcing PWM stop if used and setting pins to sleep state. However,
from power consumption perspective it is enough to set 0% or 100%
duty cycle on all channels.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-11 13:18:34 -04:00
Krzysztof Chruściński
c3a33cfd3e drivers: pwm: nrfx: Disable PWM peripheral when not used
Shim was not correctly disabling PWM when it was not used. Task
STOP was triggered but PWM->ENABLE remained set which caused
increased current. Added interrupt and enabled event handler in
the nrfx driver to allow disabling PWM on STOPPED event.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-11 13:18:34 -04:00
Krzysztof Chruściński
0ab86c48dd drivers: pwm: nrfx: Improve device generation macros
Use NRFX_FOREACH_PRESENT macro to iterate over all PWM instances
and create device only for those enabled in the devicetree.
This approach removes need of changing driver code when new
instance id is added.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-10-11 13:18:34 -04:00
Duy Phuong Hoang. Nguyen
59dbbb347d drivers: pwm: Initial support for PWM driver on RA8
Add PWM driver code support for RA8. This support is using
GPT HW

Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
2024-10-11 09:28:29 +02:00
TOKITA Hiroshi
275162fd52 drivers: pwm: rpi_pico: Configuring the divide ratio adaptively
If the `divider-int-0` or variations of these for each channel properties
are not specified, or if these is 0,
the driver dynamically configures the division ratio by specified cycles.

The driver will operate at the specified division ratio if a non-zero
value is specified for `divider-int-0`.
This is unchanged from previous behavior.

Please specify ``divider-int-0`` explicitly to make the same behavior as
before.

In addition, the default device tree properties related to the division
ratio have been removed.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-10 10:07:47 +02:00
Yangbo Lu
11ef521c60 drivers: pwm_mcux_tpm: adapt to more platforms
The TPM max channel number was got from register array size.
However some platforms TPM instance may begin from TPM1 rather
than TPM0. This should be handled in driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2024-10-07 18:43:12 +02:00
Declan Snyder
fb3fce570f drivers: pwm_mcux_tpm: support pause level feature
Support TPM devices with the pause level selection feature

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-09-29 21:21:34 +02:00
Jeppe Odgaard
bb88d5f1f1 drivers: pwm: pwm_stm32: remove capture overflow log err
The `LOG_ERR` will spam the log if the window is low e.g. 1 ms.
Also the PWM capture callback will be called with an error, which allows
handling and logging the error if desired.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-09-25 04:01:59 -04:00
Sadik Ozer
18c991acc4 drivers: pwm: Add MAX32xxx PWM driver
Common pwm driver for MAX32xxx MCUs

Co-authored-by: Mert Ekren <mert.ekren@analog.com>
Co-authored-by: Mert Vatansever <mert.vatansever@analog.com>
Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2024-09-23 18:12:00 -04:00
Fabrice DJIATSA
d2ddb6541d drivers: pwm: update stm32 pwm driver
add stm32u0x soc configuration to be able to
run test on new boards.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2024-09-23 10:02:16 +02:00
Filip Kokosinski
0abc9fb8be boards: remove CONFIG_PINCTRL from defconfig files of FE310-based boards
This commit removes the y-selection of the `CONFIG_PINCTRL` Kconfig option
in FE310-based boards defconfig files.

It also makes drivers used in FE310 y-select `CONFIG_PINCTRL` if pinmuxing
is needed.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2024-09-20 13:14:41 +02:00
Michal Smola
60c1c50895 drivers: pwm: Fix NXP TPM without combine channel feature
TMP variant without combine channel feature is used in some NXP SoCs.
Build error occurs for such socs because of accessing unavailable
struct member in hal.
Fix it by adding #if directive to check the feature presence.

Signed-off-by: Michal Smola <michal.smola@nxp.com>
2024-09-12 14:48:32 +02:00
Pisit Sawangvonganan
847a4eaad2 style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-11 07:40:35 -04:00
Sylvio Alves
8233b70ece espressif: clean up unused code
Remove all entries that as not being used.
This also update hal to re-enable warning flags
as such as -Wno-unused-variable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-09-09 13:55:39 -04:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Ayush Singh
348388b678 drivers: cc13xx_cc26xx: pwm: Add polarity flag support
- Allow setting polarity from DT.
- At least on bcf, going from 0 to 255 causes brightness to decrease
  (although 0 is still off and 255 is still on).
- Seems to work as expcted by using TnPWML register.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2024-08-27 10:51:04 -04:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
bb746cdcc5 drivers: esp32: esp_intr_alloc return condition
Add checks to return value of esp_intr_alloc to avoid drivers init
returning 0 when interrupt allocation fails.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Marek Sroka
226e381d6e drivers: pwm: pwm_stm32: Add error log for 16-bit timer buffer overflow
If the value in the period_cycles variable exceeds UINT16_MAX, a 16-bit
timer will return an error code 134. An error message was added to
indicate that the value does not fit into the 16-bit timer register.
An error message advising developers to reduce the value to 16-bit
simplifies the process, allowing them to understand immediately that
reducing the value will resolve the issue.

Signed-off-by: Marek Sroka <m.sroka14@gmail.com>
2024-08-16 16:29:49 +01:00