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
|
@ -259,34 +259,31 @@ static int twim_nrfx_pm_control(const struct device *dev,
|
|||
enum pm_device_state *state)
|
||||
{
|
||||
int ret = 0;
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
if (ctrl_command == PM_DEVICE_STATE_SET) {
|
||||
enum pm_device_state curr_state;
|
||||
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
init_twim(dev);
|
||||
if (get_dev_data(dev)->dev_config) {
|
||||
i2c_nrfx_twim_configure(
|
||||
dev,
|
||||
get_dev_data(dev)->dev_config);
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_DEVICE_STATE_LOW_POWER:
|
||||
case PM_DEVICE_STATE_SUSPEND:
|
||||
case PM_DEVICE_STATE_OFF:
|
||||
if (curr_state != PM_DEVICE_STATE_ACTIVE) {
|
||||
break;
|
||||
}
|
||||
nrfx_twim_uninit(&get_dev_config(dev)->twim);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -ENOTSUP;
|
||||
(void)pm_device_state_get(dev, &curr_state);
|
||||
if (*state != curr_state) {
|
||||
switch (*state) {
|
||||
case PM_DEVICE_STATE_ACTIVE:
|
||||
init_twim(dev);
|
||||
if (get_dev_data(dev)->dev_config) {
|
||||
i2c_nrfx_twim_configure(
|
||||
dev,
|
||||
get_dev_data(dev)->dev_config);
|
||||
}
|
||||
break;
|
||||
|
||||
case PM_DEVICE_STATE_LOW_POWER:
|
||||
case PM_DEVICE_STATE_SUSPEND:
|
||||
case PM_DEVICE_STATE_OFF:
|
||||
if (curr_state != PM_DEVICE_STATE_ACTIVE) {
|
||||
break;
|
||||
}
|
||||
nrfx_twim_uninit(&get_dev_config(dev)->twim);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue