Commit graph

530 commits

Author SHA1 Message Date
Benjamin Cabé
47108c3c86 drivers: counter: adopt SHELL_HELP
Adopt SHELL_HELP macro for counter_timer_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 09:09:01 -04:00
Benjamin Cabé
77e5bec398 drivers; counter: run clang-format on counter_timer_shell.c
Run clang-format on this file

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 09:09:01 -04:00
Ruibin Chang
962d8dfd18 drivers/counter/it8xxx2: fix loss timer interrupt potential risk
1.correct timer register control flow
2.select timer interrupt rising edge trigger, instead of default
level trigger

Stress test: top timer fires interrupt every 300ms for 18 hours.
The result is that we don't lose any interrupts.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2025-06-16 08:31:17 +02: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
Saravanan Sekar
7a3f79ef86 drivers: counter: Add a support for TI MSPM0 Timer counter
TI MSPM0 SoC series has General Purpose Timer and Advanced control timers
with Counting module, Capture block (measure input signal period/time) and
Compare block (to generate time expiry, output waveform like PWM).

Add a support for counter driver with alarm and counter top functions.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2025-06-10 10:25:10 -04:00
Ruibin Chang
47d1e38043 drivers/counter: implement it51xxx counter driver
Implement counter driver for ITE it51xxx series chip.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2025-06-05 12:33:29 +02:00
Sylvio Alves
ad3df1d0f2 driver: counter: esp32: make sure callback is executed
User callback can be used to re-trigger the alarm.
In such case, copy current callback before it is overritten.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-06-02 22:10:51 +02:00
Joel Guittet
9d4530fb79 drivers: counter: introduce counter node in esp32 timers
Add counter device tree node to the esp32 timers.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2025-05-29 08:41:59 +02:00
The Nguyen
613ee72670 drivers: counter: migrate counter AGT to using HAL support
Migrate renesas,ra-agt-counter implementation to use hal_renesas.
Add additional AGT_CLOCK_SUBCLOCK count source.
Add constraint for counter resolution to 32 or 16 bit variant.

Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
2025-05-27 11:50:37 +02:00
Sylvio Alves
df5ade9c3e drivers: counter: esp32: add guard period support
Implements guard period support.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-05-26 13:16:53 +02:00
Sylvio Alves
65473e8bee drivers: counter: esp32: add top value handling
Implements top value callback and handling.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-05-26 13:16:53 +02:00
Sylvio Alves
dca598e311 drivers: counter: esp32: add reset counter function
Adds option to reset counter value.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-05-26 13:16:53 +02:00
Stoyan Bogdanov
cfe7a58a28 drivers: counter: Add support for cc23x0 LGPT
Add support for LGPT0, LGPT1, LGPT2 and LGPT3 to cc23x0 SoC.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-05-23 11:03:24 +02:00
jhan bo chao
85dc257072 drivers: counter: rts5912: clear pending irq when setup
clear pending irq when setup.

Signed-off-by: jhan bo chao <jhan_bo_chao@realtek.com>
2025-05-22 20:57:15 +02:00
Stoyan Bogdanov
dddbfcce76 drivers: counter: Add support for cc23x0 RTC counter
Add support for cc23x0 RTC driver in counter.
RTC is always ON after device boot. Timer is restared only
on POR, and is active during STANDBY and ACTIVE power states.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
2025-05-21 17:34:16 +02:00
Anas Nashif
2aacbcaab5 style: add missing curly braces in if/while/for statements.
Add missing curly braces in if/while/for statements.

This is a style guideline we have that was not enforced in CI. All
issues fixed here were detected by sonarqube SCA.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-17 14:10:33 +02:00
Sean Kyer
3d55a9d410 drivers: counter: Place max32 API into iterable section
Add warpper DEVICE_API macro to counter_max32_wut instance.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-05-15 17:53:31 +02:00
Sean Kyer
ae681c48c7 drivers: counter: counter_max32_wut: Rename irq_config callback
Renamed irq_config callback function to follow
standard of other drivers.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-05-15 17:53:31 +02:00
Sean Kyer
b476fa78d2 drivers: counter: counter_max32_wut: Fixed PM resume routine
Seperated SW and HW initialization code so timer is not
wiped upon a PM resume event.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-05-15 17:53:31 +02:00
Sean Kyer
ee883a9f55 drivers: counter: counter_max32_wut: Add backup support
Added backup power mode support to max32 wut.

Signed-off-by: Sean Kyer <Sean.Kyer@analog.com>
2025-05-15 17:53:31 +02:00
Tahsin Mutlugun
ab43ceb1eb drivers: counter: Add MAX32 Wake-Up Timer driver
MAX32 Wake-Up Timer is a 32-bit timer that can wakeup the device from
low-power modes.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-05-15 17:53:31 +02:00
Sai Santhosh Malae
a1913f9d9f drivers: counter: siwx91x: Enable siwx91x Counter driver
Enable sleeptimer counter driver for siwx91x device

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-05-13 17:46:46 +02:00
Alberto Escolar Piedras
5c959c6136 drivers/counter/counter_native_sim: Merge if statements
To reduce the perceived code complexity

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-13 12:09:30 +02:00
Tsi-Chung Liew
e483b229de Counter_nxp_mrt: Adds PM low-power recovery support
Enables Sleep mode (PM3) in RW61x for MRT.

Signed-off-by: Tsi-Chung Liew <Tsi-Chung.Liew@nxp.com>
2025-05-12 19:19:40 +02:00
Tsi-Chung Liew
8ac0a675ee Counter_mcux_ctimer: Adds PM low-power recovery support
Enables Sleep mode (PM3) in RW61x for Ctimer.

Signed-off-by: Tsi-Chung Liew <Tsi-Chung.Liew@nxp.com>
2025-05-12 19:19:40 +02:00
Alberto Escolar Piedras
fe70e480f4 drivers/counter native_sim: Avoid reusing tag name
Don't use the same name for the structure instance and type.
As that is a violation of MISRA-C 2012 rule 5.7.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-12 09:47:59 +02:00
Joel Guittet
54b826336b drivers: counter: counter_reset api support to stm32 timer
Add support to reset counter value.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
2025-05-08 19:53:12 +02:00
Henrik Brix Andersen
2e8a08a165 drivers: counter: add NEORV32 GPTMR driver
Add counter driver for the NEORV32 General Purpose Timer (GPTMR).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-05-05 12:20:50 +02:00
Marcin Lyda
f7280fac32 drivers: counter: Add MCP7940N property to enable VBAT backup
This PR adds a new devicetree property
that allows enabling external battery
backup functionality.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-05-05 10:57:28 +02:00
Titan Chen
2bca8d4e59 drivers: counter: rts5912: add support timer32 counter driver
Port rts5912 timer32 counter driver on Zephyr

Signed-off-by: Titan Chen <titan.chen@realtek.com>
2025-04-22 14:02:27 +02:00
Hao Luo
6f4b92d64d soc: ambiq: Optimize the inclusion relationship of header files
Optimized the inclusion relationship of header files

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-04-17 09:06:18 +02:00
Marco Widmer
491e297418 drivers: counter: nrfx_timer: Use shutdown task if available
Add a workaround for NRF52 anomaly 78: "High current consumption when
using timer STOP task only". Use the SHUTDOWN task instead.

For consistency, CLEAR the timer timer after STOPPING on devices that
lack the SHUTDOWN task. This also aligns the behavior with
nrfx_timer_disable().

For devices with the SHUTDOWN task, this restores the behavior previous
to e92323f.

Fixes #87224

Signed-off-by: Marco Widmer <marco.widmer@bytesatwork.ch>
2025-04-09 11:43:01 +02:00
Yunshao Chiang
c6fe84caf2 drivers: counter: add ite it8xxx2 timer driver
The IT8xxx2 timer driver uses timer 7 and timer 8 to implement the alarm
timer and the top timer, respectively.

Signed-off-by: Yunshao Chiang <Yunshao.Chiang@ite.com.tw>
2025-04-08 16:12:11 +02:00
Titan Chen
5a94a1ca66 drivers: counter: rts5912: add support slow timer counter driver
Port rts5912 slow timer counter driver on Zephyr

Signed-off-by: Titan Chen <titan.chen@realtek.com>
2025-04-07 21:13:10 +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
James Roy
bcbf69ed9f drivers: counter: nrf: Add nrfx-timer implementation
Implement the '.reset' interface in the nrfx-timer driver
to allow the upper layers to use the counter_reset
function.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-26 08:54:58 +01:00
James Roy
d019aea47b drivers: counter: Add native-posix implementation example
Implement the '.reset' interface in the native-posix driver
to allow the upper layers to use the counter_reset
function.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-03-26 08:54:58 +01:00
Declan Snyder
b990f96feb dts: counter: Remove old kinetis lptmr binding
Remove deprecated nxp,kinetis-lptmr compatible string
which is superseded by nxp,lptmr compatible due to
removing family specific name.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-20 17:14:28 +01:00
Khaoula Bidani
4d3cce4872 drivers : counter: clean up usage of "USE_STM32_LL"
clean up usage of select USE_STM32_LL_RCC, USE_STM32_LL_EXTI
and USE_STM32_LL_PWR from Kconfig.stm32
this modifications due to the include unconditionally of
stm32xxxx_ll_rcc.h, stm32xxxx_ll_exti.h and
stm32xxxx_ll_pwr.h in the HAL.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-03-20 09:32:56 +01:00
Mathieu Choplain
eec7bb5514 drivers: counter: stm32_rtc: disallow enabling on STM32WB0 series
Don't allow enabling the driver on STM32WB0 series due to hardware erratum.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-19 01:32:43 +01:00
Alberto Escolar Piedras
ab7a6de5bb drivers/counter/counter_native_sim: Rename from counter_native_posix
Including renaming the DTS binding and kconfig options
deprecating the old one.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-03-10 06:52:37 +01:00
Krzysztof Chruściński
074215a30f drivers: clock_control: nrf: Move NRF_PERIPH_GET_FREQUENCY
Move macro from nrf_clock_control.h to soc_nrf_common.h. Clock control
header fetches many dependencies (e.g. onoff.h) so move macro to more
low level header.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-03-07 19:52:10 +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
Benjamin Cabé
c3bda347b2 drivers: fix spelling of "swiched"
s/swiched/switched/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-21 11:41:46 +00:00
Okan Sahin
d7eab212bc drivers: counter: counter_max32:_rtc: Update api_start
This commit removes redundant initialization. The following PR addresses
the issue caused by the offset
https://github.com/zephyrproject-rtos/zephyr/commit/5a2055

Signed-off-by: Okan Sahin <Okan.Sahin@analog.com>
2025-02-14 13:36:19 +01:00
Emilio Benavente
8640147c34 driver: counter: mcux_rtc: Move FSL check
Move FSL Check to after the code decided
that FSL has been defined.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2025-02-11 03:07:01 +01:00
Gerson Fernando Budke
e6caa3a6b4 drivers: counter: sam: tc: Update sam4l freq idx 0
The Atmel sam4l have generic clock 5 enabled at 1024Hz.  Update sam4l
sam_tc_input_freq_table index 0 to reflect right value.

signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-02-10 11:30:02 +01:00
Aziz Sellami
02b2d5563c drivers: counter: gpt: fix init sequence
The current code is enabling the IRQ before calling the GPT_Init()
function which (beside being incorrect by design) opens the door to a
spurious irq to cause the isr function call before the init.  This
corner case can be easily observed for example when running the code
inside a hypervisor/jailhouse where restarting the cell without
previous proper exit (device deinit) can cause a crash (null pointer
dereference) when an IRQ is triggered before the init.

Signed-off-by: Aziz Sellami <aziz.sellami@nxp.com>
2025-02-04 20:26:37 +01:00
Marouen Ghodhbane
c7d9cc1f47 drivers: counter: tpm: fix init sequence
The current code is enabling the IRQ before calling the TPM_Init()
function which (beside being incorrect by design) opens the door to a
spurious irq to cause the isr function call before the init.  This
corner case can be easily observed for example when running the code
inside a hypervisor/jailhouse where restarting the cell without
previous proper exit (device deinit) can cause a crash (null pointer
dereference) when an IRQ is triggered before the init.

Signed-off-by: Marouen Ghodhbane <marouen.ghodhbane@nxp.com>
2025-02-04 20:26:37 +01:00
Hieu Nguyen
bf6c665d73 drivers: counter: Initial support for RZ/G3S
Add Counter driver support for Renesas RZ/G3S

Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-02-04 09:16:34 +01:00