pm: rename PM_DEVICE_GET/SET_POWER_STATE to PM_DEVICE_STATE_GET/SET
Adjust name to be consistent with device PM naming conventions. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
6633b05530
commit
56f1a8ce98
36 changed files with 72 additions and 72 deletions
|
@ -241,8 +241,8 @@ Zephyr RTOS power management subsystem provides a control function interface
|
||||||
to device drivers to indicate power management operations to perform.
|
to device drivers to indicate power management operations to perform.
|
||||||
The supported PM control commands are:
|
The supported PM control commands are:
|
||||||
|
|
||||||
* PM_DEVICE_SET_POWER_STATE
|
* PM_DEVICE_STATE_SET
|
||||||
* PM_DEVICE_GET_POWER_STATE
|
* PM_DEVICE_STATE_GET
|
||||||
|
|
||||||
Each device driver defines:
|
Each device driver defines:
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ Device Set Power State
|
||||||
int pm_device_state_set(const struct device *dev, uint32_t device_power_state, pm_device_cb cb, void *arg);
|
int pm_device_state_set(const struct device *dev, uint32_t device_power_state, pm_device_cb cb, void *arg);
|
||||||
|
|
||||||
Calls the :c:func:`pm_control()` handler function implemented by the
|
Calls the :c:func:`pm_control()` handler function implemented by the
|
||||||
device driver with PM_DEVICE_SET_POWER_STATE command.
|
device driver with PM_DEVICE_STATE_SET command.
|
||||||
|
|
||||||
Device Get Power State
|
Device Get Power State
|
||||||
----------------------
|
----------------------
|
||||||
|
@ -308,7 +308,7 @@ Device Get Power State
|
||||||
int pm_device_state_get(const struct device *dev, uint32_t * device_power_state);
|
int pm_device_state_get(const struct device *dev, uint32_t * device_power_state);
|
||||||
|
|
||||||
Calls the :c:func:`pm_control()` handler function implemented by the
|
Calls the :c:func:`pm_control()` handler function implemented by the
|
||||||
device driver with PM_DEVICE_GET_POWER_STATE command.
|
device driver with PM_DEVICE_STATE_GET command.
|
||||||
|
|
||||||
Busy Status Indication
|
Busy Status Indication
|
||||||
======================
|
======================
|
||||||
|
|
|
@ -526,7 +526,7 @@ static int st7735r_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
struct st7735r_data *data = (struct st7735r_data *)dev->data;
|
struct st7735r_data *data = (struct st7735r_data *)dev->data;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = st7735r_exit_sleep(data);
|
ret = st7735r_exit_sleep(data);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -543,7 +543,7 @@ static int st7735r_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -415,7 +415,7 @@ static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
struct st7789v_data *data = (struct st7789v_data *)dev->data;
|
struct st7789v_data *data = (struct st7789v_data *)dev->data;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
st7789v_exit_sleep(data);
|
st7789v_exit_sleep(data);
|
||||||
data->pm_state = PM_DEVICE_ACTIVE_STATE;
|
data->pm_state = PM_DEVICE_ACTIVE_STATE;
|
||||||
|
@ -426,7 +426,7 @@ static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -299,7 +299,7 @@ static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev);
|
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
|
@ -307,7 +307,7 @@ static int entropy_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
new_state);
|
new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ static int eth_mcux_device_pm_control(const struct device *dev,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command == PM_DEVICE_SET_POWER_STATE) {
|
if (command == PM_DEVICE_STATE_SET) {
|
||||||
if (*(uint32_t *)context == PM_DEVICE_SUSPEND_STATE) {
|
if (*(uint32_t *)context == PM_DEVICE_SUSPEND_STATE) {
|
||||||
LOG_DBG("Suspending");
|
LOG_DBG("Suspending");
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ static int spi_flash_at45_pm_control(const struct device *dev,
|
||||||
const struct spi_flash_at45_config *dev_config = get_dev_config(dev);
|
const struct spi_flash_at45_config *dev_config = get_dev_config(dev);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != dev_data->pm_state) {
|
if (new_state != dev_data->pm_state) {
|
||||||
|
@ -606,7 +606,7 @@ static int spi_flash_at45_pm_control(const struct device *dev,
|
||||||
dev_data->pm_state = new_state;
|
dev_data->pm_state = new_state;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = dev_data->pm_state;
|
*((uint32_t *)context) = dev_data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,13 +465,13 @@ static int gpio_dw_device_ctrl(const struct device *port,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
||||||
ret = gpio_dw_suspend_port(port);
|
ret = gpio_dw_suspend_port(port);
|
||||||
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = gpio_dw_resume_from_suspend_port(port);
|
ret = gpio_dw_resume_from_suspend_port(port);
|
||||||
}
|
}
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = gpio_dw_get_power_state(port);
|
*((uint32_t *)context) = gpio_dw_get_power_state(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != get_dev_data(dev)->pm_state) {
|
if (new_state != get_dev_data(dev)->pm_state) {
|
||||||
|
@ -381,7 +381,7 @@ static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
new_state);
|
new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ static int twi_nrfx_pm_control(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint32_t pm_current_state = get_dev_data(dev)->pm_state;
|
uint32_t pm_current_state = get_dev_data(dev)->pm_state;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != pm_current_state) {
|
if (new_state != pm_current_state) {
|
||||||
|
@ -250,7 +250,7 @@ static int twi_nrfx_pm_control(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ static int twim_nrfx_pm_control(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint32_t pm_current_state = get_dev_data(dev)->pm_state;
|
uint32_t pm_current_state = get_dev_data(dev)->pm_state;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != pm_current_state) {
|
if (new_state != pm_current_state) {
|
||||||
|
@ -301,7 +301,7 @@ static int twim_nrfx_pm_control(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,13 +198,13 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
unsigned int key = arch_irq_lock();
|
unsigned int key = arch_irq_lock();
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
||||||
ret = arc_v2_irq_unit_suspend(dev);
|
ret = arc_v2_irq_unit_suspend(dev);
|
||||||
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = arc_v2_irq_unit_resume(dev);
|
ret = arc_v2_irq_unit_resume(dev);
|
||||||
}
|
}
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = arc_v2_irq_unit_get_state(dev);
|
*((uint32_t *)context) = arc_v2_irq_unit_get_state(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,13 +309,13 @@ static int ioapic_device_ctrl(const struct device *dev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
||||||
ret = ioapic_suspend(dev);
|
ret = ioapic_suspend(dev);
|
||||||
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = ioapic_resume_from_suspend(dev);
|
ret = ioapic_resume_from_suspend(dev);
|
||||||
}
|
}
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = ioapic_device_power_state;
|
*((uint32_t *)context) = ioapic_device_power_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -408,13 +408,13 @@ static int loapic_device_ctrl(const struct device *port,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_SUSPEND_STATE) {
|
||||||
ret = loapic_suspend(port);
|
ret = loapic_suspend(port);
|
||||||
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
} else if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = loapic_resume(port);
|
ret = loapic_resume(port);
|
||||||
}
|
}
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = loapic_device_power_state;
|
*((uint32_t *)context) = loapic_device_power_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,11 +181,11 @@ static int led_pwm_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
err = led_pwm_pm_get_state(dev, context);
|
err = led_pwm_pm_get_state(dev, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
err = led_pwm_pm_set_state(dev, *((uint32_t *)context));
|
err = led_pwm_pm_set_state(dev, *((uint32_t *)context));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ static int pwm_nrfx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != (*current_state)) {
|
if (new_state != (*current_state)) {
|
||||||
|
@ -334,7 +334,7 @@ static int pwm_nrfx_pm_control(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = (*current_state);
|
*((uint32_t *)context) = (*current_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ static int apds9960_device_ctrl(const struct device *dev,
|
||||||
struct apds9960_data *data = dev->data;
|
struct apds9960_data *data = dev->data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t device_pm_state = *(uint32_t *)context;
|
uint32_t device_pm_state = *(uint32_t *)context;
|
||||||
|
|
||||||
if (device_pm_state == PM_DEVICE_ACTIVE_STATE) {
|
if (device_pm_state == PM_DEVICE_ACTIVE_STATE) {
|
||||||
|
@ -441,7 +441,7 @@ static int apds9960_device_ctrl(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = PM_DEVICE_ACTIVE_STATE;
|
*((uint32_t *)context) = PM_DEVICE_ACTIVE_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -398,7 +398,7 @@ int bme280_pm_ctrl(const struct device *dev, uint32_t ctrl_command,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Set power state */
|
/* Set power state */
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_pm_state = *((const uint32_t *)context);
|
uint32_t new_pm_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_pm_state != data->pm_state) {
|
if (new_pm_state != data->pm_state) {
|
||||||
|
@ -429,7 +429,7 @@ int bme280_pm_ctrl(const struct device *dev, uint32_t ctrl_command,
|
||||||
}
|
}
|
||||||
/* Get power state */
|
/* Get power state */
|
||||||
else {
|
else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -595,9 +595,9 @@ static int bmp388_device_ctrl(
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
ret = bmp388_set_power_state(dev, *((uint32_t *)context));
|
ret = bmp388_set_power_state(dev, *((uint32_t *)context));
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = bmp388_get_power_state(dev);
|
*((uint32_t *)context) = bmp388_get_power_state(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -549,7 +549,7 @@ static int fdc2x1x_device_pm_ctrl(const struct device *dev,
|
||||||
uint32_t new_state;
|
uint32_t new_state;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
new_state = *(uint32_t *)context;
|
new_state = *(uint32_t *)context;
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
switch (new_state) {
|
switch (new_state) {
|
||||||
|
@ -563,7 +563,7 @@ static int fdc2x1x_device_pm_ctrl(const struct device *dev,
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,14 +529,14 @@ static int lis2mdl_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
uint32_t new_state;
|
uint32_t new_state;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
new_state = *((const uint32_t *)context);
|
new_state = *((const uint32_t *)context);
|
||||||
if (new_state != current_state) {
|
if (new_state != current_state) {
|
||||||
status = lis2mdl_set_power_state(lis2mdl, config,
|
status = lis2mdl_set_power_state(lis2mdl, config,
|
||||||
new_state);
|
new_state);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = current_state;
|
*((uint32_t *)context) = current_state;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -276,11 +276,11 @@ static int qdec_nrfx_pm_control(const struct device *dev,
|
||||||
LOG_DBG("");
|
LOG_DBG("");
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
err = qdec_nrfx_pm_get_state(data, context);
|
err = qdec_nrfx_pm_get_state(data, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
err = qdec_nrfx_pm_set_state(data, *((uint32_t *)context));
|
err = qdec_nrfx_pm_set_state(data, *((uint32_t *)context));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ static int vcnl4040_device_ctrl(const struct device *dev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t device_pm_state = *(uint32_t *)context;
|
uint32_t device_pm_state = *(uint32_t *)context;
|
||||||
uint16_t ps_conf;
|
uint16_t ps_conf;
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ static int vcnl4040_device_ctrl(const struct device *dev,
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ctrl_command == PM_DEVICE_GET_POWER_STATE) {
|
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||||
*((uint32_t *)context) = PM_DEVICE_ACTIVE_STATE;
|
*((uint32_t *)context) = PM_DEVICE_ACTIVE_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,7 @@ static int uart_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != get_dev_data(dev)->pm_state) {
|
if (new_state != get_dev_data(dev)->pm_state) {
|
||||||
|
@ -457,7 +457,7 @@ static int uart_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
new_state);
|
new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,10 +454,10 @@ static int uart_npcx_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
ret = uart_npcx_set_power_state(dev, *((uint32_t *)context));
|
ret = uart_npcx_set_power_state(dev, *((uint32_t *)context));
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
ret = uart_npcx_get_power_state(dev, (uint32_t *)context);
|
ret = uart_npcx_get_power_state(dev, (uint32_t *)context);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ static int uart_nrfx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
static uint32_t current_state = PM_DEVICE_ACTIVE_STATE;
|
static uint32_t current_state = PM_DEVICE_ACTIVE_STATE;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != current_state) {
|
if (new_state != current_state) {
|
||||||
|
@ -1170,7 +1170,7 @@ static int uart_nrfx_pm_control(const struct device *dev,
|
||||||
current_state = new_state;
|
current_state = new_state;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = current_state;
|
*((uint32_t *)context) = current_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1867,14 +1867,14 @@ static int uarte_nrfx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
struct uarte_nrfx_data *data = get_dev_data(dev);
|
struct uarte_nrfx_data *data = get_dev_data(dev);
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
uarte_nrfx_set_power_state(dev, new_state);
|
uarte_nrfx_set_power_state(dev, new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1466,14 +1466,14 @@ static int uart_stm32_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
struct uart_stm32_data *data = DEV_DATA(dev);
|
struct uart_stm32_data *data = DEV_DATA(dev);
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
uart_stm32_set_power_state(dev, new_state);
|
uart_stm32_set_power_state(dev, new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ static int spi_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != get_dev_data(dev)->pm_state) {
|
if (new_state != get_dev_data(dev)->pm_state) {
|
||||||
|
@ -264,7 +264,7 @@ static int spi_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||||
new_state);
|
new_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
*((uint32_t *)context) = get_dev_data(dev)->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ static int spi_nrfx_pm_control(const struct device *dev,
|
||||||
struct spi_nrfx_data *data = get_dev_data(dev);
|
struct spi_nrfx_data *data = get_dev_data(dev);
|
||||||
const struct spi_nrfx_config *config = get_dev_config(dev);
|
const struct spi_nrfx_config *config = get_dev_config(dev);
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
|
@ -319,7 +319,7 @@ static int spi_nrfx_pm_control(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ static int spim_nrfx_pm_control(const struct device *dev,
|
||||||
struct spi_nrfx_data *data = get_dev_data(dev);
|
struct spi_nrfx_data *data = get_dev_data(dev);
|
||||||
const struct spi_nrfx_config *config = get_dev_config(dev);
|
const struct spi_nrfx_config *config = get_dev_config(dev);
|
||||||
|
|
||||||
if (ctrl_command == PM_DEVICE_SET_POWER_STATE) {
|
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||||
uint32_t new_state = *((const uint32_t *)context);
|
uint32_t new_state = *((const uint32_t *)context);
|
||||||
|
|
||||||
if (new_state != data->pm_state) {
|
if (new_state != data->pm_state) {
|
||||||
|
@ -367,7 +367,7 @@ static int spim_nrfx_pm_control(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_GET_POWER_STATE);
|
__ASSERT_NO_MSG(ctrl_command == PM_DEVICE_STATE_GET);
|
||||||
*((uint32_t *)context) = data->pm_state;
|
*((uint32_t *)context) = data->pm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ struct device;
|
||||||
#define PM_DEVICE_OFF_STATE 5
|
#define PM_DEVICE_OFF_STATE 5
|
||||||
|
|
||||||
/* Constants defining support device power commands */
|
/* Constants defining support device power commands */
|
||||||
#define PM_DEVICE_SET_POWER_STATE 1
|
#define PM_DEVICE_STATE_SET 1
|
||||||
#define PM_DEVICE_GET_POWER_STATE 2
|
#define PM_DEVICE_STATE_GET 2
|
||||||
|
|
||||||
typedef void (*pm_device_cb)(const struct device *dev,
|
typedef void (*pm_device_cb)(const struct device *dev,
|
||||||
int status, void *context, void *arg);
|
int status, void *context, void *arg);
|
||||||
|
|
|
@ -121,14 +121,14 @@ static int dummy_device_pm_ctrl(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = dummy_resume_from_suspend(dev);
|
ret = dummy_resume_from_suspend(dev);
|
||||||
} else {
|
} else {
|
||||||
ret = dummy_suspend(dev);
|
ret = dummy_suspend(dev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = dummy_get_power_state(dev);
|
*((uint32_t *)context) = dummy_get_power_state(dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -52,14 +52,14 @@ static int dummy_parent_pm_ctrl(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = dummy_resume_from_suspend(dev);
|
ret = dummy_resume_from_suspend(dev);
|
||||||
} else {
|
} else {
|
||||||
ret = dummy_suspend(dev);
|
ret = dummy_suspend(dev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = dummy_get_power_state(dev);
|
*((uint32_t *)context) = dummy_get_power_state(dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -190,7 +190,7 @@ int pm_device_state_set(const struct device *dev, uint32_t device_power_state,
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dev->pm_control(dev, PM_DEVICE_SET_POWER_STATE,
|
return dev->pm_control(dev, PM_DEVICE_STATE_SET,
|
||||||
&device_power_state, cb, arg);
|
&device_power_state, cb, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +200,6 @@ int pm_device_state_get(const struct device *dev, uint32_t *device_power_state)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dev->pm_control(dev, PM_DEVICE_GET_POWER_STATE,
|
return dev->pm_control(dev, PM_DEVICE_STATE_GET,
|
||||||
device_power_state, NULL, NULL);
|
device_power_state, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ static int fake_dev_pm_control(const struct device *dev, uint32_t command,
|
||||||
struct fake_dev_context *ctx = dev->data;
|
struct fake_dev_context *ctx = dev->data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (command == PM_DEVICE_SET_POWER_STATE) {
|
if (command == PM_DEVICE_STATE_SET) {
|
||||||
if (*(uint32_t *)context == PM_DEVICE_SUSPEND_STATE) {
|
if (*(uint32_t *)context == PM_DEVICE_SUSPEND_STATE) {
|
||||||
ret = net_if_suspend(ctx->iface);
|
ret = net_if_suspend(ctx->iface);
|
||||||
if (ret == -EBUSY) {
|
if (ret == -EBUSY) {
|
||||||
|
|
|
@ -45,14 +45,14 @@ static int dummy_device_pm_ctrl(const struct device *dev,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
switch (ctrl_command) {
|
switch (ctrl_command) {
|
||||||
case PM_DEVICE_SET_POWER_STATE:
|
case PM_DEVICE_STATE_SET:
|
||||||
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
if (*((uint32_t *)context) == PM_DEVICE_ACTIVE_STATE) {
|
||||||
ret = dummy_resume_from_suspend(dev);
|
ret = dummy_resume_from_suspend(dev);
|
||||||
} else {
|
} else {
|
||||||
ret = dummy_suspend(dev);
|
ret = dummy_suspend(dev);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_DEVICE_GET_POWER_STATE:
|
case PM_DEVICE_STATE_GET:
|
||||||
*((uint32_t *)context) = dummy_get_power_state(dev);
|
*((uint32_t *)context) = dummy_get_power_state(dev);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue