Skip to content

Commit

Permalink
mpsl: enable use of nrfx_power_constlat_mode
Browse files Browse the repository at this point in the history
Enable application to have several modules requesting constlat.
Right now, on 54l, mpsl just writes to NRF_POWER directly, disregarding
what other users in system might want constlat to be.

This PR prepares for a soon commig nrfxlib PR where mpsl will rather
use mpsl_constlat_request_callback to turn on constlat.
If NRFX_POWER modules is enabled in config,
it will use nrfx_power_constlat_mode_request,
if not it will use NRF_POWER diretly.

Signed-off-by: Martin Tverdal <[email protected]>
  • Loading branch information
martintv committed Oct 7, 2024
1 parent 2a83686 commit c26b730
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion subsys/mpsl/init/mpsl_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <mpsl/mpsl_work.h>
#include "multithreading_lock.h"
#include <nrfx.h>
#if IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF54LX)
#include <nrfx_power.h>
#endif
#if defined(CONFIG_NRFX_DPPI)
#include <nrfx_dppi.h>
#endif
Expand Down Expand Up @@ -395,7 +398,8 @@ static int32_t mpsl_lib_init_internal(void)

mpsl_clock_hfclk_latency_set(CONFIG_MPSL_HFCLK_LATENCY);

if (IS_ENABLED(CONFIG_SOC_NRF_FORCE_CONSTLAT)) {
if (IS_ENABLED(CONFIG_SOC_NRF_FORCE_CONSTLAT) &&
!IS_ENABLED(CONFIG_SOC_COMPATIBLE_NRF54LX)) {
mpsl_pan_rfu();
}

Expand Down Expand Up @@ -509,6 +513,26 @@ int32_t mpsl_lib_uninit(void)
#endif /* IS_ENABLED(CONFIG_MPSL_DYNAMIC_INTERRUPTS) */
}

#if defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
void mpsl_constlat_request_callback(void)
{
#if defined(CONFIG_NRFX_POWER)
nrfx_power_constlat_mode_request();
#else
nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_CONSTLAT);
#endif
}

void mpsl_lowpower_request_callbacqk(void)
{
#if defined(CONFIG_NRFX_POWER)
nrfx_power_constlat_mode_free();
#else
nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_LOWPWR);
#endif
}
#endif /* defined(CONFIG_SOC_COMPATIBLE_NRF54LX) */

SYS_INIT(mpsl_lib_init_sys, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
SYS_INIT(mpsl_low_prio_init, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

0 comments on commit c26b730

Please sign in to comment.