From b65f69a952107a821e23c0a222a1d2545db8b437 Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 14 Jan 2025 13:14:08 +0100 Subject: [PATCH] tests: benchmarks: power_consumption: flash: fix exmif pm The exmif instance used for the external flash operation needs pm device runtime to be enabled for it, without it the bus can not suspend, and s2ram can not be entered. Additionally, the test needs to omplement suspend_req to ensure the flash device and bus are suspended before the thread is suspended. Signed-off-by: Bjarki Arge Andreasen --- .../flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay | 4 ++++ .../power_consumption/flash/src/driver_test.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/benchmarks/power_consumption/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay b/tests/benchmarks/power_consumption/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay index 43a16d5f1c9c..84431e9784b0 100644 --- a/tests/benchmarks/power_consumption/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay +++ b/tests/benchmarks/power_consumption/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay @@ -2,6 +2,10 @@ status = "okay"; }; +&exmif { + zephyr,pm-device-runtime-auto; +}; + / { aliases { led = &led0; diff --git a/tests/benchmarks/power_consumption/flash/src/driver_test.c b/tests/benchmarks/power_consumption/flash/src/driver_test.c index 8f449ea1b281..5679425e4d4c 100644 --- a/tests/benchmarks/power_consumption/flash/src/driver_test.c +++ b/tests/benchmarks/power_consumption/flash/src/driver_test.c @@ -25,12 +25,25 @@ uint8_t buf[EXPECTED_SIZE]; static const struct device *flash_dev = DEVICE_DT_GET(FLASH_NODE); +static bool suspend_req; + +bool self_suspend_req(void) +{ + suspend_req = true; + return true; +} + void thread_definition(void) { int rc; uint8_t fill_value = 0x00; while (1) { + if (suspend_req) { + suspend_req = false; + k_thread_suspend(k_current_get()); + } + rc = flash_erase(flash_dev, TEST_AREA_OFFSET, FLASH_PAGE_SIZE); __ASSERT(rc == 0, "flash_erase %d\n", rc); rc = flash_fill(flash_dev, fill_value, TEST_AREA_OFFSET, EXPECTED_SIZE);