summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ipc4-pcm.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2023-01-27 14:00:25 +0200
committerMark Brown <broonie@kernel.org>2023-01-27 12:14:08 +0000
commit9c04363d222bc94d49d883458b2854334a848b5f (patch)
tree425932b2a1edc2ed429594e8d62f1c3242f4ab1c /sound/soc/sof/ipc4-pcm.c
parent2d271af1af241e64726ada07c6bef6572f1be6a5 (diff)
ASoC: SOF: Introduce struct snd_sof_pipeline
Introduce struct snd_sof_pipeline to save the information about pipelines including the pipeline widget, their status wrt how many PCM's are using them and whether they are complete or not. In struct snd_sof_widget, replace pipe_widget with spipe and remove complete. In struct snd_sof_pcm_stream_pipeline_list, replace pipe_widgets with pipelines. Update all users accordingly. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230127120031.10709-13-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc4-pcm.c')
-rw-r--r--sound/soc/sof/ipc4-pcm.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index a5482185cd6c..17a116e8c47c 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -68,6 +68,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
struct ipc4_pipeline_set_state_data *data;
struct snd_sof_widget *pipe_widget;
struct sof_ipc4_pipeline *pipeline;
+ struct snd_sof_pipeline *spipe;
struct snd_sof_pcm *spcm;
int ret;
int i, j;
@@ -79,7 +80,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
pipeline_list = &spcm->stream[substream->stream].pipeline_list;
/* nothing to trigger if the list is empty */
- if (!pipeline_list->pipe_widgets)
+ if (!pipeline_list->pipelines)
return 0;
/* allocate memory for the pipeline data */
@@ -96,7 +97,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
* sink->source would still be guaranteed for each fork independently.
*/
for (i = pipeline_list->count - 1; i >= 0; i--) {
- pipe_widget = pipeline_list->pipe_widgets[i];
+ spipe = pipeline_list->pipelines[i];
+ pipe_widget = spipe->pipe_widget;
pipeline = pipe_widget->private;
if (pipeline->state != state && !pipeline->skip_during_fe_trigger)
data->pipeline_ids[data->count++] = pipe_widget->instance_id;
@@ -122,7 +124,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
/* update PAUSED state for all pipelines that were just triggered */
for (i = 0; i < data->count; i++) {
for (j = 0; j < pipeline_list->count; j++) {
- pipe_widget = pipeline_list->pipe_widgets[j];
+ spipe = pipeline_list->pipelines[j];
+ pipe_widget = spipe->pipe_widget;
pipeline = pipe_widget->private;
if (data->pipeline_ids[i] == pipe_widget->instance_id) {
@@ -146,7 +149,8 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
/* update final state for all pipelines that were just triggered */
for (i = 0; i < data->count; i++) {
for (j = 0; j < pipeline_list->count; j++) {
- pipe_widget = pipeline_list->pipe_widgets[j];
+ spipe = pipeline_list->pipelines[j];
+ pipe_widget = spipe->pipe_widget;
pipeline = pipe_widget->private;
if (data->pipeline_ids[i] == pipe_widget->instance_id) {
@@ -274,8 +278,8 @@ static void sof_ipc4_pcm_free(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
for_each_pcm_streams(stream) {
pipeline_list = &spcm->stream[stream].pipeline_list;
- kfree(pipeline_list->pipe_widgets);
- pipeline_list->pipe_widgets = NULL;
+ kfree(pipeline_list->pipelines);
+ pipeline_list->pipelines = NULL;
}
}
@@ -289,10 +293,9 @@ static int sof_ipc4_pcm_setup(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm
pipeline_list = &spcm->stream[stream].pipeline_list;
/* allocate memory for max number of pipeline IDs */
- pipeline_list->pipe_widgets = kcalloc(ipc4_data->max_num_pipelines,
- sizeof(struct snd_sof_widget *),
- GFP_KERNEL);
- if (!pipeline_list->pipe_widgets) {
+ pipeline_list->pipelines = kcalloc(ipc4_data->max_num_pipelines,
+ sizeof(struct snd_sof_widget *), GFP_KERNEL);
+ if (!pipeline_list->pipelines) {
sof_ipc4_pcm_free(sdev, spcm);
return -ENOMEM;
}