From 819c023d236ada6adbb8bc1610466e754c15f2ff Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Thu, 10 Feb 2022 09:47:57 +0100 Subject: [PATCH] ipc4: fix pipeline reset During pipeline reset all components remains in previous state. This cause issue at pipeline deletion. This patch allowed to propagate state transition to all pipeline components. Signed-off-by: Tomasz Leman --- src/ipc/ipc4/handler.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/ipc/ipc4/handler.c b/src/ipc/ipc4/handler.c index 3acfa6b29..e9fb6c036 100644 --- a/src/ipc/ipc4/handler.c +++ b/src/ipc/ipc4/handler.c @@ -153,6 +153,30 @@ error: return err; } +static int propagate_state_to_ppl_comp(struct ipc *ipc, uint32_t ppl_id, int cmd) +{ + int ret = IPC4_INVALID_RESOURCE_ID; + struct ipc_comp_dev *icd; + struct list_item *clist; + + list_for_item(clist, &ipc->comp_list) { + icd = container_of(clist, struct ipc_comp_dev, list); + if (icd->type != COMP_TYPE_COMPONENT) + continue; + + if (!cpu_is_me(icd->core)) + continue; + + if (ipc_comp_pipe_id(icd) == ppl_id) { + ret = comp_set_state(icd->cd, cmd); + if (ret != 0) + return IPC4_INVALID_REQUEST; + } + } + + return ret; +} + /* Ipc4 pipeline message <------> ipc3 pipeline message * RUNNING <-------> TRIGGER START * INIT + PAUSED <-------> PIPELINE COMPLETE @@ -262,9 +286,13 @@ static int set_pipeline_state(uint32_t id, uint32_t cmd, bool *delayed) } } + ret = propagate_state_to_ppl_comp(ipc, id, COMP_TRIGGER_RESET); + if (ret != 0) + return ret; + /* resource is not released by triggering reset which is used by current FW */ ret = pipeline_reset(host->cd->pipeline, host->cd); - if (ret < 0) + if (ret != 0) ret = IPC4_INVALID_REQUEST; return ret;