drivers: cc13xx_cc26xx: guard references to sleep states
Use of macros such as SYS_POWER_STATE_SLEEP_2 needs to be guarded by making sure CONFIG_SYS_POWER_SLEEP_STATES is defined. Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
parent
f8f044249c
commit
16fab6c4f8
3 changed files with 16 additions and 8 deletions
|
@ -206,7 +206,8 @@ static int i2c_cc13xx_cc26xx_transfer(struct device *dev, struct i2c_msg *msgs,
|
|||
|
||||
k_sem_take(&get_dev_data(dev)->lock, K_FOREVER);
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
#endif
|
||||
|
||||
|
@ -230,7 +231,8 @@ static int i2c_cc13xx_cc26xx_transfer(struct device *dev, struct i2c_msg *msgs,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -228,7 +228,8 @@ static int uart_cc13xx_cc26xx_fifo_read(struct device *dev, u8_t *buf,
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_tx_enable(struct device *dev)
|
||||
{
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
if (!get_dev_data(dev)->tx_constrained) {
|
||||
/*
|
||||
* When tx irq is enabled, it is implicit that we are expecting
|
||||
|
@ -252,7 +253,8 @@ static void uart_cc13xx_cc26xx_irq_tx_disable(struct device *dev)
|
|||
{
|
||||
UARTIntDisable(get_dev_conf(dev)->regs, UART_INT_TX);
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
if (get_dev_data(dev)->tx_constrained) {
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
get_dev_data(dev)->tx_constrained = false;
|
||||
|
@ -267,7 +269,8 @@ static int uart_cc13xx_cc26xx_irq_tx_ready(struct device *dev)
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_rx_enable(struct device *dev)
|
||||
{
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
/*
|
||||
* When rx is enabled, it is implicit that we are expecting
|
||||
* to receive from the uart, hence we can no longer go into
|
||||
|
@ -284,7 +287,8 @@ static void uart_cc13xx_cc26xx_irq_rx_enable(struct device *dev)
|
|||
|
||||
static void uart_cc13xx_cc26xx_irq_rx_disable(struct device *dev)
|
||||
{
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
if (get_dev_data(dev)->rx_constrained) {
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
get_dev_data(dev)->rx_constrained = false;
|
||||
|
|
|
@ -146,7 +146,8 @@ static int spi_cc13xx_cc26xx_transceive(struct device *dev,
|
|||
|
||||
spi_context_lock(ctx, false, NULL);
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
sys_pm_ctrl_disable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
#endif
|
||||
|
||||
|
@ -182,7 +183,8 @@ static int spi_cc13xx_cc26xx_transceive(struct device *dev,
|
|||
spi_context_cs_control(ctx, false);
|
||||
|
||||
done:
|
||||
#ifdef CONFIG_SYS_POWER_MANAGEMENT
|
||||
#if defined(CONFIG_SYS_POWER_MANAGEMENT) && \
|
||||
defined(CONFIG_SYS_POWER_SLEEP_STATES)
|
||||
sys_pm_ctrl_enable_state(SYS_POWER_STATE_SLEEP_2);
|
||||
#endif
|
||||
spi_context_release(ctx, err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue