pm: Use pm_device_action_run instead of state_set

Since drivers implement a callback based on action and not the state,
we should be using the API based on the action instead of the one based
on the state.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-11-23 09:21:49 -08:00 committed by Christopher Friedt
commit 6451626ce7
13 changed files with 76 additions and 79 deletions

View file

@ -4364,8 +4364,8 @@ static void shutdown_uart(void)
if (ictx.uart_on) {
HL7800_IO_DBG_LOG("Power OFF the UART");
uart_irq_rx_disable(ictx.mdm_ctx.uart_dev);
rc = pm_device_state_set(ictx.mdm_ctx.uart_dev,
PM_DEVICE_STATE_SUSPENDED);
rc = pm_device_action_run(ictx.mdm_ctx.uart_dev,
PM_DEVICE_ACTION_SUSPEND);
if (rc) {
LOG_ERR("Error disabling UART peripheral (%d)", rc);
}
@ -4381,8 +4381,8 @@ static void power_on_uart(void)
if (!ictx.uart_on) {
HL7800_IO_DBG_LOG("Power ON the UART");
rc = pm_device_state_set(ictx.mdm_ctx.uart_dev,
PM_DEVICE_STATE_ACTIVE);
rc = pm_device_action_run(ictx.mdm_ctx.uart_dev,
PM_DEVICE_ACTION_RESUME);
if (rc) {
LOG_ERR("Error enabling UART peripheral (%d)", rc);
}

View file

@ -199,7 +199,7 @@ int mdm_receiver_sleep(struct mdm_receiver_context *ctx)
{
uart_irq_rx_disable(ctx->uart_dev);
#ifdef CONFIG_PM_DEVICE
pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_SUSPENDED);
pm_device_action_run(ctx->uart_dev, PM_DEVICE_ACTION_SUSPEND);
#endif
return 0;
}
@ -207,7 +207,7 @@ int mdm_receiver_sleep(struct mdm_receiver_context *ctx)
int mdm_receiver_wake(struct mdm_receiver_context *ctx)
{
#ifdef CONFIG_PM_DEVICE
pm_device_state_set(ctx->uart_dev, PM_DEVICE_STATE_ACTIVE);
pm_device_action_run(ctx->uart_dev, PM_DEVICE_ACTION_SUSPEND);
#endif
uart_irq_rx_enable(ctx->uart_dev);