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
|
@ -198,32 +198,28 @@ static int eth_mcux_device_pm_control(const struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (command == PM_DEVICE_STATE_SET) {
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
LOG_DBG("Suspending");
|
||||
if (*state == PM_DEVICE_STATE_SUSPEND) {
|
||||
LOG_DBG("Suspending");
|
||||
|
||||
ret = net_if_suspend(eth_ctx->iface);
|
||||
if (ret == -EBUSY) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
eth_mcux_phy_enter_reset(eth_ctx);
|
||||
eth_mcux_phy_stop(eth_ctx);
|
||||
|
||||
ENET_Reset(eth_ctx->base);
|
||||
ENET_Deinit(eth_ctx->base);
|
||||
clock_control_off(eth_ctx->clock_dev,
|
||||
(clock_control_subsys_t)eth_ctx->clock);
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
LOG_DBG("Resuming");
|
||||
|
||||
clock_control_on(eth_ctx->clock_dev,
|
||||
(clock_control_subsys_t)eth_ctx->clock);
|
||||
eth_mcux_init(dev);
|
||||
net_if_resume(eth_ctx->iface);
|
||||
ret = net_if_suspend(eth_ctx->iface);
|
||||
if (ret == -EBUSY) {
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
return -EINVAL;
|
||||
|
||||
eth_mcux_phy_enter_reset(eth_ctx);
|
||||
eth_mcux_phy_stop(eth_ctx);
|
||||
|
||||
ENET_Reset(eth_ctx->base);
|
||||
ENET_Deinit(eth_ctx->base);
|
||||
clock_control_off(eth_ctx->clock_dev,
|
||||
(clock_control_subsys_t)eth_ctx->clock);
|
||||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
LOG_DBG("Resuming");
|
||||
|
||||
clock_control_on(eth_ctx->clock_dev,
|
||||
(clock_control_subsys_t)eth_ctx->clock);
|
||||
eth_mcux_init(dev);
|
||||
net_if_resume(eth_ctx->iface);
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue