pipeline: try to stop active component when reset

When resetting a pipeline, components may be still in active state if
previous pipeline walkthrough of stop trigger aborted due to some
reason. Here we give it a second chance to stop the component before
resetting it. Without doing this, some components like dai could cause
DSP panic because the DMA is still running.

Signed-off-by: Brent Lu <brent.lu@intel.com>
This commit is contained in:
Brent Lu 2023-04-18 10:24:17 +08:00 committed by Kai Vehmanen
parent 0140c43099
commit eff50e4262
1 changed files with 11 additions and 0 deletions

View File

@ -359,6 +359,17 @@ static int pipeline_comp_reset(struct comp_dev *current,
}
}
/* two cases for a component still being active here:
* 1. trigger function failed to handle stop event
* 2. trigger functon skipped due to error of other component's trigger function
*/
if (current->state == COMP_STATE_ACTIVE) {
pipe_warn(current->pipeline, "pipeline_comp_reset(): component is in active state, try to stop it");
err = comp_trigger(current, COMP_TRIGGER_STOP);
if (err)
pipe_err(current->pipeline, "pipeline_comp_reset(): failed to recover");
}
err = comp_reset(current);
if (err < 0 || err == PPL_STATUS_PATH_STOP)
return err;