drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP

This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
This commit is contained in:
Juan Solano 2017-02-06 12:19:24 +01:00 committed by Anas Nashif
commit ee623d21de
14 changed files with 6 additions and 83 deletions

View file

@ -32,10 +32,8 @@ struct adc_info {
struct k_sem sem;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_ss_adc_context_t adc_ctx;
#endif
#endif
};
static void adc_config_irq(void);
@ -255,7 +253,6 @@ static uint32_t adc_qmsi_ss_get_power_state(struct device *dev)
return context->device_power_state;
}
#if CONFIG_SYS_POWER_DEEP_SLEEP
static int adc_qmsi_ss_suspend_device(struct device *dev)
{
struct adc_info *context = dev->driver_data;
@ -277,19 +274,16 @@ static int adc_qmsi_ss_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
static int adc_qmsi_ss_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return adc_qmsi_ss_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return adc_qmsi_ss_resume_device_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = adc_qmsi_ss_get_power_state(dev);
}

View file

@ -156,6 +156,8 @@ static const struct counter_driver_api aon_timer_qmsi_api = {
};
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
static qm_aonc_context_t aonc_ctx;
static void aonpt_qmsi_set_power_state(struct device *dev, uint32_t power_state)
{
struct aon_data *context = dev->driver_data;
@ -170,9 +172,6 @@ static uint32_t aonpt_qmsi_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static qm_aonc_context_t aonc_ctx;
static int aonpt_suspend_device(struct device *dev)
{
qm_aonpt_save_context(QM_AONC_0, &aonc_ctx);
@ -190,7 +189,6 @@ static int aonpt_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -200,13 +198,11 @@ static int aonpt_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return aonpt_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return aonpt_resume_device_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = aonpt_qmsi_get_power_state(dev);
return 0;

View file

@ -32,9 +32,7 @@ struct dma_qmsi_driver_data {
void *callback_data[QM_DMA_CHANNEL_NUM];
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_dma_context_t saved_ctx;
#endif
#endif
void (*dma_user_callback[QM_DMA_CHANNEL_NUM])(struct device *dev,
uint32_t channel_id,
@ -327,7 +325,6 @@ static const struct dma_qmsi_config_info dma_qmsi_config_data = {
static struct dma_qmsi_driver_data dma_qmsi_dev_data;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int dma_suspend_device(struct device *dev)
{
const struct dma_qmsi_config_info *info = dev->config->config_info;
@ -349,19 +346,16 @@ static int dma_resume_device(struct device *dev)
return 0;
}
#endif
static int dma_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return dma_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return dma_resume_device(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = dma_qmsi_get_power_state(dev);
}

View file

@ -21,10 +21,8 @@ struct soc_flash_data {
#endif
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_flash_context_t saved_ctx[QM_FLASH_NUM];
#endif
#endif
};
#define FLASH_HAS_CONTEXT_DATA \
@ -272,7 +270,6 @@ static uint32_t flash_qmsi_get_power_state(struct device *dev)
return ctx->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int flash_qmsi_suspend_device(struct device *dev)
{
struct soc_flash_data *ctx = dev->driver_data;
@ -298,19 +295,16 @@ static int flash_qmsi_resume_device(struct device *dev)
return 0;
}
#endif
static int flash_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return flash_qmsi_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return flash_qmsi_resume_device(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = flash_qmsi_get_power_state(dev);
}

View file

@ -72,7 +72,6 @@ static const struct gpio_qmsi_config gpio_0_config = {
static struct gpio_qmsi_runtime gpio_0_runtime;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static qm_gpio_context_t gpio_ctx;
static int gpio_suspend_device(struct device *dev)
@ -96,7 +95,6 @@ static int gpio_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -106,13 +104,11 @@ static int gpio_qmsi_device_ctrl(struct device *port, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return gpio_suspend_device(port);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return gpio_resume_device_from_suspend(port);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = gpio_qmsi_get_power_state(port);
return 0;
@ -145,14 +141,12 @@ static int gpio_aon_device_ctrl(struct device *port, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
uint32_t device_pm_state = *(uint32_t *)context;
if (device_pm_state == DEVICE_PM_SUSPEND_STATE ||
device_pm_state == DEVICE_PM_ACTIVE_STATE) {
gpio_qmsi_set_power_state(port, device_pm_state);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = gpio_qmsi_get_power_state(port);
}

View file

@ -28,10 +28,8 @@ struct ss_gpio_qmsi_runtime {
#endif /* CONFIG_GPIO_QMSI_API_REENTRANCY */
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_ss_gpio_context_t gpio_ctx;
#endif
#endif
};
#ifdef CONFIG_GPIO_QMSI_API_REENTRANCY
@ -56,7 +54,6 @@ static uint32_t ss_gpio_qmsi_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int ss_gpio_suspend_device(struct device *dev)
{
const struct ss_gpio_qmsi_config *gpio_config =
@ -82,7 +79,6 @@ static int ss_gpio_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
/*
* Implements the driver control management functionality
@ -92,13 +88,11 @@ static int ss_gpio_qmsi_device_ctrl(struct device *port, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return ss_gpio_suspend_device(port);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return ss_gpio_resume_device_from_suspend(port);
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = ss_gpio_qmsi_get_power_state(port);
}

View file

@ -37,10 +37,8 @@ struct i2c_qmsi_driver_data {
struct k_sem sem;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_i2c_context_t i2c_ctx;
#endif
#endif
};
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
@ -58,7 +56,6 @@ static uint32_t i2c_qmsi_get_power_state(struct device *dev)
return drv_data->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int i2c_suspend_device(struct device *dev)
{
if (device_busy_check(dev)) {
@ -85,7 +82,6 @@ static int i2c_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -95,13 +91,11 @@ static int i2c_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return i2c_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return i2c_resume_device_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = i2c_qmsi_get_power_state(dev);
return 0;

View file

@ -32,10 +32,8 @@ struct i2c_qmsi_ss_driver_data {
struct k_sem sem;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_ss_i2c_context_t i2c_ctx;
#endif
#endif
};
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
@ -54,7 +52,6 @@ static uint32_t ss_i2c_qmsi_get_power_state(struct device *dev)
return drv_data->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int ss_i2c_suspend_device(struct device *dev)
{
if (device_busy_check(dev)) {
@ -82,7 +79,6 @@ static int ss_i2c_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
/*
* Implements the driver control management functionality
@ -92,13 +88,11 @@ static int ss_i2c_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return ss_i2c_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return ss_i2c_resume_device_from_suspend(dev);
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = ss_i2c_qmsi_get_power_state(dev);
}

View file

@ -420,6 +420,8 @@ static int pwm_qmsi_init(struct device *dev)
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
static qm_pwm_context_t pwm_ctx;
static uint32_t pwm_qmsi_get_power_state(struct device *dev)
{
struct pwm_data *context = dev->driver_data;
@ -427,9 +429,6 @@ static uint32_t pwm_qmsi_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static qm_pwm_context_t pwm_ctx;
static int pwm_qmsi_suspend(struct device *dev)
{
qm_pwm_save_context(QM_PWM_0, &pwm_ctx);
@ -447,7 +446,6 @@ static int pwm_qmsi_resume_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -457,13 +455,11 @@ static int pwm_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return pwm_qmsi_suspend(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return pwm_qmsi_resume_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = pwm_qmsi_get_power_state(dev);
return 0;

View file

@ -159,8 +159,6 @@ static int rtc_qmsi_init(struct device *dev)
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static qm_rtc_context_t rtc_ctx;
static int rtc_suspend_device(struct device *dev)
@ -180,7 +178,6 @@ static int rtc_resume_device(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -190,13 +187,11 @@ static int rtc_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return rtc_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return rtc_resume_device(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = rtc_qmsi_get_power_state(dev);
return 0;

View file

@ -56,9 +56,7 @@ struct uart_qmsi_drv_data {
uart_irq_callback_t user_cb;
uint8_t iir_cache;
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_uart_context_t ctx;
#endif
};
static void uart_qmsi_set_power_state(struct device *dev, uint32_t power_state)
@ -75,7 +73,6 @@ static uint32_t uart_qmsi_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int uart_suspend_device(struct device *dev)
{
const struct uart_qmsi_config_info *config = dev->config->config_info;
@ -105,7 +102,6 @@ static int uart_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -115,13 +111,11 @@ static int uart_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return uart_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return uart_resume_device_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = uart_qmsi_get_power_state(dev);
return 0;

View file

@ -41,10 +41,8 @@ struct spi_qmsi_runtime {
struct k_sem sem;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_spi_context_t spi_ctx;
#endif
#endif
};
static inline qm_spi_bmode_t config_to_bmode(uint8_t mode)
@ -293,7 +291,6 @@ static int spi_qmsi_init(struct device *dev)
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int spi_master_suspend_device(struct device *dev)
{
if (device_busy_check(dev)) {
@ -321,7 +318,6 @@ static int spi_master_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -331,13 +327,11 @@ static int spi_master_qmsi_device_ctrl(struct device *port,
uint32_t ctrl_command, void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return spi_master_suspend_device(port);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return spi_master_resume_device_from_suspend(port);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = spi_master_get_power_state(port);
return 0;

View file

@ -41,10 +41,8 @@ struct ss_spi_qmsi_runtime {
bool loopback;
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
uint32_t device_power_state;
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
qm_ss_spi_context_t spi_ctx;
#endif
#endif
};
static inline qm_ss_spi_bmode_t config_to_bmode(uint8_t mode)
@ -265,7 +263,6 @@ static uint32_t ss_spi_master_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static int ss_spi_master_suspend_device(struct device *dev)
{
if (device_busy_check(dev)) {
@ -293,7 +290,6 @@ static int ss_spi_master_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
/*
* Implements the driver control management functionality
@ -303,13 +299,11 @@ static int ss_spi_master_qmsi_device_ctrl(struct device *port,
uint32_t ctrl_command, void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return ss_spi_master_suspend_device(port);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return ss_spi_master_resume_device_from_suspend(port);
}
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = ss_spi_master_get_power_state(port);
}

View file

@ -108,6 +108,8 @@ static const struct wdt_driver_api api = {
};
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
static qm_wdt_context_t wdt_ctx;
static void wdt_qmsi_set_power_state(struct device *dev, uint32_t power_state)
{
struct wdt_data *context = dev->driver_data;
@ -122,9 +124,6 @@ static uint32_t wdt_qmsi_get_power_state(struct device *dev)
return context->device_power_state;
}
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
static qm_wdt_context_t wdt_ctx;
static int wdt_suspend_device(struct device *dev)
{
qm_wdt_save_context(QM_WDT_0, &wdt_ctx);
@ -142,7 +141,6 @@ static int wdt_resume_device_from_suspend(struct device *dev)
return 0;
}
#endif
/*
* Implements the driver control management functionality
@ -152,13 +150,11 @@ static int wdt_qmsi_device_ctrl(struct device *dev, uint32_t ctrl_command,
void *context)
{
if (ctrl_command == DEVICE_PM_SET_POWER_STATE) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
if (*((uint32_t *)context) == DEVICE_PM_SUSPEND_STATE) {
return wdt_suspend_device(dev);
} else if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
return wdt_resume_device_from_suspend(dev);
}
#endif
} else if (ctrl_command == DEVICE_PM_GET_POWER_STATE) {
*((uint32_t *)context) = wdt_qmsi_get_power_state(dev);
return 0;