ASoC: Intel: Skylake: Don't pause stopped pipeline while deleting
[deliverable/linux.git] / sound / soc / intel / skylake / skl-messages.c
index 226db84ba20f0286e3b175850f4087b3e4902a59..804091aa6e64dcf7e1720e1749fdaaaa434c6f54 100644 (file)
@@ -1046,7 +1046,7 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
 
        dev_dbg(ctx->dev, "%s: pipe = %d\n", __func__, pipe->ppl_id);
 
-       /* If pipe is not started, do not try to stop the pipe in FW. */
+       /* If pipe is started, do stop the pipe in FW. */
        if (pipe->state > SKL_PIPE_STARTED) {
                ret = skl_set_pipe_state(ctx, pipe, PPL_PAUSED);
                if (ret < 0) {
@@ -1055,18 +1055,20 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
                }
 
                pipe->state = SKL_PIPE_PAUSED;
-       } else {
-               /* If pipe was not created in FW, do not try to delete it */
-               if (pipe->state < SKL_PIPE_CREATED)
-                       return 0;
+       }
 
-               ret = skl_ipc_delete_pipeline(&ctx->ipc, pipe->ppl_id);
-               if (ret < 0)
-                       dev_err(ctx->dev, "Failed to delete pipeline\n");
+       /* If pipe was not created in FW, do not try to delete it */
+       if (pipe->state < SKL_PIPE_CREATED)
+               return 0;
 
-               pipe->state = SKL_PIPE_INVALID;
+       ret = skl_ipc_delete_pipeline(&ctx->ipc, pipe->ppl_id);
+       if (ret < 0) {
+               dev_err(ctx->dev, "Failed to delete pipeline\n");
+               return ret;
        }
 
+       pipe->state = SKL_PIPE_INVALID;
+
        return ret;
 }
 
@@ -1125,7 +1127,30 @@ int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
                return ret;
        }
 
-       pipe->state = SKL_PIPE_CREATED;
+       pipe->state = SKL_PIPE_PAUSED;
+
+       return 0;
+}
+
+/*
+ * Reset the pipeline by sending set pipe state IPC this will reset the DMA
+ * from the DSP side
+ */
+int skl_reset_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
+{
+       int ret;
+
+       /* If pipe was not created in FW, do not try to pause or delete */
+       if (pipe->state < SKL_PIPE_PAUSED)
+               return 0;
+
+       ret = skl_set_pipe_state(ctx, pipe, PPL_RESET);
+       if (ret < 0) {
+               dev_dbg(ctx->dev, "Failed to reset pipe ret=%d\n", ret);
+               return ret;
+       }
+
+       pipe->state = SKL_PIPE_RESET;
 
        return 0;
 }
This page took 0.025081 seconds and 5 git commands to generate.