power: Remove power management conditionals from code
Remove conditionals (PM_DEEP_SLEEP_STATES and PM_SLEEP_STATES) from power management code. Now these features are always available when power management is enabled. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
579f7049c7
commit
d21cfd5f36
15 changed files with 18 additions and 68 deletions
|
@ -205,9 +205,7 @@ Power Management and UART
|
|||
|
||||
System and device power management are supported on this platform, and
|
||||
can be enabled via the standard Kconfig options in Zephyr, such as
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`,
|
||||
:option:`CONFIG_PM_SLEEP_STATES`, and
|
||||
:option:`CONFIG_PM_DEEP_SLEEP_STATES`.
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`.
|
||||
|
||||
When system power management is turned on (CONFIG_PM=y),
|
||||
sleep state 2 (standby mode) is allowed, and polling is used to retrieve input
|
||||
|
|
|
@ -231,9 +231,7 @@ Power Management and UART
|
|||
|
||||
System and device power management are supported on this platform, and
|
||||
can be enabled via the standard Kconfig options in Zephyr, such as
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`,
|
||||
:option:`CONFIG_PM_SLEEP_STATES`, and
|
||||
:option:`CONFIG_PM_DEEP_SLEEP_STATES`.
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`.
|
||||
|
||||
When system power management is turned on (CONFIG_PM=y),
|
||||
sleep state 2 (standby mode) is allowed, and polling is used to retrieve input
|
||||
|
|
|
@ -211,9 +211,7 @@ Power Management and UART
|
|||
|
||||
System and device power management are supported on this platform, and
|
||||
can be enabled via the standard Kconfig options in Zephyr, such as
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`,
|
||||
:option:`CONFIG_PM_SLEEP_STATES`, and
|
||||
:option:`CONFIG_PM_DEEP_SLEEP_STATES`.
|
||||
:option:`CONFIG_PM`, :option:`CONFIG_PM_DEVICE`.
|
||||
|
||||
When system power management is turned on (CONFIG_PM=y),
|
||||
sleep state 2 (standby mode) is allowed, and polling is used to retrieve input
|
||||
|
|
|
@ -499,14 +499,6 @@ the following configuration flags.
|
|||
|
||||
This flag enables the tickless idle power saving feature.
|
||||
|
||||
:option:`CONFIG_PM_SLEEP_STATES`
|
||||
|
||||
This flag enables support for the Sleep states.
|
||||
|
||||
:option:`CONFIG_PM_DEEP_SLEEP_STATES`
|
||||
|
||||
This flag enables support for the Deep Sleep states.
|
||||
|
||||
:option:`CONFIG_PM_DEVICE`
|
||||
|
||||
This flag is enabled if the SOC interface and the devices support device power
|
||||
|
|
|
@ -105,8 +105,7 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
|
|||
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev);
|
||||
uint32_t cnt;
|
||||
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
unsigned int key = irq_lock();
|
||||
|
||||
if (!data->constrained) {
|
||||
|
@ -153,8 +152,7 @@ static void entropy_cc13xx_cc26xx_isr(const void *arg)
|
|||
|
||||
/* When pool is full disable interrupt and stop reading numbers */
|
||||
if (cnt != sizeof(num)) {
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
if (data->constrained) {
|
||||
pm_ctrl_enable_state(
|
||||
PM_STATE_STANDBY);
|
||||
|
@ -334,11 +332,9 @@ static int entropy_cc13xx_cc26xx_init(const struct device *dev)
|
|||
|
||||
#if defined(CONFIG_PM)
|
||||
Power_setDependency(PowerCC26XX_PERIPH_TRNG);
|
||||
#if defined(CONFIG_PM_SLEEP_STATES)
|
||||
/* Stay out of standby until buffer is filled with entropy */
|
||||
pm_ctrl_disable_state(PM_STATE_STANDBY);
|
||||
data->constrained = true;
|
||||
#endif
|
||||
/* Register notification function */
|
||||
Power_registerNotify(&data->post_notify,
|
||||
PowerCC26XX_AWAKE_STANDBY,
|
||||
|
|
|
@ -207,8 +207,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
|
|||
|
||||
k_sem_take(&get_dev_data(dev)->lock, K_FOREVER);
|
||||
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
pm_ctrl_disable_state(PM_STATE_STANDBY);
|
||||
#endif
|
||||
|
||||
|
@ -232,8 +231,7 @@ static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
pm_ctrl_enable_state(PM_STATE_STANDBY);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -231,8 +231,7 @@ static int uart_cc13xx_cc26xx_fifo_read(const struct device *dev,
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_tx_enable(const struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
if (!get_dev_data(dev)->tx_constrained) {
|
||||
/*
|
||||
* When tx irq is enabled, it is implicit that we are expecting
|
||||
|
@ -256,8 +255,7 @@ static void uart_cc13xx_cc26xx_irq_tx_disable(const struct device *dev)
|
|||
{
|
||||
UARTIntDisable(get_dev_conf(dev)->regs, UART_INT_TX);
|
||||
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
if (get_dev_data(dev)->tx_constrained) {
|
||||
pm_ctrl_enable_state(PM_STATE_STANDBY);
|
||||
get_dev_data(dev)->tx_constrained = false;
|
||||
|
@ -272,8 +270,7 @@ static int uart_cc13xx_cc26xx_irq_tx_ready(const struct device *dev)
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
/*
|
||||
* When rx is enabled, it is implicit that we are expecting
|
||||
* to receive from the uart, hence we can no longer go into
|
||||
|
@ -290,8 +287,7 @@ static void uart_cc13xx_cc26xx_irq_rx_enable(const struct device *dev)
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_rx_disable(const struct device *dev)
|
||||
{
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
if (get_dev_data(dev)->rx_constrained) {
|
||||
pm_ctrl_enable_state(PM_STATE_STANDBY);
|
||||
get_dev_data(dev)->rx_constrained = false;
|
||||
|
|
|
@ -344,7 +344,7 @@ static int uart_npcx_init(const struct device *dev)
|
|||
config->uconf.irq_config_func(dev);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PM_DEEP_SLEEP_STATES)
|
||||
#if defined(CONFIG_PM)
|
||||
/*
|
||||
* Configure the UART wake-up event triggered from a falling edge
|
||||
* on CR_SIN pin. No need for callback function.
|
||||
|
|
|
@ -148,8 +148,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
|
|||
|
||||
spi_context_lock(ctx, false, NULL, config);
|
||||
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
pm_ctrl_disable_state(PM_STATE_STANDBY);
|
||||
#endif
|
||||
|
||||
|
@ -185,8 +184,7 @@ static int spi_cc13xx_cc26xx_transceive(const struct device *dev,
|
|||
spi_context_cs_control(ctx, false);
|
||||
|
||||
done:
|
||||
#if defined(CONFIG_PM) && \
|
||||
defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
pm_ctrl_enable_state(PM_STATE_STANDBY);
|
||||
#endif
|
||||
spi_context_release(ctx, err);
|
||||
|
|
|
@ -40,17 +40,13 @@ unsigned char pm_idle_exit_notify;
|
|||
/* LCOV_EXCL_START
|
||||
* These are almost certainly overidden and in any event do nothing
|
||||
*/
|
||||
#if defined(CONFIG_PM_SLEEP_STATES)
|
||||
void __attribute__((weak)) pm_system_resume(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PM_DEEP_SLEEP_STATES)
|
||||
void __attribute__((weak)) pm_system_resume_from_deep_sleep(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
@ -71,9 +67,6 @@ static enum pm_state pm_save_idle(int32_t ticks)
|
|||
{
|
||||
static enum pm_state idle_state = PM_STATE_ACTIVE;
|
||||
|
||||
#if (defined(CONFIG_PM_SLEEP_STATES) || \
|
||||
defined(CONFIG_PM_DEEP_SLEEP_STATES))
|
||||
|
||||
pm_idle_exit_notify = 1U;
|
||||
|
||||
/*
|
||||
|
@ -93,7 +86,7 @@ static enum pm_state pm_save_idle(int32_t ticks)
|
|||
if (idle_state == PM_STATE_ACTIVE) {
|
||||
pm_idle_exit_notify = 0U;
|
||||
}
|
||||
#endif
|
||||
|
||||
return idle_state;
|
||||
|
||||
}
|
||||
|
@ -102,7 +95,7 @@ static enum pm_state pm_save_idle(int32_t ticks)
|
|||
|
||||
void z_pm_save_idle_exit(int32_t ticks)
|
||||
{
|
||||
#if defined(CONFIG_PM_SLEEP_STATES)
|
||||
#ifdef CONFIG_PM
|
||||
/* Some CPU low power states require notification at the ISR
|
||||
* to allow any operations that needs to be done before kernel
|
||||
* switches task or processes nested interrupts. This can be
|
||||
|
@ -112,8 +105,7 @@ void z_pm_save_idle_exit(int32_t ticks)
|
|||
if (pm_idle_exit_notify) {
|
||||
pm_system_resume();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
z_clock_idle_exit();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,6 @@ void soc_lite_sleep_enable(void)
|
|||
* a minimum of 3ms to lock. During this time the main clock
|
||||
* will be ramping up from ~16 to 24 MHz.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_PM_DEEP_SLEEP_STATES)
|
||||
|
||||
void soc_deep_sleep_enable(void)
|
||||
{
|
||||
SCB->SCR = (1ul << 2); /* Cortex-M4 SLEEPDEEP */
|
||||
|
@ -227,5 +224,3 @@ void soc_deep_sleep_periph_restore(void)
|
|||
}
|
||||
|
||||
#endif /* DEEP_SLEEP_PERIPH_SAVE_RESTORE */
|
||||
|
||||
#endif /* CONFIG_PM_DEEP_SLEEP_STATES */
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
void soc_lite_sleep_enable(void);
|
||||
|
||||
#if defined(CONFIG_PM_DEEP_SLEEP_STATES)
|
||||
void soc_deep_sleep_enable(void);
|
||||
void soc_deep_sleep_disable(void);
|
||||
void soc_deep_sleep_periph_save(void);
|
||||
|
@ -19,7 +18,6 @@ void soc_deep_sleep_periph_restore(void);
|
|||
void soc_deep_sleep_wait_clk_idle(void);
|
||||
void soc_deep_sleep_non_wake_en(void);
|
||||
void soc_deep_sleep_non_wake_dis(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#include <soc.h>
|
||||
#include "device_power.h"
|
||||
|
||||
#if defined(CONFIG_PM_DEEP_SLEEP_STATES)
|
||||
|
||||
/*
|
||||
* Deep Sleep
|
||||
* Pros:
|
||||
|
@ -77,9 +75,6 @@ static void z_power_soc_deep_sleep(void)
|
|||
*/
|
||||
__set_PRIMASK(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP_STATES
|
||||
|
||||
/*
|
||||
* Light Sleep
|
||||
|
@ -100,7 +95,6 @@ static void z_power_soc_sleep(void)
|
|||
__NOP();
|
||||
__NOP();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Called from pm_system_suspend(int32_t ticks) in subsys/power.c
|
||||
|
|
|
@ -58,10 +58,8 @@ extern PowerCC26X2_ModuleState PowerCC26X2_module;
|
|||
/* Invoke Low Power/System Off specific Tasks */
|
||||
void pm_power_state_set(enum pm_state state)
|
||||
{
|
||||
#ifdef CONFIG_PM_SLEEP_STATES
|
||||
uint32_t modeVIMS;
|
||||
uint32_t constraints;
|
||||
#endif
|
||||
|
||||
LOG_DBG("SoC entering power state %d", state);
|
||||
|
||||
|
|
|
@ -135,8 +135,7 @@ static enum pm_state pm_policy_mgr(int32_t ticks)
|
|||
return z_power_state;
|
||||
}
|
||||
|
||||
deep_sleep = IS_ENABLED(CONFIG_PM_DEEP_SLEEP_STATES) ?
|
||||
pm_is_deep_sleep_state(z_power_state) : 0;
|
||||
deep_sleep = pm_is_deep_sleep_state(z_power_state);
|
||||
|
||||
post_ops_done = 0;
|
||||
pm_state_notify(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue