Skip to content

Commit

Permalink
[nrf fromlist] modules: hal_nordic: nrf_802154: enable constant latency
Browse files Browse the repository at this point in the history
To ensure that the accesses to the radio peripheral are done with
predictable timings, the constant latency must be enabled.
The constant latency mode is enabled alongside the HFXO.

Upstream PR #: 85883

Signed-off-by: Rafał Kuźnia <[email protected]>
  • Loading branch information
e-rk authored and nordicjm committed Feb 25, 2025
1 parent 65d9b7d commit 0b58ccd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/hal_nordic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ menuconfig NRF_802154_RADIO_DRIVER

if NRF_802154_RADIO_DRIVER

config NRF_802154_CONSTLAT_CONTROL
def_bool y
depends on SOC_SERIES_NRF54LX && NRF_802154_SL_OPENSOURCE
select NRF_SYS_EVENT
help
Allows the nRF 802.15.4 radio driver to manage the constant latency state.

config NRF_802154_MULTIPROTOCOL_SUPPORT
bool
help
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <compiler_abstraction.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
#include <nrf_sys_event.h>

static bool hfclk_is_running;

Expand Down Expand Up @@ -52,6 +53,14 @@ void nrf_802154_clock_hfclk_start(void)

sys_notify_init_callback(&hfclk_cli.notify, hfclk_on_callback);

/*
* todo: replace constlat request with PM policy API when
* controlling the event latency becomes possible.
*/
if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) {
nrf_sys_event_request_global_constlat();
}

int ret = onoff_request(mgr, &hfclk_cli);
__ASSERT_NO_MSG(ret >= 0);
(void)ret;
Expand All @@ -67,6 +76,11 @@ void nrf_802154_clock_hfclk_stop(void)
int ret = onoff_cancel_or_release(mgr, &hfclk_cli);
__ASSERT_NO_MSG(ret >= 0);
(void)ret;

if (IS_ENABLED(CONFIG_NRF_802154_CONSTLAT_CONTROL)) {
nrf_sys_event_release_global_constlat();
}

hfclk_is_running = false;
}

Expand Down

0 comments on commit 0b58ccd

Please sign in to comment.