Skip to content

Commit d7279cf

Browse files
JordanYatesbjarki-andreasen
authored andcommitted
[nrf fromtree] spi: nrfx_spim: fix incorrect clock control logic
To determine whether device runtime PM is enabled on a device, use `pm_device_runtime_is_enabled`. This results in the same behaviour when `CONFIG_PM_DEVICE_RUNTIME=n`, but properly controls the clocks on a per-instance basis when `CONFIG_PM_DEVICE_RUNTIME=y`. Signed-off-by: Jordan Yates <[email protected]> (cherry picked from commit 6e0d0f5)
1 parent f3cee4e commit d7279cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/spi/spi_nrfx_spim.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static inline void finalize_spi_transaction(const struct device *dev, bool deact
223223
nrfy_spim_disable(reg);
224224
}
225225

226-
if (!IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
226+
if (!pm_device_runtime_is_enabled(dev)) {
227227
release_clock(dev);
228228
}
229229

@@ -615,7 +615,7 @@ static int transceive(const struct device *dev,
615615

616616
error = configure(dev, spi_cfg);
617617

618-
if (error == 0 && !IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
618+
if (error == 0 && !pm_device_runtime_is_enabled(dev)) {
619619
error = request_clock(dev);
620620
}
621621

@@ -764,7 +764,7 @@ static int spim_resume(const struct device *dev)
764764
}
765765
#endif
766766

767-
return IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) ? request_clock(dev) : 0;
767+
return pm_device_runtime_is_enabled(dev) ? request_clock(dev) : 0;
768768
}
769769

770770
static void spim_suspend(const struct device *dev)
@@ -777,7 +777,7 @@ static void spim_suspend(const struct device *dev)
777777
dev_data->initialized = false;
778778
}
779779

780-
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
780+
if (pm_device_runtime_is_enabled(dev)) {
781781
release_clock(dev);
782782
}
783783

0 commit comments

Comments
 (0)