Skip to content

Commit d1a9ef6

Browse files
etienne-lmsdkalowsk
authored andcommitted
drivers: i2c: stm32: sync stm32_v2 RTIO on PM runtime state
Always call pm_device_runtime_get() when registering a target even if the device is not wakeup capable to prevent I2C target not being function if the device goes into a SoC Stop mode. This change ports into the STM32 v2 RTIO driver the change made in the non-RTIO driver through commit 67f80e3 ("i2c: stm32: always call runtime_get when registering targets"). Signed-off-by: Etienne Carriere <[email protected]> (cherry picked from commit 181e544)
1 parent bf9345a commit d1a9ef6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/i2c/i2c_ll_stm32_v2_rtio.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,10 @@ int i2c_stm32_target_register(const struct device *dev,
210210
}
211211

212212
#if defined(CONFIG_PM_DEVICE_RUNTIME)
213+
/* Mark device as active */
214+
(void)pm_device_runtime_get(dev);
215+
213216
if (pm_device_wakeup_is_capable(dev)) {
214-
/* Mark device as active */
215-
(void)pm_device_runtime_get(dev);
216217
/* Enable wake-up from stop */
217218
LOG_DBG("i2c: enabling wakeup from stop");
218219
LL_I2C_EnableWakeUpFromStop(cfg->i2c);
@@ -303,11 +304,12 @@ int i2c_stm32_target_unregister(const struct device *dev,
303304
/* Disable wake-up from STOP */
304305
LOG_DBG("i2c: disabling wakeup from stop");
305306
LL_I2C_DisableWakeUpFromStop(i2c);
306-
/* Release the device */
307-
(void)pm_device_runtime_put(dev);
308307
}
309308
#endif /* defined(CONFIG_PM_DEVICE_RUNTIME) */
310309

310+
/* Release the device */
311+
(void)pm_device_runtime_put(dev);
312+
311313
data->slave_attached = false;
312314

313315
return 0;

0 commit comments

Comments
 (0)