drivers/smartbond: Fix PM device runtime support
Removed PM device runtime support from drivers in PD_SYS domain.
Update the rest device drivers to call pm_device_runtime_get/put()
functions when CONFIG_PM_DEVICE_RUNTIME is enabled.
Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
diff --git a/drivers/adc/adc_smartbond_gpadc.c b/drivers/adc/adc_smartbond_gpadc.c
index 367d321..76bdaed 100644
--- a/drivers/adc/adc_smartbond_gpadc.c
+++ b/drivers/adc/adc_smartbond_gpadc.c
@@ -41,10 +41,6 @@
uint8_t sequence_channel_count;
/* Index in buffer to store current value to */
uint8_t result_index;
-#if defined(CONFIG_PM_DEVICE)
- /* Flag to prevent sleep */
- ATOMIC_DEFINE(pm_policy_state_flag, 1);
-#endif
};
#define SMARTBOND_ADC_CHANNEL_COUNT 8
@@ -115,19 +111,12 @@
static inline void gpadc_smartbond_pm_policy_state_lock_get(const struct device *dev,
struct adc_smartbond_data *data)
{
-
#if defined(CONFIG_PM_DEVICE)
-#if defined(CONFIG_PM_DEVICE_RUNTIME)
pm_device_runtime_get(dev);
-#endif
-
- if (!atomic_test_and_set_bit(data->pm_policy_state_flag, 0)) {
- /*
- * Prevent the SoC from entering the normal sleep state.
- */
- pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
-
+ /*
+ * Prevent the SoC from entering the normal sleep state.
+ */
+ pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
#endif
}
@@ -135,17 +124,12 @@
struct adc_smartbond_data *data)
{
#if defined(CONFIG_PM_DEVICE)
-#if defined(CONFIG_PM_DEVICE_RUNTIME)
+ /*
+ * Allow the SoC to enter the normal sleep state once GPADC is done.
+ */
+ pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
pm_device_runtime_put(dev);
#endif
-
- if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0)) {
- /*
- * Allow the SoC to enter the normal sleep state once GPADC is done.
- */
- pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
-#endif
}
#define PER_CHANNEL_ADC_CONFIG_MASK (GPADC_GP_ADC_CTRL_REG_GP_ADC_SEL_Msk | \
@@ -259,8 +243,8 @@
data->channel_read_mask ^= 1 << current_channel;
if (data->channel_read_mask == 0) {
- adc_context_on_sampling_done(&data->ctx, dev);
gpadc_smartbond_pm_policy_state_lock_put(dev, data);
+ adc_context_on_sampling_done(&data->ctx, dev);
} else {
adc_context_start_sampling(&data->ctx);
}
@@ -275,8 +259,8 @@
int error;
struct adc_smartbond_data *data = dev->data;
- gpadc_smartbond_pm_policy_state_lock_get(dev, data);
adc_context_lock(&data->ctx, false, NULL);
+ gpadc_smartbond_pm_policy_state_lock_get(dev, data);
error = start_read(dev, sequence);
adc_context_release(&data->ctx, error);
@@ -292,8 +276,8 @@
struct adc_smartbond_data *data = dev->data;
int error;
- gpadc_smartbond_pm_policy_state_lock_get(dev, data);
adc_context_lock(&data->ctx, true, async);
+ gpadc_smartbond_pm_policy_state_lock_get(dev, data);
error = start_read(dev, sequence);
adc_context_release(&data->ctx, error);
diff --git a/drivers/adc/adc_smartbond_sdadc.c b/drivers/adc/adc_smartbond_sdadc.c
index 5576a65..0b95b1f 100644
--- a/drivers/adc/adc_smartbond_sdadc.c
+++ b/drivers/adc/adc_smartbond_sdadc.c
@@ -40,10 +40,6 @@
uint8_t sequence_channel_count;
/* Index in buffer to store current value to */
uint8_t result_index;
-#if defined(CONFIG_PM_DEVICE)
- /* Flag to prevent sleep */
- ATOMIC_DEFINE(pm_policy_state_flag, 1);
-#endif
};
#define SMARTBOND_SDADC_CHANNEL_COUNT 8
@@ -119,16 +115,11 @@
struct sdadc_smartbond_data *data)
{
#if defined(CONFIG_PM_DEVICE)
-#if defined(CONFIG_PM_DEVICE_RUNTIME)
pm_device_runtime_get(dev);
-#endif
-
- if (!atomic_test_and_set_bit(data->pm_policy_state_flag, 0)) {
- /*
- * Prevent the SoC from entering the normal sleep state.
- */
- pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
+ /*
+ * Prevent the SoC from entering the normal sleep state.
+ */
+ pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
#endif
}
@@ -136,17 +127,12 @@
struct sdadc_smartbond_data *data)
{
#if defined(CONFIG_PM_DEVICE)
-#if defined(CONFIG_PM_DEVICE_RUNTIME)
+ /*
+ * Allow the SoC to enter the normal sleep state once sdadc is done.
+ */
+ pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
pm_device_runtime_put(dev);
#endif
-
- if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0)) {
- /*
- * Allow the SoC to enter the normal sleep state once sdadc is done.
- */
- pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
-#endif
}
@@ -262,8 +248,8 @@
data->channel_read_mask ^= 1 << current_channel;
if (data->channel_read_mask == 0) {
- adc_context_on_sampling_done(&data->ctx, dev);
sdadc_smartbond_pm_policy_state_lock_put(dev, data);
+ adc_context_on_sampling_done(&data->ctx, dev);
} else {
adc_context_start_sampling(&data->ctx);
}
@@ -278,8 +264,8 @@
int error;
struct sdadc_smartbond_data *data = dev->data;
- sdadc_smartbond_pm_policy_state_lock_get(dev, data);
adc_context_lock(&data->ctx, false, NULL);
+ sdadc_smartbond_pm_policy_state_lock_get(dev, data);
error = start_read(dev, sequence);
adc_context_release(&data->ctx, error);
@@ -295,8 +281,8 @@
struct sdadc_smartbond_data *data = dev->data;
int error;
- sdadc_smartbond_pm_policy_state_lock_get(dev, data);
adc_context_lock(&data->ctx, true, async);
+ sdadc_smartbond_pm_policy_state_lock_get(dev, data);
error = start_read(dev, sequence);
adc_context_release(&data->ctx, error);
diff --git a/drivers/counter/counter_smartbond_timer.c b/drivers/counter/counter_smartbond_timer.c
index c15bdfa..8dc3bab 100644
--- a/drivers/counter/counter_smartbond_timer.c
+++ b/drivers/counter/counter_smartbond_timer.c
@@ -35,8 +35,7 @@
void *user_data;
uint32_t guard_period;
uint32_t freq;
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
- ATOMIC_DEFINE(pm_policy_state_flag, 1);
+#if defined(CONFIG_PM_DEVICE)
uint8_t pdc_idx;
#endif
};
@@ -59,19 +58,17 @@
LOG_INSTANCE_PTR_DECLARE(log);
};
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
-static void counter_smartbond_pm_policy_state_lock_get(struct counter_smartbond_data *data)
+#if defined(CONFIG_PM_DEVICE)
+static void counter_smartbond_pm_policy_state_lock_get(const struct device *dev)
{
- if (!atomic_test_and_set_bit(data->pm_policy_state_flag, 0)) {
- pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
+ pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
+ pm_device_runtime_get(dev);
}
-static void counter_smartbond_pm_policy_state_lock_put(struct counter_smartbond_data *data)
+static void counter_smartbond_pm_policy_state_lock_put(const struct device *dev)
{
- if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0)) {
- pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
+ pm_device_runtime_put(dev);
+ pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
/*
@@ -120,23 +117,18 @@
struct counter_smartbond_data *data = dev->data;
uint8_t trigger = counter_smartbond_pdc_trigger_get(dev);
- if (!atomic_test_and_set_bit(data->pm_policy_state_flag, 0)) {
+ data->pdc_idx = da1469x_pdc_add(trigger, MCU_PDC_MASTER_M33, PDC_XTAL_EN);
+ __ASSERT_NO_MSG(data->pdc_idx >= 0);
- data->pdc_idx = da1469x_pdc_add(trigger, MCU_PDC_MASTER_M33, PDC_XTAL_EN);
- __ASSERT_NO_MSG(data->pdc_idx >= 0);
-
- da1469x_pdc_set(data->pdc_idx);
- da1469x_pdc_ack(data->pdc_idx);
- }
+ da1469x_pdc_set(data->pdc_idx);
+ da1469x_pdc_ack(data->pdc_idx);
}
static void counter_smartbond_pdc_del(const struct device *dev)
{
struct counter_smartbond_data *data = dev->data;
- if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0)) {
- da1469x_pdc_del(data->pdc_idx);
- }
+ da1469x_pdc_del(data->pdc_idx);
}
#endif
@@ -145,24 +137,23 @@
const struct counter_smartbond_config *config = dev->config;
TIMER2_Type *timer = config->timer;
- /* Enable counter in free running mode */
- timer->TIMER2_CTRL_REG |= (TIMER2_TIMER2_CTRL_REG_TIM_CLK_EN_Msk |
- TIMER2_TIMER2_CTRL_REG_TIM_EN_Msk |
- TIMER2_TIMER2_CTRL_REG_TIM_FREE_RUN_MODE_EN_Msk);
-
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
if (!counter_smartbond_is_sleep_allowed(dev)) {
- struct counter_smartbond_data *data = dev->data;
/*
* Power mode constraints should be applied as long as the device
* is up and running.
*/
- counter_smartbond_pm_policy_state_lock_get(data);
+ counter_smartbond_pm_policy_state_lock_get(dev);
} else {
counter_smartbond_pdc_add(dev);
}
#endif
+ /* Enable counter in free running mode */
+ timer->TIMER2_CTRL_REG |= (TIMER2_TIMER2_CTRL_REG_TIM_CLK_EN_Msk |
+ TIMER2_TIMER2_CTRL_REG_TIM_EN_Msk |
+ TIMER2_TIMER2_CTRL_REG_TIM_FREE_RUN_MODE_EN_Msk);
+
return 0;
}
@@ -178,9 +169,9 @@
TIMER2_TIMER2_CTRL_REG_TIM_CLK_EN_Msk);
data->callback = NULL;
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
if (!counter_smartbond_is_sleep_allowed(dev)) {
- counter_smartbond_pm_policy_state_lock_put(data);
+ counter_smartbond_pm_policy_state_lock_put(dev);
} else {
counter_smartbond_pdc_del(dev);
}
@@ -421,7 +412,7 @@
return data->freq;
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static void counter_smartbond_resume(const struct device *dev)
{
const struct counter_smartbond_config *cfg = dev->config;
diff --git a/drivers/crypto/crypto_smartbond.c b/drivers/crypto/crypto_smartbond.c
index 7b8e337..9899f46 100644
--- a/drivers/crypto/crypto_smartbond.c
+++ b/drivers/crypto/crypto_smartbond.c
@@ -15,7 +15,6 @@
#include <da1469x_pd.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/pm/device.h>
-#include <zephyr/pm/device_runtime.h>
#include <zephyr/pm/policy.h>
#include <zephyr/logging/log.h>
@@ -936,7 +935,7 @@
.query_hw_caps = crypto_smartbond_query_hw_caps
};
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static int crypto_smartbond_pm_action(const struct device *dev,
enum pm_device_action action)
{
@@ -984,14 +983,7 @@
/* Controller should be initialized once a crypyographic session is requested */
crypto_smartbond_set_status(false);
-#ifdef CONFIG_PM_DEVICE_RUNTIME
- /* Make sure device state is marked as suspended */
- pm_device_init_suspended(dev);
-
- return pm_device_runtime_enable(dev);
-#else
return 0;
-#endif
}
/*
diff --git a/drivers/display/display_renesas_lcdc.c b/drivers/display/display_renesas_lcdc.c
index a5d3d41..6121f68 100644
--- a/drivers/display/display_renesas_lcdc.c
+++ b/drivers/display/display_renesas_lcdc.c
@@ -21,7 +21,6 @@
#include <da1469x_pd.h>
#include <zephyr/linker/devicetree_regions.h>
#include <zephyr/pm/device.h>
-#include <zephyr/pm/device_runtime.h>
#include <zephyr/pm/policy.h>
#include <zephyr/logging/log.h>
@@ -75,7 +74,7 @@
struct k_sem dma_sync_sem;
/* Granted DMA channel used for memory transfers */
int dma_channel;
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
ATOMIC_DEFINE(pm_policy_state_flag, 1);
#endif
};
@@ -101,7 +100,7 @@
static inline void lcdc_smartbond_pm_policy_state_lock_get(struct display_smartbond_data *data)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#ifdef CONFIG_PM_DEVICE
if (atomic_test_and_set_bit(data->pm_policy_state_flag, 0) == 0) {
/*
* Prevent the SoC from etering the normal sleep state as PDC does not support
@@ -114,7 +113,7 @@
static inline void lcdc_smartbond_pm_policy_state_lock_put(struct display_smartbond_data *data)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#ifdef CONFIG_PM_DEVICE
if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0) == 1) {
/* Allow the SoC to enter the nornmal sleep state once LCDC is inactive */
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
@@ -236,6 +235,7 @@
data->dma_cfg.dma_callback = display_smartbond_dma_cb;
data->dma_cfg.block_count = 1;
data->dma_cfg.head_block = &data->dma_block_cfg;
+ data->dma_cfg.error_callback_dis = 1;
/* Request an arbitrary DMA channel */
data->dma_channel = dma_request_channel(data->dma, NULL);
@@ -282,7 +282,7 @@
return display_smartbond_configure(dev);
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static void display_smartbond_dma_deconfig(const struct device *dev)
{
struct display_smartbond_data *data = dev->data;
@@ -337,19 +337,27 @@
IRQ_CONNECT(SMARTBOND_IRQN, SMARTBOND_IRQ_PRIO, smartbond_display_isr,
DEVICE_DT_INST_GET(0), 0);
-#ifdef CONFIG_PM_DEVICE_RUNTIME
- /* Make sure device state is marked as suspended */
- pm_device_init_suspended(dev);
-
- ret = pm_device_runtime_enable(dev);
-#else
- /* Resume if either PM is not used at all or if PM without runtime is used. */
+ /*
+ * Currently, there is no API to explicitly enable/disable the display controller.
+ * At the same time, the controller is set to continuous mode meaning that
+ * as long as a display panel is turned on, frame updates should happen all
+ * the time (otherwise contents on the display pane will be lost as the latter
+ * does not integrate an SDRAM memory to keep its frame).
+ * As such, resume/suspend operations are bound to blanking operations.
+ * That is, when the display is blanked on we can safely consider that display
+ * is no longer functional and thus, the controller can be suspended (allowing the
+ * SoC to enter the sleep state). Once the display is blanked off, then we consider
+ * that the controller should be resumed and sleep should be prevented at all
+ * (this is because the controller is powered by the same power domain used to
+ * power the application core). Side effect of the above is that the controller
+ * should be configured at initialization phase as display operations might
+ * be requested before the display is blanked off for the very first time.
+ */
ret = display_smartbond_resume(dev);
if (ret == 0) {
/* Display port should be enabled at this moment and so sleep is not allowed. */
lcdc_smartbond_pm_policy_state_lock_get(data);
}
-#endif
return ret;
}
@@ -581,7 +589,7 @@
return 0;
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static int display_smartbond_pm_action(const struct device *dev, enum pm_device_action action)
{
int ret = 0;
diff --git a/drivers/dma/dma_smartbond.c b/drivers/dma/dma_smartbond.c
index 493ac22..9294197 100644
--- a/drivers/dma/dma_smartbond.c
+++ b/drivers/dma/dma_smartbond.c
@@ -15,7 +15,6 @@
#include <da1469x_otp.h>
#include <zephyr/drivers/dma/dma_smartbond.h>
#include <zephyr/pm/device.h>
-#include <zephyr/pm/device_runtime.h>
#include <zephyr/pm/policy.h>
#include <zephyr/logging/log.h>
@@ -158,7 +157,7 @@
ATOMIC_DEFINE(channels_atomic, DMA_CHANNELS_COUNT);
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
ATOMIC_DEFINE(pm_policy_state_flag, 1);
#endif
@@ -185,7 +184,7 @@
static inline void dma_smartbond_pm_policy_state_lock_get(const struct device *dev)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
struct dma_smartbond_data *data = dev->data;
if (atomic_test_and_set_bit(data->pm_policy_state_flag, 0) == 0) {
@@ -196,7 +195,7 @@
static inline void dma_smartbond_pm_policy_state_lock_put(const struct device *dev)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
struct dma_smartbond_data *data = dev->data;
/* Make PM lock put has a matched PM lock get invocation */
@@ -965,7 +964,7 @@
}
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static bool dma_smartbond_is_sleep_allowed(const struct device *dev)
{
struct dma_smartbond_data *data = dev->data;
diff --git a/drivers/entropy/entropy_smartbond.c b/drivers/entropy/entropy_smartbond.c
index fecb7b0..24c5731 100644
--- a/drivers/entropy/entropy_smartbond.c
+++ b/drivers/entropy/entropy_smartbond.c
@@ -11,7 +11,6 @@
#include <zephyr/sys/barrier.h>
#include <DA1469xAB.h>
#include <zephyr/pm/device.h>
-#include <zephyr/pm/device_runtime.h>
#include <zephyr/pm/policy.h>
#include <zephyr/logging/log.h>
@@ -48,7 +47,7 @@
RNG_POOL_DEFINE(isr, CONFIG_ENTROPY_SMARTBOND_ISR_POOL_SIZE);
RNG_POOL_DEFINE(thr, CONFIG_ENTROPY_SMARTBOND_THR_POOL_SIZE);
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
ATOMIC_DEFINE(pm_policy_state_flag, 1);
#endif
};
@@ -64,7 +63,7 @@
static inline void entropy_smartbond_pm_policy_state_lock_get(const struct device *dev)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
struct entropy_smartbond_dev_data *data = dev->data;
if (atomic_test_and_set_bit(data->pm_policy_state_flag, 0) == 0) {
@@ -79,7 +78,7 @@
static inline void entropy_smartbond_pm_policy_state_lock_put(const struct device *dev)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
struct entropy_smartbond_dev_data *data = dev->data;
if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0) == 1) {
@@ -379,7 +378,7 @@
return cnt;
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static int entropy_smartbond_pm_action(const struct device *dev, enum pm_device_action action)
{
int ret = 0;
@@ -433,13 +432,6 @@
trng_enable(true);
-#ifdef CONFIG_PM_DEVICE_RUNTIME
- /* Make sure device state is marked as suspended */
- pm_device_init_suspended(dev);
-
- return pm_device_runtime_enable(dev);
-#endif
-
return 0;
}
diff --git a/drivers/i2c/i2c_smartbond.c b/drivers/i2c/i2c_smartbond.c
index 2c3e614..22c8094 100644
--- a/drivers/i2c/i2c_smartbond.c
+++ b/drivers/i2c/i2c_smartbond.c
@@ -35,14 +35,14 @@
uint32_t transmit_cnt, receive_cnt;
i2c_callback_t cb;
void *userdata;
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
ATOMIC_DEFINE(pm_policy_state_flag, 1);
#endif
};
-static inline void i2c_smartbond_pm_policy_state_lock_get(struct i2c_smartbond_data *data)
+#if defined(CONFIG_PM_DEVICE)
+static inline void i2c_smartbond_pm_prevent_system_sleep(struct i2c_smartbond_data *data)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
if (atomic_test_and_set_bit(data->pm_policy_state_flag, 0) == 0) {
/*
* Prevent the SoC from etering the normal sleep state as PDC does not support
@@ -50,18 +50,38 @@
*/
pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
-#endif
}
-static inline void i2c_smartbond_pm_policy_state_lock_put(struct i2c_smartbond_data *data)
+static inline void i2c_smartbond_pm_allow_system_sleep(struct i2c_smartbond_data *data)
{
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0) == 1) {
/*
* Allow the SoC to enter the nornmal sleep state once I2C transactions are done.
*/
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
+}
+#endif
+
+static inline void i2c_smartbond_pm_policy_state_lock_get(const struct device *dev)
+{
+#ifdef CONFIG_PM_DEVICE
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ pm_device_runtime_get(dev);
+#else
+ i2c_smartbond_pm_prevent_system_sleep(dev->data);
+#endif
+#endif
+}
+
+static inline void i2c_smartbond_pm_policy_state_lock_put(const struct device *dev)
+{
+#ifdef CONFIG_PM_DEVICE
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ pm_device_runtime_put(dev);
+#else
+ i2c_smartbond_pm_allow_system_sleep(dev->data);
+#endif
#endif
}
@@ -86,7 +106,7 @@
}
}
-static int i2c_smartbond_configure(const struct device *dev, uint32_t dev_config)
+static int i2c_smartbond_apply_configure(const struct device *dev, uint32_t dev_config)
{
const struct i2c_smartbond_cfg *config = dev->config;
struct i2c_smartbond_data *data = dev->data;
@@ -141,6 +161,17 @@
return 0;
}
+static int i2c_smartbond_configure(const struct device *dev, uint32_t dev_config)
+{
+ int ret = 0;
+
+ pm_device_runtime_get(dev);
+ ret = i2c_smartbond_apply_configure(dev, dev_config);
+ pm_device_runtime_put(dev);
+
+ return ret;
+}
+
static int i2c_smartbond_get_config(const struct device *dev, uint32_t *dev_config)
{
const struct i2c_smartbond_cfg *config = dev->config;
@@ -148,8 +179,10 @@
uint32_t reg;
k_spinlock_key_t key = k_spin_lock(&data->lock);
+ pm_device_runtime_get(dev);
/* Read the value of the control register */
reg = config->regs->I2C_CON_REG;
+ pm_device_runtime_put(dev);
k_spin_unlock(&data->lock, key);
@@ -288,9 +321,6 @@
}
}
- while (!(config->regs->I2C_STATUS_REG & I2C_I2C_STATUS_REG_TFE_Msk)) {
- };
-
if (config->regs->I2C_TX_ABRT_SOURCE_REG & 0x1FFFF) {
ret = -EIO;
}
@@ -336,16 +366,13 @@
struct i2c_smartbond_data *data = dev->data;
int ret = 0;
- while (!i2c_smartbond_is_idle(dev)) {
- };
+ i2c_smartbond_pm_policy_state_lock_get(dev);
ret = i2c_smartbond_prep_transfer(dev, msgs, num_msgs, addr);
if (ret != 0) {
- return ret;
+ goto finish;
}
- i2c_smartbond_pm_policy_state_lock_get(data);
-
for (; data->num_msgs > 0; data->num_msgs--, data->msgs++) {
data->transmit_cnt = 0;
data->receive_cnt = 0;
@@ -375,7 +402,9 @@
}
finish:
- i2c_smartbond_pm_policy_state_lock_put(data);
+ while (!i2c_smartbond_is_idle(dev)) {
+ };
+ i2c_smartbond_pm_policy_state_lock_put(dev);
return ret;
}
@@ -425,13 +454,14 @@
data->cb = cb;
data->userdata = userdata;
+ i2c_smartbond_pm_policy_state_lock_get(dev);
+
ret = i2c_smartbond_prep_transfer(dev, msgs, num_msgs, addr);
if (ret != 0) {
+ i2c_smartbond_pm_policy_state_lock_put(dev);
return ret;
}
- i2c_smartbond_pm_policy_state_lock_get(data);
-
i2c_smartbond_enable_msg_interrupts(config, data);
LOG_INF("async transfer started");
@@ -496,7 +526,7 @@
data->cb = NULL;
LOG_INF("async transfer finished");
cb(dev, 0, data->userdata);
- i2c_smartbond_pm_policy_state_lock_put(data);
+ i2c_smartbond_pm_policy_state_lock_put(dev);
}
}
@@ -567,11 +597,11 @@
return err;
}
- return i2c_smartbond_configure(dev,
+ return i2c_smartbond_apply_configure(dev,
I2C_MODE_CONTROLLER | i2c_map_dt_bitrate(config->bitrate));
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static int i2c_smartbond_suspend(const struct device *dev)
{
int ret;
@@ -597,6 +627,9 @@
switch (action) {
case PM_DEVICE_ACTION_RESUME:
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ i2c_smartbond_pm_prevent_system_sleep(dev->data);
+#endif
/*
* Although the GPIO driver should already be initialized, make sure PD_COM
* is up and running before accessing the I2C block.
@@ -611,6 +644,9 @@
* be released, as well.
*/
da1469x_pd_release(MCU_PD_DOMAIN_COM);
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ i2c_smartbond_pm_allow_system_sleep(dev->data);
+#endif
break;
default:
return -ENOTSUP;
diff --git a/drivers/memc/memc_smartbond_nor_psram.c b/drivers/memc/memc_smartbond_nor_psram.c
index 37584f9..2d0ae79 100644
--- a/drivers/memc/memc_smartbond_nor_psram.c
+++ b/drivers/memc/memc_smartbond_nor_psram.c
@@ -173,23 +173,10 @@
/* Should be called prior to switching to auto mode and when the quad bus is selected! */
da1469x_qspi_set_bus_mode(QSPIC2_ID, QSPI_BUS_MODE_QUAD);
-#if CONFIG_PM_DEVICE_RUNTIME
- /*
- * Turn off the controller to minimize power consumption. Application is responsible to
- * configure/de-configure the controller before interacting with the memory.
- */
- memc_set_status(false, 0);
-
- /* Make sure device is marked as suspended */
- pm_device_init_suspended(dev);
-
- return pm_device_runtime_enable(dev);
-#else
da1469x_pd_acquire(MCU_PD_DOMAIN_SYS);
/* From this point onwards memory device should be seen as memory mapped device. */
memc_automode_configure();
-#endif
return 0;
}
diff --git a/drivers/mipi_dbi/mipi_dbi_smartbond.c b/drivers/mipi_dbi/mipi_dbi_smartbond.c
index da0e5e1..f6f6ce1 100644
--- a/drivers/mipi_dbi/mipi_dbi_smartbond.c
+++ b/drivers/mipi_dbi/mipi_dbi_smartbond.c
@@ -13,7 +13,6 @@
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/pm/device.h>
-#include <zephyr/pm/device_runtime.h>
#include <zephyr/pm/policy.h>
#include <DA1469xAB.h>
#include <zephyr/drivers/clock_control.h>
@@ -293,7 +292,7 @@
size_t len)
{
struct mipi_dbi_smartbond_data *data = dev->data;
- int ret;
+ int ret = 0;
lcdc_smartbond_mipi_dbi_cfg mipi_dbi_cfg;
k_sem_take(&data->device_sem, K_FOREVER);
@@ -307,8 +306,7 @@
lcdc_smartbond_mipi_dbi_translation(dbi_config, &mipi_dbi_cfg, PIXEL_FORMAT_RGB_565);
ret = da1469x_lcdc_mipi_dbi_interface_configure(&mipi_dbi_cfg);
if (ret < 0) {
- k_sem_give(&data->device_sem);
- return ret;
+ goto finish;
}
/* Command and accompanied data should be transmitted via the DBIB interface */
@@ -319,11 +317,12 @@
da1469x_lcdc_send_cmd_data(false, data_buf, len);
}
+finish:
mipi_dbi_smartbond_pm_policy_state_lock_put();
k_sem_give(&data->device_sem);
- return 0;
+ return ret;
}
static int mipi_dbi_smartbond_write_display(const struct device *dev,
@@ -466,7 +465,7 @@
return mipi_dbi_smartbond_configure(dev);
}
-#if defined(CONFIG_PM_DEVICE) || defined(CONFIG_PM_DEVICE_RUNTIME)
+#if defined(CONFIG_PM_DEVICE)
static int mipi_dbi_smartbond_suspend(const struct device *dev)
{
const struct mipi_dbi_smartbond_config *config = dev->config;
@@ -532,15 +531,7 @@
IRQ_CONNECT(SMARTBOND_IRQN, SMARTBOND_IRQ_PRIO, smartbond_mipi_dbi_isr,
DEVICE_DT_INST_GET(0), 0);
-#ifdef CONFIG_PM_DEVICE_RUNTIME
- /* Make sure device state is marked as suspended */
- pm_device_init_suspended(dev);
-
- ret = pm_device_runtime_enable(dev);
-#else
- /* Resme if either PM is not used at all or if PM without runtime is used. */
ret = mipi_dbi_smartbond_resume(dev);
-#endif
return ret;
}
diff --git a/drivers/serial/uart_smartbond.c b/drivers/serial/uart_smartbond.c
index 8656ae8..6aaec50 100644
--- a/drivers/serial/uart_smartbond.c
+++ b/drivers/serial/uart_smartbond.c
@@ -12,6 +12,7 @@
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/pm/device.h>
#include <zephyr/pm/policy.h>
+#include <zephyr/pm/device_runtime.h>
#include <zephyr/kernel.h>
#include <zephyr/spinlock.h>
#include <zephyr/sys/byteorder.h>
@@ -111,7 +112,7 @@
uint8_t tx_enabled;
#if CONFIG_PM_DEVICE
struct gpio_callback dtr_wake_cb;
- const struct uart_smartbond_cfg *config;
+ const struct device *dev;
struct gpio_callback rx_wake_cb;
int rx_wake_timeout;
struct k_work_delayable rx_timeout_work;
@@ -121,30 +122,48 @@
#endif
};
-#if defined(CONFIG_PM_DEVICE)
-
-static void uart_smartbond_pm_policy_state_lock_get(struct uart_smartbond_data *data, int flag)
+#ifdef CONFIG_PM_DEVICE
+static inline void uart_smartbond_pm_prevent_system_sleep(struct uart_smartbond_data *data,
+ int flag)
{
if (atomic_test_and_set_bit(data->pm_policy_state_flag, flag) == 0) {
pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
}
-static void uart_smartbond_pm_policy_state_lock_put(struct uart_smartbond_data *data, int flag)
+static inline void uart_smartbond_pm_allow_system_sleep(struct uart_smartbond_data *data,
+ int flag)
{
if (atomic_test_and_clear_bit(data->pm_policy_state_flag, flag) == 1) {
pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
}
}
+static void uart_smartbond_pm_policy_state_lock_get(const struct device *dev, int flag)
+{
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ pm_device_runtime_get(dev);
+#else
+ uart_smartbond_pm_prevent_system_sleep(dev->data, flag);
+#endif
+}
+
+static void uart_smartbond_pm_policy_state_lock_put(const struct device *dev, int flag)
+{
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ pm_device_runtime_put(dev);
+#else
+ uart_smartbond_pm_allow_system_sleep(dev->data, flag);
+#endif
+}
+
static void uart_smartbond_rx_refresh_timeout(struct k_work *work)
{
struct uart_smartbond_data *data = CONTAINER_OF(work, struct uart_smartbond_data,
rx_timeout_work.work);
- uart_smartbond_pm_policy_state_lock_put(data, UART_SMARTBOND_PM_POLICY_STATE_RX_FLAG);
+ uart_smartbond_pm_policy_state_lock_put(data->dev, UART_SMARTBOND_PM_POLICY_STATE_RX_FLAG);
}
-
#endif
static int uart_smartbond_poll_in(const struct device *dev, unsigned char *p_char)
@@ -153,13 +172,17 @@
struct uart_smartbond_data *data = dev->data;
k_spinlock_key_t key = k_spin_lock(&data->lock);
+ pm_device_runtime_get(dev);
+
if ((config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_RFNE_Msk) == 0) {
+ pm_device_runtime_put(dev);
k_spin_unlock(&data->lock, key);
return -1;
}
*p_char = config->regs->UART2_RBR_THR_DLL_REG;
+ pm_device_runtime_put(dev);
k_spin_unlock(&data->lock, key);
return 0;
@@ -171,12 +194,16 @@
struct uart_smartbond_data *data = dev->data;
k_spinlock_key_t key = k_spin_lock(&data->lock);
+ pm_device_runtime_get(dev);
+
while (!(config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFNF_Msk)) {
/* Wait until FIFO has free space */
}
config->regs->UART2_RBR_THR_DLL_REG = out_char;
+ pm_device_runtime_put(dev);
+
k_spin_unlock(&data->lock, key);
}
@@ -287,7 +314,9 @@
data->runtime_cfg.lcr_reg_val = lcr_reg_val;
data->runtime_cfg.mcr_reg_val = cfg->flow_ctrl ? UART2_UART2_MCR_REG_UART_AFCE_Msk : 0;
+ pm_device_runtime_get(dev);
apply_runtime_config(dev);
+ pm_device_runtime_put(dev);
data->current_config = *cfg;
@@ -324,8 +353,7 @@
GPIO_INT_DISABLE);
/* Refresh console expired time */
if (data->rx_wake_timeout) {
-
- uart_smartbond_pm_policy_state_lock_get(data,
+ uart_smartbond_pm_policy_state_lock_get(data->dev,
UART_SMARTBOND_PM_POLICY_STATE_RX_FLAG);
k_work_reschedule(&data->rx_timeout_work, K_MSEC(data->rx_wake_timeout));
}
@@ -339,10 +367,10 @@
int pin = find_lsb_set(pins) - 1;
if (gpio_pin_get(gpio, pin) == 1) {
- uart_smartbond_pm_policy_state_lock_put(data,
+ uart_smartbond_pm_policy_state_lock_put(data->dev,
UART_SMARTBOND_PM_POLICY_STATE_DTR_FLAG);
} else {
- uart_smartbond_pm_policy_state_lock_get(data,
+ uart_smartbond_pm_policy_state_lock_get(data->dev,
UART_SMARTBOND_PM_POLICY_STATE_DTR_FLAG);
}
}
@@ -354,13 +382,21 @@
struct uart_smartbond_data *data = dev->data;
int ret = 0;
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ /* Make sure device state is marked as suspended */
+ pm_device_init_suspended(dev);
+
+ ret = pm_device_runtime_enable(dev);
+#else
da1469x_pd_acquire(MCU_PD_DOMAIN_COM);
+#endif
#ifdef CONFIG_PM_DEVICE
int rx_wake_timeout;
const struct uart_smartbond_cfg *config = dev->config;
const struct device *uart_console_dev =
DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
+ data->dev = dev;
/* All uarts can have wake time specified in device tree to keep
* device awake after receiving data
*/
@@ -384,7 +420,7 @@
GPIO_INT_TRIG_BOTH);
/* Check if DTR is already active (low), if so lock power state */
if (gpio_pin_get(config->dtr_gpio.port, config->dtr_gpio.pin) == 0) {
- uart_smartbond_pm_policy_state_lock_get(data,
+ uart_smartbond_pm_policy_state_lock_get(dev,
UART_SMARTBOND_PM_POLICY_STATE_DTR_FLAG);
}
}
@@ -403,9 +439,11 @@
#endif
ret = uart_smartbond_configure(dev, &data->current_config);
+#ifndef CONFIG_PM_DEVICE_RUNTIME
if (ret < 0) {
da1469x_pd_release(MCU_PD_DOMAIN_COM);
}
+#endif
return ret;
}
@@ -414,31 +452,39 @@
static inline void irq_tx_enable(const struct device *dev)
{
const struct uart_smartbond_cfg *config = dev->config;
+ struct uart_smartbond_data *data = dev->data;
config->regs->UART2_IER_DLH_REG |= UART2_UART2_IER_DLH_REG_PTIME_DLH7_Msk |
UART2_UART2_IER_DLH_REG_ETBEI_DLH1_Msk;
+ data->runtime_cfg.ier_reg_val = config->regs->UART2_IER_DLH_REG;
}
static inline void irq_tx_disable(const struct device *dev)
{
const struct uart_smartbond_cfg *config = dev->config;
+ struct uart_smartbond_data *data = dev->data;
config->regs->UART2_IER_DLH_REG &= ~(UART2_UART2_IER_DLH_REG_PTIME_DLH7_Msk |
- UART2_UART2_IER_DLH_REG_ETBEI_DLH1_Msk);
+ UART2_UART2_IER_DLH_REG_ETBEI_DLH1_Msk);
+ data->runtime_cfg.ier_reg_val = config->regs->UART2_IER_DLH_REG;
}
static inline void irq_rx_enable(const struct device *dev)
{
const struct uart_smartbond_cfg *config = dev->config;
+ struct uart_smartbond_data *data = dev->data;
config->regs->UART2_IER_DLH_REG |= UART2_UART2_IER_DLH_REG_ERBFI_DLH0_Msk;
+ data->runtime_cfg.ier_reg_val = config->regs->UART2_IER_DLH_REG;
}
static inline void irq_rx_disable(const struct device *dev)
{
const struct uart_smartbond_cfg *config = dev->config;
+ struct uart_smartbond_data *data = dev->data;
config->regs->UART2_IER_DLH_REG &= ~UART2_UART2_IER_DLH_REG_ERBFI_DLH0_Msk;
+ data->runtime_cfg.ier_reg_val = config->regs->UART2_IER_DLH_REG;
}
static int uart_smartbond_fifo_fill(const struct device *dev,
@@ -450,6 +496,7 @@
int num_tx = 0;
k_spinlock_key_t key = k_spin_lock(&data->lock);
+ pm_device_runtime_get(dev);
while ((len - num_tx > 0) &&
(config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFNF_Msk)) {
config->regs->UART2_RBR_THR_DLL_REG = tx_data[num_tx++];
@@ -459,6 +506,7 @@
irq_tx_enable(dev);
}
+ pm_device_runtime_put(dev);
k_spin_unlock(&data->lock, key);
return num_tx;
@@ -472,6 +520,7 @@
int num_rx = 0;
k_spinlock_key_t key = k_spin_lock(&data->lock);
+ pm_device_runtime_get(dev);
while ((size - num_rx > 0) &&
(config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_RFNE_Msk)) {
rx_data[num_rx++] = config->regs->UART2_RBR_THR_DLL_REG;
@@ -486,6 +535,8 @@
k_work_reschedule(&data->rx_timeout_work, K_MSEC(data->rx_wake_timeout));
}
#endif
+
+ pm_device_runtime_put(dev);
k_spin_unlock(&data->lock, key);
return num_rx;
@@ -517,7 +568,9 @@
{
const struct uart_smartbond_cfg *config = dev->config;
- return (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFNF_Msk) != 0;
+ bool ret = (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFNF_Msk) != 0;
+
+ return ret;
}
static void uart_smartbond_irq_rx_enable(const struct device *dev)
@@ -546,14 +599,18 @@
{
const struct uart_smartbond_cfg *config = dev->config;
- return (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFE_Msk) != 0;
+ bool ret = (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_TFE_Msk) != 0;
+
+ return ret;
}
static int uart_smartbond_irq_rx_ready(const struct device *dev)
{
const struct uart_smartbond_cfg *config = dev->config;
- return (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_RFNE_Msk) != 0;
+ bool ret = (config->regs->UART2_USR_REG & UART2_UART2_USR_REG_UART_RFNE_Msk) != 0;
+
+ return ret;
}
static void uart_smartbond_irq_err_enable(const struct device *dev)
@@ -659,6 +716,10 @@
switch (action) {
case PM_DEVICE_ACTION_RESUME:
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ uart_smartbond_pm_prevent_system_sleep(dev->data,
+ UART_SMARTBOND_PM_POLICY_STATE_RX_FLAG);
+#endif
da1469x_pd_acquire(MCU_PD_DOMAIN_COM);
apply_runtime_config(dev);
break;
@@ -670,6 +731,10 @@
GPIO_INT_MODE_EDGE |
GPIO_INT_TRIG_LOW);
}
+#ifdef CONFIG_PM_DEVICE_RUNTIME
+ uart_smartbond_pm_allow_system_sleep(dev->data,
+ UART_SMARTBOND_PM_POLICY_STATE_RX_FLAG);
+#endif
break;
default:
ret = -ENOTSUP;
diff --git a/drivers/spi/spi_smartbond.c b/drivers/spi/spi_smartbond.c
index f067da9..2bae051 100644
--- a/drivers/spi/spi_smartbond.c
+++ b/drivers/spi/spi_smartbond.c
@@ -71,7 +71,6 @@
uint8_t dfs;
#if defined(CONFIG_PM_DEVICE)
- ATOMIC_DEFINE(pm_policy_state_flag, 1);
uint32_t spi_ctrl_reg;
#endif
@@ -225,28 +224,26 @@
return 0;
}
-static inline void spi_smartbond_pm_policy_state_lock_get(struct spi_smartbond_data *data)
+static inline void spi_smartbond_pm_policy_state_lock_get(const struct device *dev)
{
#if defined(CONFIG_PM_DEVICE)
- if (atomic_test_and_set_bit(data->pm_policy_state_flag, 0) == 0) {
- /*
- * Prevent the SoC from entering the normal sleep state as PDC does not support
- * waking up the application core following SPI events.
- */
- pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
+ /*
+ * Prevent the SoC from entering the normal sleep state as PDC does not support
+ * waking up the application core following SPI events.
+ */
+ pm_policy_state_lock_get(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
+ pm_device_runtime_get(dev);
#endif
}
-static inline void spi_smartbond_pm_policy_state_lock_put(struct spi_smartbond_data *data)
+static inline void spi_smartbond_pm_policy_state_lock_put(const struct device *dev)
{
#if defined(CONFIG_PM_DEVICE)
- if (atomic_test_and_clear_bit(data->pm_policy_state_flag, 0) == 1) {
- /*
- * Allow the SoC to enter the normal sleep state once SPI transactions are done.
- */
- pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
- }
+ pm_device_runtime_put(dev);
+ /*
+ * Allow the SoC to enter the normal sleep state once SPI transactions are done.
+ */
+ pm_policy_state_lock_put(PM_STATE_STANDBY, PM_ALL_SUBSTATES);
#endif
}
@@ -604,10 +601,10 @@
int rc;
spi_context_lock(ctx, true, cb, userdata, spi_cfg);
+ spi_smartbond_pm_policy_state_lock_get(dev);
rc = spi_smartbond_configure(cfg, data, spi_cfg);
if (rc == 0) {
- spi_smartbond_pm_policy_state_lock_get(data);
spi_context_buffers_setup(ctx, tx_bufs, rx_bufs, data->dfs);
spi_context_cs_control(ctx, true);
@@ -1054,9 +1051,8 @@
struct spi_context *ctx = &data->ctx;
int rc;
- spi_smartbond_pm_policy_state_lock_get(data);
-
spi_context_lock(&data->ctx, false, NULL, NULL, spi_cfg);
+ spi_smartbond_pm_policy_state_lock_get(dev);
rc = spi_smartbond_configure(cfg, data, spi_cfg);
if (rc == 0) {
@@ -1099,7 +1095,7 @@
}
spi_context_release(&data->ctx, rc);
- spi_smartbond_pm_policy_state_lock_put(data);
+ spi_smartbond_pm_policy_state_lock_put(dev);
return rc;
}
diff --git a/soc/renesas/smartbond/da1469x/Kconfig.defconfig b/soc/renesas/smartbond/da1469x/Kconfig.defconfig
index 4d9c062..9e8df72 100644
--- a/soc/renesas/smartbond/da1469x/Kconfig.defconfig
+++ b/soc/renesas/smartbond/da1469x/Kconfig.defconfig
@@ -34,4 +34,7 @@
config FLASH_LOAD_OFFSET
default 0x2400 if !USE_DT_CODE_PARTITION
+config PM_DEVICE_RUNTIME_EXCLUSIVE
+ default n if PM_DEVICE_RUNTIME
+
endif # SOC_SERIES_DA1469X