Skip to content

Commit b65f69a

Browse files
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 <[email protected]>
1 parent 30e2df6 commit b65f69a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/benchmarks/power_consumption/flash/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
status = "okay";
33
};
44

5+
&exmif {
6+
zephyr,pm-device-runtime-auto;
7+
};
8+
59
/ {
610
aliases {
711
led = &led0;

tests/benchmarks/power_consumption/flash/src/driver_test.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,25 @@ uint8_t buf[EXPECTED_SIZE];
2525

2626
static const struct device *flash_dev = DEVICE_DT_GET(FLASH_NODE);
2727

28+
static bool suspend_req;
29+
30+
bool self_suspend_req(void)
31+
{
32+
suspend_req = true;
33+
return true;
34+
}
35+
2836
void thread_definition(void)
2937
{
3038
int rc;
3139
uint8_t fill_value = 0x00;
3240

3341
while (1) {
42+
if (suspend_req) {
43+
suspend_req = false;
44+
k_thread_suspend(k_current_get());
45+
}
46+
3447
rc = flash_erase(flash_dev, TEST_AREA_OFFSET, FLASH_PAGE_SIZE);
3548
__ASSERT(rc == 0, "flash_erase %d\n", rc);
3649
rc = flash_fill(flash_dev, fill_value, TEST_AREA_OFFSET, EXPECTED_SIZE);

0 commit comments

Comments
 (0)