|
15 | 15 |
|
16 | 16 | #include <zephyr/ztest.h> |
17 | 17 | #include <zephyr/drivers/spi.h> |
| 18 | +#include <zephyr/pm/device_runtime.h> |
18 | 19 | #include <zephyr/kernel.h> |
19 | 20 | #include <stdio.h> |
20 | 21 | #include <stdarg.h> |
@@ -104,9 +105,12 @@ static void spi_loopback_transceive(struct spi_dt_spec *const spec, |
104 | 105 | const struct spi_buf_set *const tx, |
105 | 106 | const struct spi_buf_set *const rx) |
106 | 107 | { |
107 | | - int ret = spi_transceive_dt(spec, tx, rx); |
| 108 | + int ret; |
108 | 109 |
|
109 | | - zassert_false(ret, "SPI transceive failed, code %d", ret); |
| 110 | + zassert_ok(pm_device_runtime_get(spec->bus)); |
| 111 | + ret = spi_transceive_dt(spec, tx, rx); |
| 112 | + zassert_ok(ret, "SPI transceive failed, code %d", ret); |
| 113 | + zassert_ok(pm_device_runtime_put(spec->bus)); |
110 | 114 | } |
111 | 115 |
|
112 | 116 | /* The most spi buf currently used by any test case is 4, change if needed */ |
@@ -443,9 +447,10 @@ ZTEST(spi_extra_api_features, test_spi_lock_release) |
443 | 447 |
|
444 | 448 | lock_spec->config.operation |= SPI_LOCK_ON; |
445 | 449 |
|
| 450 | + zassert_ok(pm_device_runtime_get(lock_spec->bus)); |
446 | 451 | spi_loopback_transceive(lock_spec, &tx, &rx); |
447 | | - |
448 | 452 | zassert_false(spi_release_dt(lock_spec), "SPI release failed"); |
| 453 | + zassert_ok(pm_device_runtime_put(lock_spec->bus)); |
449 | 454 |
|
450 | 455 | spi_loopback_transceive(try_spec, &tx, &rx); |
451 | 456 |
|
|
0 commit comments