diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig b/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig index c007d899b124..e2a248ed6be3 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig +++ b/tests/benchmarks/multicore/idle_pwm_loopback/Kconfig @@ -12,4 +12,29 @@ config TEST_SLEEP_DURATION_MS Based on the value of 'min-residency-us' specified for each power state defined in the DTS, core enters the lowest possible power state. +choice GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION + prompt "Global domain clock frequency" + default GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + bool "320MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ + bool "256MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ + bool "128MHz" + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ + bool "64MHz" + +endchoice + +config GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ + int + default 320 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ + default 256 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ + default 128 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ + default 64 if GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ + source "Kconfig.zephyr" diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c b/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c index 033299976880..9f330a66cf71 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c +++ b/tests/benchmarks/multicore/idle_pwm_loopback/src/main.c @@ -12,6 +12,10 @@ LOG_MODULE_REGISTER(idle_pwm_loop, LOG_LEVEL_INF); #include #include +#if defined(CONFIG_CLOCK_CONTROL) +#include +#include +#endif #if !DT_NODE_EXISTS(DT_NODELABEL(pwm_to_gpio_loopback)) #error "Unsupported board: pwm_to_gpio_loopback node is not defined" @@ -30,6 +34,41 @@ static volatile uint32_t high, low; static struct k_timer my_timer; static bool timer_expired; + +#if defined(CONFIG_CLOCK_CONTROL) +const struct nrf_clock_spec clk_spec_global_hsfll = { + .frequency = MHZ(CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ) +}; + +/* + * Set Global Domain frequency (HSFLL120) + * based on: CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_MHZ + */ +void set_global_domain_frequency(void) +{ + int err; + int res; + struct onoff_client cli; + const struct device *hsfll_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)); + + printk("Requested frequency [Hz]: %d\n", clk_spec_global_hsfll.frequency); + sys_notify_init_spinwait(&cli.notify); + err = nrf_clock_control_request(hsfll_dev, &clk_spec_global_hsfll, &cli); + printk("Return code: %d\n", err); + __ASSERT_NO_MSG(err < 3); + __ASSERT_NO_MSG(err >= 0); + do { + err = sys_notify_fetch_result(&cli.notify, &res); + k_yield(); + } while (err == -EAGAIN); + printk("Clock control request return value: %d\n", err); + printk("Clock control request response code: %d\n", res); + __ASSERT_NO_MSG(err == 0); + __ASSERT_NO_MSG(res == 0); +} +#endif /* CONFIG_CLOCK_CONTROL */ + + void my_timer_handler(struct k_timer *dummy) { timer_expired = true; @@ -58,6 +97,11 @@ int main(void) uint32_t tolerance; int ret; +#if defined(CONFIG_CLOCK_CONTROL) + k_msleep(1000); + set_global_domain_frequency(); +#endif + /* Set PWM fill ratio to 50% */ pulse = pwm_out.period >> 1; diff --git a/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml b/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml index e7bff259f096..8549684b8cd0 100644 --- a/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml +++ b/tests/benchmarks/multicore/idle_pwm_loopback/testcase.yaml @@ -1,6 +1,8 @@ common: sysbuild: true - tags: ci_build ci_tests_benchmarks_multicore + tags: + - ci_build + - ci_tests_benchmarks_multicore platform_allow: - nrf54h20dk/nrf54h20/cpuapp integration_platforms: @@ -21,10 +23,10 @@ tests: benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle: tags: ppk_power_measure extra_args: - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf - remote_CONF_FILE=prj_s2ram.conf - idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500 - remote_CONFIG_TEST_SLEEP_DURATION_MS=500 + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500 + - remote_CONFIG_TEST_SLEEP_DURATION_MS=500 harness: pytest harness_config: fixture: spi_loopback @@ -34,8 +36,8 @@ tests: benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram: tags: ppk_power_measure extra_args: - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf harness: pytest harness_config: fixture: spi_loopback @@ -44,7 +46,9 @@ tests: benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.no_sleep_fast: extra_args: - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y + - idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ=y harness: console harness_config: type: multi_line @@ -57,23 +61,79 @@ tests: benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.idle_fast: tags: ppk_power_measure extra_args: - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf - remote_CONF_FILE=prj_s2ram.conf - idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500 - remote_CONFIG_TEST_SLEEP_DURATION_MS=500 - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_CONFIG_TEST_SLEEP_DURATION_MS=500 + - remote_CONFIG_TEST_SLEEP_DURATION_MS=500 + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" harness: pytest harness_config: fixture: spi_loopback pytest_root: - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_idle" - benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast: + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.no_clock_control: tags: ppk_power_measure extra_args: - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf - remote_CONF_FILE=prj_s2ram.conf - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_320MHz: + tags: ppk_power_measure + extra_args: + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y + - idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_320MHZ=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_256MHz: + tags: ppk_power_measure + extra_args: + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y + - idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_256MHZ=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_128MHz: + tags: ppk_power_measure + extra_args: + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y + - idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_128MHZ=y + harness: pytest + harness_config: + fixture: spi_loopback + pytest_root: + - "${CUSTOM_ROOT_TEST_DIR}/test_measure_power_consumption.py::test_measure_and_data_dump_pwm_and_s2ram" + + benchmarks.multicore.idle_pwm_loopback.nrf54h20dk_cpuapp_cpurad.s2ram_fast.gd_freq_64MHz: + tags: ppk_power_measure + extra_args: + - idle_pwm_loopback_CONF_FILE=prj_s2ram.conf + - remote_CONF_FILE=prj_s2ram.conf + - idle_pwm_loopback_DTC_OVERLAY_FILE="boards/nrf54h20dk_nrf54h20_cpuapp_fast_p7_1.overlay" + - idle_pwm_loopback_CONFIG_CLOCK_CONTROL=y + - idle_pwm_loopback_CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_OPTION_64MHZ=y harness: pytest harness_config: fixture: spi_loopback