Skip to content

Commit 3f87c5a

Browse files
Flavio Ceolinnashif
authored andcommitted
power: Rename constraint API
Replace pm_ctrl_* with pm_constraint. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
1 parent ea4bc72 commit 3f87c5a

File tree

13 files changed

+29
-29
lines changed

13 files changed

+29
-29
lines changed

boards/arm/cc1352r1_launchxl/doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ disable sleep state 2 while polling:
216216

217217
.. code-block:: c
218218
219-
pm_ctrl_disable_state(PM_STATE_STANDBY);
219+
pm_constraint_set(PM_STATE_STANDBY);
220220
<code that calls uart_poll_in() and expects input at any point in time>
221-
pm_ctrl_enable_state(PM_STATE_STANDBY);
221+
pm_constraint_release(PM_STATE_STANDBY);
222222
223223
224224
References

boards/arm/cc1352r_sensortag/doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ disable sleep state 2 while polling:
242242

243243
.. code-block:: c
244244
245-
pm_ctrl_disable_state(PM_STATE_STANDBY);
245+
pm_constraint_set(PM_STATE_STANDBY);
246246
<code that calls uart_poll_in() and expects input at any point in time>
247-
pm_ctrl_enable_state(PM_STATE_STANDBY);
247+
pm_constraint_release(PM_STATE_STANDBY);
248248
249249
250250
References

boards/arm/cc26x2r1_launchxl/doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ disable sleep state 2 while polling:
222222

223223
.. code-block:: c
224224
225-
pm_ctrl_disable_state(PM_STATE_STANDBY);
225+
pm_constraint_set(PM_STATE_STANDBY);
226226
<code that calls uart_poll_in() and expects input at any point in time>
227-
pm_ctrl_enable_state(PM_STATE_STANDBY);
227+
pm_constraint_release(PM_STATE_STANDBY);
228228
229229
230230
References

drivers/entropy/entropy_cc13xx_cc26xx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
109109
unsigned int key = irq_lock();
110110

111111
if (!data->constrained) {
112-
pm_ctrl_disable_state(PM_STATE_STANDBY);
112+
pm_constraint_set(PM_STATE_STANDBY);
113113
data->constrained = true;
114114
}
115115
irq_unlock(key);
@@ -154,7 +154,7 @@ static void entropy_cc13xx_cc26xx_isr(const void *arg)
154154
if (cnt != sizeof(num)) {
155155
#ifdef CONFIG_PM
156156
if (data->constrained) {
157-
pm_ctrl_enable_state(
157+
pm_constraint_release(
158158
PM_STATE_STANDBY);
159159
data->constrained = false;
160160
}
@@ -333,7 +333,7 @@ static int entropy_cc13xx_cc26xx_init(const struct device *dev)
333333
#if defined(CONFIG_PM)
334334
Power_setDependency(PowerCC26XX_PERIPH_TRNG);
335335
/* Stay out of standby until buffer is filled with entropy */
336-
pm_ctrl_disable_state(PM_STATE_STANDBY);
336+
pm_constraint_set(PM_STATE_STANDBY);
337337
data->constrained = true;
338338
/* Register notification function */
339339
Power_registerNotify(&data->post_notify,

drivers/i2c/i2c_cc13xx_cc26xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
208208
k_sem_take(&get_dev_data(dev)->lock, K_FOREVER);
209209

210210
#ifdef CONFIG_PM
211-
pm_ctrl_disable_state(PM_STATE_STANDBY);
211+
pm_constraint_set(PM_STATE_STANDBY);
212212
#endif
213213

214214
for (int i = 0; i < num_msgs; i++) {
@@ -232,7 +232,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
232232
}
233233

234234
#ifdef CONFIG_PM
235-
pm_ctrl_enable_state(PM_STATE_STANDBY);
235+
pm_constraint_release(PM_STATE_STANDBY);
236236
#endif
237237

238238
k_sem_give(&get_dev_data(dev)->lock);

drivers/serial/uart_cc13xx_cc26xx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static void uart_cc13xx_cc26xx_irq_tx_enable(const struct device *dev)
243243
* standby mode instead, since it is the power state that
244244
* would interfere with a transfer.
245245
*/
246-
pm_ctrl_disable_state(PM_STATE_STANDBY);
246+
pm_constraint_set(PM_STATE_STANDBY);
247247
get_dev_data(dev)->tx_constrained = true;
248248
}
249249
#endif
@@ -257,7 +257,7 @@ static void uart_cc13xx_cc26xx_irq_tx_disable(const struct device *dev)
257257

258258
#ifdef CONFIG_PM
259259
if (get_dev_data(dev)->tx_constrained) {
260-
pm_ctrl_enable_state(PM_STATE_STANDBY);
260+
pm_constraint_release(PM_STATE_STANDBY);
261261
get_dev_data(dev)->tx_constrained = false;
262262
}
263263
#endif
@@ -277,7 +277,7 @@ static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev)
277277
* standby.
278278
*/
279279
if (!get_dev_data(dev)->rx_constrained) {
280-
pm_ctrl_disable_state(PM_STATE_STANDBY);
280+
pm_constraint_set(PM_STATE_STANDBY);
281281
get_dev_data(dev)->rx_constrained = true;
282282
}
283283
#endif
@@ -289,7 +289,7 @@ static void uart_cc13xx_cc26xx_irq_rx_disable(const struct device *dev)
289289
{
290290
#ifdef CONFIG_PM
291291
if (get_dev_data(dev)->rx_constrained) {
292-
pm_ctrl_enable_state(PM_STATE_STANDBY);
292+
pm_constraint_release(PM_STATE_STANDBY);
293293
get_dev_data(dev)->rx_constrained = false;
294294
}
295295
#endif

drivers/spi/spi_cc13xx_cc26xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
149149
spi_context_lock(ctx, false, NULL, config);
150150

151151
#ifdef CONFIG_PM
152-
pm_ctrl_disable_state(PM_STATE_STANDBY);
152+
pm_constraint_set(PM_STATE_STANDBY);
153153
#endif
154154

155155
err = spi_cc13xx_cc26xx_configure(dev, config);
@@ -185,7 +185,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
185185

186186
done:
187187
#ifdef CONFIG_PM
188-
pm_ctrl_enable_state(PM_STATE_STANDBY);
188+
pm_constraint_release(PM_STATE_STANDBY);
189189
#endif
190190
spi_context_release(ctx, err);
191191
return err;

include/power/power.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,25 @@ void pm_dump_debug_info(void);
166166
*
167167
* @details Disabled state cannot be selected by the Zephyr power
168168
* management policies. Application defined policy should
169-
* use the @ref pm_ctrl_is_state_enabled function to
169+
* use the @ref pm_constraint_get function to
170170
* check if given state is enabled and could be used.
171171
*
172172
* @param [in] state Power state to be disabled.
173173
*/
174-
void pm_ctrl_disable_state(enum pm_state state);
174+
void pm_constraint_set(enum pm_state state);
175175

176176
/**
177177
* @brief Enable particular power state
178178
*
179179
* @details Enabled state can be selected by the Zephyr power
180180
* management policies. Application defined policy should
181-
* use the @ref pm_ctrl_is_state_enabled function to
181+
* use the @ref pm_constraint_get function to
182182
* check if given state is enabled and could be used.
183183
* By default all power states are enabled.
184184
*
185185
* @param [in] state Power state to be enabled.
186186
*/
187-
void pm_ctrl_enable_state(enum pm_state state);
187+
void pm_constraint_release(enum pm_state state);
188188

189189
/**
190190
* @brief Check if particular power state is enabled
@@ -193,7 +193,7 @@ void pm_ctrl_enable_state(enum pm_state state);
193193
*
194194
* @param [in] state Power state.
195195
*/
196-
bool pm_ctrl_is_state_enabled(enum pm_state state);
196+
bool pm_constraint_get(enum pm_state state);
197197

198198
#endif /* CONFIG_PM_STATE_LOCK */
199199

samples/boards/nrf/system_off/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static int disable_ds_1(const struct device *dev)
2727
{
2828
ARG_UNUSED(dev);
2929

30-
pm_ctrl_disable_state(PM_STATE_SOFT_OFF);
30+
pm_constraint_set(PM_STATE_SOFT_OFF);
3131
return 0;
3232
}
3333

subsys/power/pm_ctrl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(power);
1919

2020
static atomic_t power_state_disable_count[PM_STATES_LEN];
2121

22-
void pm_ctrl_disable_state(enum pm_state state)
22+
void pm_constraint_set(enum pm_state state)
2323
{
2424
atomic_val_t v;
2525

@@ -31,7 +31,7 @@ void pm_ctrl_disable_state(enum pm_state state)
3131
(void)(v);
3232
}
3333

34-
void pm_ctrl_enable_state(enum pm_state state)
34+
void pm_constraint_release(enum pm_state state)
3535
{
3636
atomic_val_t v;
3737

@@ -43,7 +43,7 @@ void pm_ctrl_enable_state(enum pm_state state)
4343
(void)(v);
4444
}
4545

46-
bool pm_ctrl_is_state_enabled(enum pm_state state)
46+
bool pm_constraint_get(enum pm_state state)
4747
{
4848
__ASSERT(state < PM_STATES_LEN, "Invalid power state!");
4949

0 commit comments

Comments
 (0)