Commit Graph

236 Commits

Author SHA1 Message Date
Holt Sun
4618e86edd drivers: irtc: Updated rtc driver to support NXP RT700 device.
1. Update nxp irtc driver to fix issue in init and alarm function.
2. Update RTC device tree binding to support "share-counter".
3. Update RT700 dtsi to support rtc0 for cpu0 and rtc1 for cpu1.
4. Update readme.
5. Update unit test project conf for RT700.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2025-07-28 16:42:30 -04:00
Alexander Kozhinov
e01357461d drivers: rtc: rtc_ll_stm32: update to new EXTI API
integrate EXTI driver

Co-authored-by: Mathieu CHOPLAIN <mathieu.choplain@st.com>
Signed-off-by: Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
2025-07-25 08:18:48 -04:00
Etienne Carriere
9b022972d8 drivers: rtc: stm32: narrow backup domain access window during interrupts
Change backup domain access gating in STM32 RTC interrupt handler
to only request access when RTC registers ar to be modified
instead of during the whole RTC interrupts service including
interrupt consumer callback execution.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2025-07-04 13:06:36 -05:00
Etienne Carriere
007d3e3c85 drivers: rtc: stm32: fix unbalanced backup domain access request
Fix the backup domain access request in STM32 RTC initialization that
was unbalanced in case of clock configuration failure.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2025-07-04 13:06:36 -05:00
Tony Han
95454914bf drivers: rtc: sam: update for supporting RTC of sama7g5 devices
The basic characteristics of "atmel,sam-rtc" is the same as the ones
of sama7g5.

Differences between the RTCs listed bellow:
                    | atmel,sam-rtc | rtc in sama7g5
--------------------|---------------|----------------------
Persian calendar    |      Y        |         N
UTC Mode support    |      N        |         Y
Tamper Timestamping |      N        |         Y

Signed-off-by: Tony Han <tony.han@microchip.com>
2025-06-26 10:42:39 -10:00
Etienne Carriere
c7ea5a89e6 drivers: rtc: stm32: refcounter for Backup domain accesses
Use recently added SoCs functions to request access to SoC backup
domain resources These function use a reference counter to track these
request and ensure the resources are accessible as long as at least a
consumer requires access.

By the way, move inclusion of stm32_hsem.h header file after inclusion
of the LL header files and Zephyr header standard files.

Fixes issue 90942.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
2025-06-26 12:43:17 +02:00
Benjamin Cabé
c8349073d5 drivers: rtc: adopt SHELL_HELP
Adopt SHELL_HELP macro for rtc shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-17 16:25:32 -05:00
Benjamin Cabé
c31b7898aa drivers: rtc: rpi_pico: fix tm_mon and tm_mday offsets
tm_mon is 0-11 and pico hw is 1-12
tm_mday is 1-31 and so is pico

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-12 13:40:59 +02:00
Thiyagarajan Pandiyan
f432d5d510 drivers: rtc: pcf8563: fix get alarm time
While getting alarm time, BIT(7) of each register is checked if it is
set, which send the alarm time as 0 to the requestor. Fix it by checking
if the BIT(7) of each register is not set.

Signed-off-by: Thiyagarajan Pandiyan <psvthiyagarajan@gmail.com>
2025-05-28 05:54:49 +02:00
Martin Hoff
742261ddaa drivers: rtc: add silabs siwx91x rtc driver
Add the support of silabs siwx91x basic rtc driver.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-05-15 14:09:23 +02:00
Qingsong Gou
2e484fc6e5 rtc: fix gpio_pin_configure_dt error
GPIO_PULLUP is not in other driver gpio int API, so keep the same

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
2025-05-14 14:11:00 +02:00
Vixay Phimmasane
e55a505989 drivers: rtc: check PORF flag before clearing alarm flags at init
alarm flags only need to be cleared if PORF flag is set; otherwise,
the RTC is already running and alarm flags must not be cleared

Signed-off-by: Vixay Phimmasane <visuphi@gmail.com>
2025-04-30 09:48:42 +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
Lukas Gunnarsson
e7201b9f2c drivers: rtc: add nxp pcf2123 driver
Add driver support for the NXP PCF2123 RTC.

Signed-off-by: Lukas Gunnarsson <lukasgunnarsson@protonmail.com>
2025-04-07 21:13:29 +02:00
Valerio Setti
e2344739ac drivers: rtc: pcf8563: some fixes to the driver
- Define alarm_set_callback() only when CONFIG_RTC_ALARM is set otherwise
a warning will be generated at runtime for the function not being
used.

- add "static" keyword to all internal functions.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-03-21 14:17:45 +01:00
Jeppe Odgaard
62e1d4b449 drivers: rtc: rtc_ll_stm32: rework lock usage in rtc_stm32_set_time
Lock just before and just after accessing functions that modifies register
values.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-21 09:51:56 +01:00
Jeppe Odgaard
7c996c84ce drivers: rtc: rtc_ll_stm32: replace k_mutex with k_spinlock
This allows using this RTC driver from contexts where `k_mutex` use is not
allowed.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-21 09:51:56 +01:00
Khaoula Bidani
0364dd3512 drivers : rtc: clean up usage of "select USE_STM32_LL"
clean up usage of select USE_STM32_LL_RCC and
select USE_STM32_LL_PWR from Kconfig.stm32
this modifications due to the include unconditionally of
stm32xxxx_ll_rcc.h and stm32xxxx_ll_pwr.h in HAL.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-03-20 09:32:56 +01:00
Mathieu Choplain
5af226400d drivers: rtc: stm32: handle STM32WB0 series when RTC_ALARM is enabled
RTC alarm is not supported by the driver for now due to the complexity it
would take to work around an hardware erratum. However, it is not possible
to prevent CONFIG_RTC_ALARM from being enabled at Kconfig level.
Modify the RTC driver such that enabling CONFIG_RTC_ALARM on STM32WB0
series does not cause build errors anymore.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-19 01:32:43 +01:00
Mathieu Choplain
4a9f88378b drivers: rtc: stm32: add support for STM32WB0 series
Modify STM32 RTC driver to support the WB0 series.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2025-03-19 01:32:43 +01:00
Chia-Yang Lin
bd365a0bae drivers: rtc: rts5912: add rtc driver
Add rtc driver for Realtek rts5912.

Signed-off-by: Chia-Yang Lin <cylin0708@realtek.com>
2025-03-15 06:43:46 +01:00
Måns Ansgariusson
467e15ddd3 drivers: rtc: rx8130ce: day alarm fix
The day alarm was not being set correctly. The day alarm should be set
using the WADA bit in the control register. This patch fixes the issue
by setting the WADA bit in the control register when setting the day alarm.

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-02-28 14:51:43 +01:00
Marcin Lyda
f370d38363 drivers: rtc: Add Maxim DS1337 RTC driver
This PR adds support for Maxim Integrated
DS1337 RTC chip.

Supported functionalities:
* Alarm interrupt (both alarms trigger INTA pin)
* Time setting/reading
* Both alarms setting/reading
* SQW frequency configuration

Tested on nRF52833-DK using rtc_api test set.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-02-14 03:03:56 +01:00
Pieter De Gendt
f47bfebd28 drivers: rtc: Wrap driver instances in device API macro
Use the device API macro to place the driver API instance into an iterable
section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-12 16:06:25 +01:00
Gerson Fernando Budke
f2fa8f965e drivers: rtc: sam0: Add realtime clock driver
Add Atmel sam0 rtc calendar driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-02-07 07:37:56 +01:00
Stephan Linz
cca2053448 drivers: rtc: maxim,ds3231: avoid compilation error
Because of wrong integer type syntax following error occurred:

drivers/rtc/rtc_ds3231.c:361:76: error: unknown type name 'u'
  361 | static int rtc_ds3231_alarm_get_supported_fields(
      |                    const struct device *dev, u int16_t id,
      |                                              ^

Signed-off-by: Stephan Linz <linz@li-pro.net>
2025-02-05 01:16:03 +01:00
Stephan Linz
2a793cf0f8 drivers: rtc: maxim,ds3231: avoid warnings about unused code
Compile warnings occurred in common standard use case
w/o RTC alarm and update.

Warning was:

drivers/rtc/rtc_ds3231.c: In function 'rtc_ds3231_init':
drivers/rtc/rtc_ds3231.c:808:33: warning: unused variable 'data'
                 [-Wunused-variable]
  808 |         struct rtc_ds3231_data *data = dev->data;
      |                                 ^~~~
drivers/rtc/rtc_ds3231.c: At top level:
drivers/rtc/rtc_ds3231.c:195:12:
        warning: 'rtc_ds3231_get_ctrl_sts' defined but not used
                 [-Wunused-function]
  195 | static int rtc_ds3231_get_ctrl_sts(const struct device *dev,
      |                                    uint8_t *buf)
      |            ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stephan Linz <linz@li-pro.net>
2025-02-05 01:16:03 +01:00
Måns Ansgariusson
36b3e9285d drivers: rtc: Add support for Epson RX8130CE RTC driver
This commit introduces a driver for the Epson RX8130CE rtc.
The driver provides the following functionalities:

- Time setting and retrieval
- Periodic update interrupt support (1Hz)
- Alarm setting and retrieval (minute, hour, day)
- Frequency output control (32.768kHz, 1.024kHz, 1Hz, off)
- Power management (automatic power switching & battery charging)
- Calibration setting and retrieval

Signed-off-by: Måns Ansgariusson <Mansgariusson@gmail.com>
2025-02-05 01:12:41 +01:00
Marcin Lyda
5100850767 drivers: rtc: Add Texas Instruments BQ32002 RTC driver
This PR adds support for BQ32002 RTC chip.

Supported functionalities:

* Time setting/reading
* Alarm setting/reading
* Calibration setting/reading
* IRQ frequency configuration

Tested on nRF52833-DK board.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-01-29 07:08:28 +01:00
Fabio Baltieri
6ba3274373 rtc_shell: add shell device filtering
Add shell device filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-29 04:17:47 +01:00
Marcin Lyda
87a15967bb drivers: rtc: Add DS1307 SQW output config property
This PR adds a devicetree property enabling to
configure DS1307 SQW pin output frequency.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-01-27 21:04:36 +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
Marcin Lyda
f0a70b0366 drivers: rtc: Fix failing RV8803 driver build when int-gpios not used
This PR fixes the issue that building the driver with either
CONFIG_RTC_CALIBRATION=y or CONFIG_RTC_ALARM=y and without
'int-gpios' used will cause
'undefined reference to `rv8803_write_reg8'' error.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-01-14 13:24:42 +01:00
Marcin Lyda
5c8cf4c127 drivers: rtc: Add Micro Crystal RV-8803-C7 RTC driver
This PR adds support for Micro Crystal RV-8803-C7
RTC chip.

Supported functionalities:
* Update interrupt
* Alarm interrupt
* Time setting/reading
* Alarm setting/reading
* Aging offset calibration setting/reading
* CLKOUT configuration

Tested on nRF52833-DK using rtc_api test set.

Signed-off-by: Marcin Lyda <elektromarcin@gmail.com>
2025-01-09 23:26:37 +01:00
Gergo Vari
2759adaf1a drivers: rtc: maxim,ds3231: RTC driver
This is a squash of all the groundwork needed to
get a functioning driver for the DS3231 with the RTC API.

Signed-off-by: Gergo Vari <work@gergovari.com>
2025-01-07 23:00:05 +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
Hao Luo
63904f3a19 drivers: rtc: add rtc support for apollo3&3p
Add RTC support for Apollo3 and Apollo3 Plus Soc

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-12-17 05:48:58 +01:00
James Roy
7bfd5c0a10 drivers: rtc: unchecked return value in rv8263
Fix unchecked return value scanned by Coverity.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2024-12-15 19:24:17 +01:00
Bjarki Arge Andreasen
84532b24e5 drivers: RTC: update API to use DEVICE_API macros
Update RTC API and device drivers to use DEVICE_API macros.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2024-12-03 10:40:18 +01:00
Gerson Fernando Budke
d71d4c0e80 drivers: rtc: sam: Fix missing function
The #64939 introduced a few convenience function like
rtc_utils_validate_rtc_time. However the PR did not replace all
occurrences which result on a build error. This add the missing
header include to remove a building warning and replace the old
function by the new one.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-15 11:08:58 -06:00
Andrew Feldhaus
a2e920cf96 drivers: rtc: rtc_ds1307: Fix corruption of SECONDS register
We read/modify/write the CH/SECONDS register at initialisation to clear
only the Clock Halt bit and only if it is set.

The previous implementation zeroes the entire register unconditionally at
initialisation, which wipes the SECONDS fields.

Fixes #77354.

Signed-off-by: Andrew Feldhaus <github@feldhaus.co.uk>
2024-11-08 13:58:10 -06:00
Daniel Kampert
ec10d56fbb drivers: rtc: rv8263-c8: Alarm reworking
- Fix typos for alarm field identification
- Fix a bug where an alarm interrupt starts
update interrupts
- Rework interrupt code to reduce code size
and complexity

Signed-off-by: Daniel Kampert <danielkampert@kampis-elektroecke.de>
2024-11-06 14:43:10 -06:00
Emilio Benavente
ca3041f11a drivers: rtc: Added IRTC Driver Support.
Added NXP IRTC Driver support and binding.
This driver is expected for users needing
Time Date info in their application.
The driver additionally has an alarm mode that
can be enabled to fire an intterupt when the time
and alarm values match.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-10-26 03:58:48 +01:00
McAtee Maxwell
61b00097d8 Verification: verify code changes from PR review
- verify code changes from PR review

Signed-off-by: McAtee Maxwell <maxwell.mcatee@infineon.com>
2024-10-09 13:46:56 +02:00
McAtee Maxwell (CSS ICW SW MTO INT 2)
30f2e5120a Drivers: RTC: Initial implementation of RTC for IFX cyw20829
- Initial driver implementation
	- Overlay for rtc_api test
	- dtsi updates.

Signed-off-by: McAtee Maxwell (CSS ICW SW MTO INT 2) <maxwell.mcatee@infineon.com>
2024-10-09 13:46:56 +02:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01: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
Andriy Gelman
4ffe418253 drivers: rtc: Add RTC driver for Infineon XMC4xxx devices
Adds support for settings/getting RTC time and using alarm/update feature.
The alarm option needs all fields to be set due to a hardware limitation.

RTC shares the same interrupt with the watchdog. Thus shared
interrupts must be enabled when WDT and RTC both need to trigger the ISR.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2024-09-04 09:54:52 +02:00
Jeppe Odgaard
6446ce8982 drivers: rtc: rtc_ll_stm32: add hse clock support
Add support for HSE as the RTC clock source.

The initial implementation has the following limitations:
 - Only whole MHz HSE frequency is supported, e.g. 24.5 MHz will generate a
 compile error.
 - Frequencies equal or above 64 MHz are not supported and will generate a
   compile error.

The implementation has been tested on nucleo_h563zi with:
 - 8 MHz (via hse-bypass)
 - 25 MHz (via external crystal)

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-08-28 06:51:00 -04:00
Daniel Kampert
db9b45a7b3 drivers: rtc: off-by-one error in RV-8263-C8 driver
1. tm_mon in rtc_time structure has a range [0, 11],
while the RTC expects [1, 12]. Add missing
increasing / decreasing of this value.

2. Fix typo in debug log

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2024-08-22 14:21:41 -04:00