Skip to content

Commit 31fadc8

Browse files
[nrf fromtree] drivers: timer: nrf_grtc_timer: Add system_clock_disable implementation
Add implementation of `sys_clock_disable` function for GRTC timer. Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no> (cherry picked from commit dfff593)
1 parent eaa9cbe commit 31fadc8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/timer/Kconfig.nrf_grtc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ menuconfig NRF_GRTC_TIMER
66
default y
77
depends on DT_HAS_NORDIC_NRF_GRTC_ENABLED
88
select TICKLESS_CAPABLE
9+
select SYSTEM_TIMER_HAS_DISABLE_SUPPORT
910
select TIMER_HAS_64BIT_CYCLE_COUNTER
1011
select NRFX_GRTC
1112
help

drivers/timer/nrf_grtc_timer.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ uint64_t z_nrf_grtc_timer_startup_value_get(void)
368368
#if defined(CONFIG_POWEROFF) && defined(CONFIG_NRF_GRTC_START_SYSCOUNTER)
369369
int z_nrf_grtc_wakeup_prepare(uint64_t wake_time_us)
370370
{
371+
if (!nrfx_grtc_init_check()) {
372+
return -ENOTSUP;
373+
}
374+
371375
nrfx_err_t err_code;
372376
static struct k_spinlock lock;
373377
static uint8_t systemoff_channel;
@@ -460,6 +464,21 @@ ISR_DIRECT_DECLARE(nrfx_grtc_direct_irq_handler)
460464
}
461465
#endif
462466

467+
void sys_clock_disable(void)
468+
{
469+
nrfx_grtc_uninit();
470+
#if defined(CONFIG_CLOCK_CONTROL_NRF)
471+
int err;
472+
struct onoff_manager *mgr =
473+
z_nrf_clock_control_get_onoff((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_LFCLK);
474+
475+
err = onoff_release(mgr);
476+
__ASSERT_NO_MSG(err >= 0);
477+
478+
nrfx_coredep_delay_us(1000);
479+
#endif
480+
}
481+
463482
static int sys_clock_driver_init(void)
464483
{
465484
nrfx_err_t err_code;

0 commit comments

Comments
 (0)