Skip to content

Conversation

JordanYates
Copy link
Contributor

@JordanYates JordanYates commented Oct 3, 2025

Move the option to force constant latency mode outside of nRF54l, since it is an option applicable to most Nordic SoCs.

This is a quality-of-life option to prevent boards/applications from needing to implement the calls themselves.

nordicjm
nordicjm previously approved these changes Oct 3, 2025
carlescufi
carlescufi previously approved these changes Oct 3, 2025
}

/* Immediately after the SoC init functions */
SYS_INIT(nrf_const_lat, PRE_KERNEL_1, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this code actually be in one of the hooks, to avoid yet another SYS_INIT ? Or perhaps in soc.c?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look around for an appropriate place and couldn't find one. For soc.c it would need to duplicated for each Nordic SoC. If that is preferred I can do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use on-off service and port Bluetooth Controllers to use them. Otherwise, low power mode would get set after radio events.

@JordanYates
Copy link
Contributor Author

Added Bluetooth controller change to address @cvinayak comment.

cvinayak
cvinayak previously approved these changes Oct 6, 2025
Comment on lines +225 to +227
#if defined(CONFIG_NRF_SYS_EVENT)
(void)nrf_sys_event_request_global_constlat();
#else /* !CONFIG_NRF_SYS_EVENT */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no expertise here, but the changes look reasonable.

bool "nRF system event support"
select NRFX_POWER if !NRF_PLATFORM_HALTIUM

config NRF_FORCE_CONSTANT_LATENCY
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a feature like that in nRF54L familiy.

config SOC_NRF_FORCE_CONSTLAT

Can you rename it to SOC_NRF_FORCE_CONSTLAT here and remove the Kconfig from nrf54l/Kconfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know that existed, and based on comments from @cvinayak the option is probably broken when used with a Bluetooth controller

Copy link
Contributor

@nordic-krch nordic-krch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dupilicate code from nrf54l/soc.c would need to be removed:

nrf_power_task_trigger(NRF_POWER, NRF_POWER_TASK_CONSTLAT);


config NRF_FORCE_CONSTANT_LATENCY
bool "Force constant latency mode in system ON"
depends on NRF_SYS_EVENT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo it should be a select.
There should be depends on !SOC_NRF54H20 && !RISCV

Copy link
Contributor

@bjarki-andreasen bjarki-andreasen Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NRF_SYS_EVENT is available to the NRF54H20 app and radio cores, so only !RISCV would be helpful.

Copy link
Contributor

@nordicjm nordicjm Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!RISCV ? I have this being changed in the register directly from the flpr core and it doesn't seem to cause problems so that condition seems wrong:

	/* Switch to constant latency */
//NRF_POWER_NS_BASE
	NRF_POWER->TASKS_LOWPWR = 0;
	NRF_POWER->TASKS_CONSTLAT = 1;
k_sleep(K_SECONDS(2));

Ah becuase of sys event

Copy link
Contributor

@bjarki-andreasen bjarki-andreasen Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If CONSTLAT is supported on RISCV cores, we should probably extend SYS_EVENT?

Move the option to force constant latency mode outside of nRF54l, since
it is an option applicable to most Nordic SoCs.

Signed-off-by: Jordan Yates <[email protected]>
Validate that `CONFIG_SOC_NRF_FORCE_CONSTLAT=y` compiles.

Signed-off-by: Jordan Yates <[email protected]>
When `CONFIG_NRF_SYS_EVENT` is enabled, route constant latency requests
through the reference counted API.

Signed-off-by: Jordan Yates <[email protected]>
@JordanYates JordanYates dismissed stale reviews from cvinayak and bjarki-andreasen via 88a5a53 October 7, 2025 06:36
@JordanYates JordanYates changed the title soc: nordic: common: force CONSTLAT kconfig soc: nordic: common: CONFIG_SOC_NRF_FORCE_CONSTLAT Oct 7, 2025
@JordanYates
Copy link
Contributor Author

Updated PR to pull the already existing option out to the common level, so current users on nRF54L won't see any changes.

Copy link

sonarqubecloud bot commented Oct 7, 2025

@henrikbrixandersen henrikbrixandersen merged commit 1f3ce81 into zephyrproject-rtos:main Oct 7, 2025
32 checks passed
@JordanYates JordanYates deleted the 251003_nrf_constlat branch October 7, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants