From 89fee61b4392d65469f0dba28b9b3a1ad1ecaf2c Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Fri, 4 Feb 2022 17:19:52 -0800 Subject: [PATCH] pm: Rename pm_power_state_set Aligning with the rest of PM API, replace pm_power_state_set with pm_state_set. Signed-off-by: Flavio Ceolin --- include/dt-bindings/pm/imx_spc.h | 2 +- include/pm/pm.h | 4 ++-- soc/arm/microchip_mec/mec1501/power.c | 2 +- soc/arm/nordic_nrf/nrf51/power.c | 2 +- soc/arm/nordic_nrf/nrf52/power.c | 2 +- soc/arm/nordic_nrf/nrf53/power.c | 2 +- soc/arm/nordic_nrf/nrf91/power.c | 2 +- soc/arm/nuvoton_npcx/common/power.c | 2 +- soc/arm/nxp_imx/rt/power_rt11xx.c | 2 +- soc/arm/nxp_imx/rt6xx/power.c | 2 +- soc/arm/nxp_kinetis/ke1xf/power.c | 2 +- soc/arm/silabs_exx32/common/soc_power.c | 2 +- soc/arm/st_stm32/stm32g0/power.c | 2 +- soc/arm/st_stm32/stm32l0/power.c | 2 +- soc/arm/st_stm32/stm32l4/power.c | 2 +- soc/arm/st_stm32/stm32l5/power.c | 2 +- soc/arm/st_stm32/stm32u5/power.c | 2 +- soc/arm/st_stm32/stm32wb/power.c | 2 +- soc/arm/st_stm32/stm32wl/power.c | 2 +- soc/arm/ti_simplelink/cc13x2_cc26x2/power.c | 2 +- soc/riscv/riscv-ite/common/power.c | 2 +- subsys/pm/pm.c | 10 +++++----- tests/subsys/pm/device_wakeup_api/src/main.c | 4 ++-- tests/subsys/pm/power_mgmt/src/main.c | 2 +- tests/subsys/pm/power_mgmt_multicore/src/main.c | 4 ++-- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/dt-bindings/pm/imx_spc.h b/include/dt-bindings/pm/imx_spc.h index 5eb045435be..68f45e9d18d 100644 --- a/include/dt-bindings/pm/imx_spc.h +++ b/include/dt-bindings/pm/imx_spc.h @@ -12,7 +12,7 @@ * power saving. See your SOC's datasheet for specifics of what peripherals * have their clocks gated at each set point. * - * Set point control is implemented at the soc level (see pm_power_state_set()) + * Set point control is implemented at the soc level (see pm_state_set()) */ #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PM_IMX_SPC_H_ diff --git a/include/pm/pm.h b/include/pm/pm.h index 0bcd65ed28b..e4dc56af744 100644 --- a/include/pm/pm.h +++ b/include/pm/pm.h @@ -182,7 +182,7 @@ bool pm_constraint_get(enum pm_state state); * @param state Power state. * @param substate_id Power substate id. */ -void pm_power_state_set(enum pm_state state, uint8_t substate_id); +void pm_state_set(enum pm_state state, uint8_t substate_id); /** * @brief Do any SoC or architecture specific post ops after sleep state exits. @@ -210,7 +210,7 @@ void pm_power_state_exit_post_ops(enum pm_state state, uint8_t substate_id); #define pm_constraint_release(pm_state) #define pm_constraint_get(pm_state) (true) -#define pm_power_state_set(state, substate_id) +#define pm_state_set(state, substate_id) #define pm_power_state_exit_post_ops(state, substate_id) #define pm_power_state_next_get(cpu) \ (&(struct pm_state_info){PM_STATE_ACTIVE, 0, 0}) diff --git a/soc/arm/microchip_mec/mec1501/power.c b/soc/arm/microchip_mec/mec1501/power.c index b4c30adbd6f..adf50e7bc5e 100644 --- a/soc/arm/microchip_mec/mec1501/power.c +++ b/soc/arm/microchip_mec/mec1501/power.c @@ -101,7 +101,7 @@ static void z_power_soc_sleep(void) * For deep sleep pm_system_suspend has executed all the driver * power management call backs. */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nordic_nrf/nrf51/power.c b/soc/arm/nordic_nrf/nrf51/power.c index 2023f1636b2..117d0c76894 100644 --- a/soc/arm/nordic_nrf/nrf51/power.c +++ b/soc/arm/nordic_nrf/nrf51/power.c @@ -11,7 +11,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nordic_nrf/nrf52/power.c b/soc/arm/nordic_nrf/nrf52/power.c index 2023f1636b2..117d0c76894 100644 --- a/soc/arm/nordic_nrf/nrf52/power.c +++ b/soc/arm/nordic_nrf/nrf52/power.c @@ -11,7 +11,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nordic_nrf/nrf53/power.c b/soc/arm/nordic_nrf/nrf53/power.c index bf41ef0d400..8165ec24813 100644 --- a/soc/arm/nordic_nrf/nrf53/power.c +++ b/soc/arm/nordic_nrf/nrf53/power.c @@ -13,7 +13,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nordic_nrf/nrf91/power.c b/soc/arm/nordic_nrf/nrf91/power.c index 973030cd8f1..a4ca79e262c 100644 --- a/soc/arm/nordic_nrf/nrf91/power.c +++ b/soc/arm/nordic_nrf/nrf91/power.c @@ -12,7 +12,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nuvoton_npcx/common/power.c b/soc/arm/nuvoton_npcx/common/power.c index 59b0ecbf5f0..7667042d114 100644 --- a/soc/arm/nuvoton_npcx/common/power.c +++ b/soc/arm/nuvoton_npcx/common/power.c @@ -144,7 +144,7 @@ static void npcx_power_enter_system_sleep(int slp_mode, int wk_mode) } /* Invoke when enter "Suspend/Low Power" mode. */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { if (state != PM_STATE_SUSPEND_TO_IDLE) { LOG_DBG("Unsupported power state %u", state); diff --git a/soc/arm/nxp_imx/rt/power_rt11xx.c b/soc/arm/nxp_imx/rt/power_rt11xx.c index a6a303d5d04..36f38ca1d25 100644 --- a/soc/arm/nxp_imx/rt/power_rt11xx.c +++ b/soc/arm/nxp_imx/rt/power_rt11xx.c @@ -283,7 +283,7 @@ void cpu_mode_transition(gpc_cpu_mode_t mode, bool enable_standby) * SOC specific low power mode implementation * Drop to lowest power state possible given system's request */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(state); diff --git a/soc/arm/nxp_imx/rt6xx/power.c b/soc/arm/nxp_imx/rt6xx/power.c index 7dc30cc76b3..84594a49103 100644 --- a/soc/arm/nxp_imx/rt6xx/power.c +++ b/soc/arm/nxp_imx/rt6xx/power.c @@ -22,7 +22,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); APP_DEEPSLEEP_RAM_APD, APP_DEEPSLEEP_RAM_PPD})) /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/nxp_kinetis/ke1xf/power.c b/soc/arm/nxp_kinetis/ke1xf/power.c index ffb7c2d2fde..a898a56d63e 100644 --- a/soc/arm/nxp_kinetis/ke1xf/power.c +++ b/soc/arm/nxp_kinetis/ke1xf/power.c @@ -25,7 +25,7 @@ __ramfunc static void wait_for_flash_prefetch_and_idle(void) } #endif /* CONFIG_XIP */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { switch (state) { case PM_STATE_RUNTIME_IDLE: diff --git a/soc/arm/silabs_exx32/common/soc_power.c b/soc/arm/silabs_exx32/common/soc_power.c index 19f2e277a54..cb69bdbbde6 100644 --- a/soc/arm/silabs_exx32/common/soc_power.c +++ b/soc/arm/silabs_exx32/common/soc_power.c @@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); */ /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/st_stm32/stm32g0/power.c b/soc/arm/st_stm32/stm32g0/power.c index 6034e5d4351..54ed37f3eea 100644 --- a/soc/arm/st_stm32/stm32g0/power.c +++ b/soc/arm/st_stm32/stm32g0/power.c @@ -20,7 +20,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { if (info->state != PM_STATE_SUSPEND_TO_IDLE) { LOG_DBG("Unsupported power state %u", state); diff --git a/soc/arm/st_stm32/stm32l0/power.c b/soc/arm/st_stm32/stm32l0/power.c index bc8df084bcf..bf44c310839 100644 --- a/soc/arm/st_stm32/stm32l0/power.c +++ b/soc/arm/st_stm32/stm32l0/power.c @@ -28,7 +28,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); #endif /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/arm/st_stm32/stm32l4/power.c b/soc/arm/st_stm32/stm32l4/power.c index 639e985bc3d..116b2980fca 100644 --- a/soc/arm/st_stm32/stm32l4/power.c +++ b/soc/arm/st_stm32/stm32l4/power.c @@ -28,7 +28,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); #endif /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { if (state != PM_STATE_SUSPEND_TO_IDLE) { LOG_DBG("Unsupported power state %u", state); diff --git a/soc/arm/st_stm32/stm32l5/power.c b/soc/arm/st_stm32/stm32l5/power.c index 4dfc7a43b79..d7ad55c37b2 100644 --- a/soc/arm/st_stm32/stm32l5/power.c +++ b/soc/arm/st_stm32/stm32l5/power.c @@ -28,7 +28,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); #endif /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { if (state != PM_STATE_SUSPEND_TO_IDLE) { LOG_DBG("Unsupported power state %u", state); diff --git a/soc/arm/st_stm32/stm32u5/power.c b/soc/arm/st_stm32/stm32u5/power.c index 6eca0987ee5..92eeb67480c 100644 --- a/soc/arm/st_stm32/stm32u5/power.c +++ b/soc/arm/st_stm32/stm32u5/power.c @@ -62,7 +62,7 @@ void set_mode_shutdown(uint8_t substate_id) } /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { switch (state) { case PM_STATE_SUSPEND_TO_IDLE: diff --git a/soc/arm/st_stm32/stm32wb/power.c b/soc/arm/st_stm32/stm32wb/power.c index c109a523e5e..054951d5aa5 100644 --- a/soc/arm/st_stm32/stm32wb/power.c +++ b/soc/arm/st_stm32/stm32wb/power.c @@ -84,7 +84,7 @@ static void shutdown_ble_stack(void) } /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { if (state == PM_STATE_SOFT_OFF) { diff --git a/soc/arm/st_stm32/stm32wl/power.c b/soc/arm/st_stm32/stm32wl/power.c index 0b16cb47d51..c0d19db6864 100644 --- a/soc/arm/st_stm32/stm32wl/power.c +++ b/soc/arm/st_stm32/stm32wl/power.c @@ -28,7 +28,7 @@ LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); #endif /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { switch (state) { case PM_STATE_SUSPEND_TO_IDLE: diff --git a/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c b/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c index a3b1cc7a230..65e6942c86a 100644 --- a/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c +++ b/soc/arm/ti_simplelink/cc13x2_cc26x2/power.c @@ -57,7 +57,7 @@ extern PowerCC26X2_ModuleState PowerCC26X2_module; */ /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/soc/riscv/riscv-ite/common/power.c b/soc/riscv/riscv-ite/common/power.c index 81be78b36ca..625e54fd7e1 100644 --- a/soc/riscv/riscv-ite/common/power.c +++ b/soc/riscv/riscv-ite/common/power.c @@ -17,7 +17,7 @@ static void ite_power_soc_deep_doze(void) } /* Invoke Low Power/System Off specific Tasks */ -__weak void pm_power_state_set(enum pm_state state, uint8_t substate_id) +__weak void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); diff --git a/subsys/pm/pm.c b/subsys/pm/pm.c index 1df9cc7227d..7cc65e49d68 100644 --- a/subsys/pm/pm.c +++ b/subsys/pm/pm.c @@ -121,13 +121,13 @@ static inline void pm_exit_pos_ops(struct pm_state_info *info) } } -static inline void pm_state_set(struct pm_state_info *info) +static inline void state_set(struct pm_state_info *info) { extern __weak void - pm_power_state_set(enum pm_state state, uint8_t substate_id); + pm_state_set(enum pm_state state, uint8_t substate_id); - if (pm_power_state_set != NULL) { - pm_power_state_set(info->state, info->substate_id); + if (pm_state_set != NULL) { + pm_state_set(info->state, info->substate_id); } } @@ -261,7 +261,7 @@ bool pm_system_suspend(int32_t ticks) /* Enter power state */ pm_state_notify(true); atomic_set_bit(z_post_ops_required, id); - pm_state_set(&z_cpus_pm_state[id]); + state_set(&z_cpus_pm_state[id]); pm_stats_stop(); /* Wake up sequence starts here */ diff --git a/tests/subsys/pm/device_wakeup_api/src/main.c b/tests/subsys/pm/device_wakeup_api/src/main.c index a2f201281da..ff68c0f236d 100644 --- a/tests/subsys/pm/device_wakeup_api/src/main.c +++ b/tests/subsys/pm/device_wakeup_api/src/main.c @@ -16,7 +16,7 @@ static const struct device *dev; static uint8_t sleep_count; -void pm_power_state_set(enum pm_state state, uint8_t substate_id) +void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); @@ -106,7 +106,7 @@ void test_wakeup_device_system_pm(void) * PM_STATE_SUSPEND_TO_RAM and then the PM subsystem will * suspend all devices. As gpio is wakeup capability is not * enabled, the device will be suspended. This will be - * confirmed in pm_power_state_set(). + * confirmed in pm_state_set(). * * As the native posix implementation does not properly sleeps, * the idle thread will call several times the PM subsystem. This diff --git a/tests/subsys/pm/power_mgmt/src/main.c b/tests/subsys/pm/power_mgmt/src/main.c index aaa2e65047a..271eab07e2b 100644 --- a/tests/subsys/pm/power_mgmt/src/main.c +++ b/tests/subsys/pm/power_mgmt/src/main.c @@ -141,7 +141,7 @@ DEVICE_DT_DEFINE(DT_INST(2, test_device_pm), device_init, -void pm_power_state_set(enum pm_state state, uint8_t substate_id) +void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); ARG_UNUSED(state); diff --git a/tests/subsys/pm/power_mgmt_multicore/src/main.c b/tests/subsys/pm/power_mgmt_multicore/src/main.c index 11bd82be974..66e8b3ea85d 100644 --- a/tests/subsys/pm/power_mgmt_multicore/src/main.c +++ b/tests/subsys/pm/power_mgmt_multicore/src/main.c @@ -30,7 +30,7 @@ BUILD_ASSERT(CONFIG_MP_NUM_CPUS == 2, "Invalid number of cpus"); static enum pm_state state_testing[2]; -void pm_power_state_set(enum pm_state state, uint8_t substate_id) +void pm_state_set(enum pm_state state, uint8_t substate_id) { ARG_UNUSED(substate_id); @@ -99,7 +99,7 @@ const struct pm_state_info *pm_policy_next_state(uint8_t cpu, int ticks) * - Iterate a number of times to stress it. * * @see pm_policy_next_state() - * @see pm_power_state_set() + * @see pm_state_set() * * @ingroup power_tests */