pm: device: remove usage of ctrl_command
The callback is now invoked to set the device PM state in all cases, so the usage of ctrl_command is redundant. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
c2cf1ad203
commit
da0ff4ae46
37 changed files with 319 additions and 509 deletions
|
@ -505,23 +505,16 @@ static int st7735r_pm_control(const struct device *dev, uint32_t ctrl_command,
|
|||
int ret = 0;
|
||||
struct st7735r_data *data = (struct st7735r_data *)dev->data;
|
||||
|
||||
switch (ctrl_command) {
|
||||
case PM_DEVICE_STATE_SET:
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = st7735r_exit_sleep(data);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = st7735r_enter_sleep(data);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = st7735r_exit_sleep(data);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
ret = st7735r_enter_sleep(data);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -404,24 +404,15 @@ static void st7789v_enter_sleep(struct st7789v_data *data)
|
|||
static int st7789v_pm_control(const struct device *dev, uint32_t ctrl_command,
|
||||
enum pm_device_state *state)
|
||||
{
|
||||
int ret = 0;
|
||||
struct st7789v_data *data = (struct st7789v_data *)dev->data;
|
||||
|
||||
switch (ctrl_command) {
|
||||
case DEVICE_PM_SET_POWER_STATE:
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
st7789v_exit_sleep(data);
|
||||
ret = 0;
|
||||
} else {
|
||||
st7789v_enter_sleep(data);
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
st7789v_exit_sleep(data);
|
||||
} else {
|
||||
st7789v_enter_sleep(data);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue