Commit 181e5445 authored by Etienne Carriere's avatar Etienne Carriere Committed by Johan Hedberg
Browse files

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 67f80e35 ("i2c: stm32: always call
runtime_get when registering targets").

Signed-off-by: default avatarEtienne Carriere <etienne.carriere@st.com>
parent 092347cd
Loading
Loading
Loading
Loading
+5 −3
Changes for drivers/i2c/i2c_ll_stm32_v2_rtio.c: 5 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -210,9 +210,10 @@ int i2c_stm32_target_register(const struct device *dev,
	}

#if defined(CONFIG_PM_DEVICE_RUNTIME)
	if (pm_device_wakeup_is_capable(dev)) {
	/* Mark device as active */
	(void)pm_device_runtime_get(dev);

	if (pm_device_wakeup_is_capable(dev)) {
		/* Enable wake-up from stop */
		LOG_DBG("i2c: enabling wakeup from stop");
		LL_I2C_EnableWakeUpFromStop(cfg->i2c);
@@ -303,11 +304,12 @@ int i2c_stm32_target_unregister(const struct device *dev,
		/* Disable wake-up from STOP */
		LOG_DBG("i2c: disabling wakeup from stop");
		LL_I2C_DisableWakeUpFromStop(i2c);
		/* Release the device */
		(void)pm_device_runtime_put(dev);
	}
#endif /* defined(CONFIG_PM_DEVICE_RUNTIME) */

	/* Release the device */
	(void)pm_device_runtime_put(dev);

	data->slave_attached = false;

	return 0;