From 8f299cd4d453a0822a8f752f9a79637a69fa05f2 Mon Sep 17 00:00:00 2001 From: Wu Zhigang Date: Wed, 11 Jul 2018 22:47:44 +0800 Subject: [PATCH 1/3] [RFC]platform:bug fix: alsa xrun cause fw panic. when stop command comes, the pipeline has to be prepared. This case has to be taken into account: when ALSA has XRUN, it will send stop/start commands to FW and try to recover the pipepine. If we did not prepare the pipeline before start, the recover process will fail. Signed-off-by: Wu Zhigang --- src/ipc/handler.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ipc/handler.c b/src/ipc/handler.c index 3c85097d5149..4cf7260ca11d 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -449,6 +449,18 @@ static int ipc_stream_trigger(uint32_t header) trace_error_value(ipc_cmd); } + /* when stop command comes, the pipeline has to be prepared. + * This case has to be taken into account: + * when ALSA has XRUN, it will send stop/start commands to FW + * and try to recover the pipepine. If we did not prepare + * the pipeline before start, the recover process will fail. + */ + if (cmd == COMP_TRIGGER_STOP) { + ret = pipeline_prepare(pcm_dev->cd->pipeline, pcm_dev->cd); + if (ret < 0) + trace_ipc_error("eR1"); + } + return ret; } From cda7019d78f23cf1e0c5bbeeaa32092861519137 Mon Sep 17 00:00:00 2001 From: Wu Zhigang Date: Wed, 11 Jul 2018 22:49:11 +0800 Subject: [PATCH 2/3] [RFC]host:the host state must be PREPARE when stopped. the host state must be PREPARE when stopped, if not, it will block our prepare process. Signed-off-by: Wu Zhigang --- src/audio/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/host.c b/src/audio/host.c index 55795673b028..848a33f13dbc 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -740,7 +740,7 @@ static int host_stop(struct comp_dev *dev) /* reset elements, to let next start from original one */ host_elements_reset(dev); - dev->state = COMP_STATE_PAUSED; + dev->state = COMP_STATE_PREPARE; return 0; } From ec02d6c63640eee89371aa836fab9ed13f861708 Mon Sep 17 00:00:00 2001 From: Wu Zhigang Date: Wed, 11 Jul 2018 22:50:26 +0800 Subject: [PATCH 3/3] [RFC]component:when xrun comes, component may be in prepare. when xrun comes, component may be in prepare state. Signed-off-by: Wu Zhigang --- src/audio/component.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/component.c b/src/audio/component.c index 319b40153c81..472cb8fa1dc4 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -142,7 +142,8 @@ int comp_set_state(struct comp_dev *dev, int cmd) break; case COMP_TRIGGER_STOP: case COMP_TRIGGER_XRUN: - if (dev->state == COMP_STATE_ACTIVE) { + if (dev->state == COMP_STATE_ACTIVE || + dev->state == COMP_STATE_PREPARE) { dev->state = COMP_STATE_PREPARE; } else { trace_comp_error("CEs");