diff options
author | Chao Song <chao.song@linux.intel.com> | 2022-11-07 09:57:06 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-07 14:58:11 +0100 |
commit | c84443db0fddd188838faa9d71ebd6d9aa280068 (patch) | |
tree | bee5b7cdf5957474eccc05f30a3b29e90bca20a6 /sound/soc/sof/topology.c | |
parent | ASoC: SOF: Add support to parse pin binding array from topology (diff) | |
download | linux-c84443db0fddd188838faa9d71ebd6d9aa280068.tar.xz linux-c84443db0fddd188838faa9d71ebd6d9aa280068.zip |
ASoC: SOF: topology: Add helper to get/put widget queue id
Add get/put queue id helper to manage queue id in route
setup and route free.
The queue allocation rules are:
- If widget only has one sink/source pin, zero will be
returned as the queue ID directly.
- If widget has more than one sink/source pins, and pin
binding array is defined in topology, queue ID will be
allocated according to the pin binding array.
- If widget has more than one sink/sink pins, and pin
binding array is not defined, Linux ID allocation will be
used to allocate queue ID dynamically.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Suggested-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: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221107085706.2550-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/topology.c')
-rw-r--r-- | sound/soc/sof/topology.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 3b1290d34131..176f64a86c26 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1392,6 +1392,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, swidget->id = w->id; swidget->pipeline_id = index; swidget->private = NULL; + ida_init(&swidget->src_queue_ida); + ida_init(&swidget->sink_queue_ida); ret = sof_parse_tokens(scomp, swidget, comp_pin_tokens, ARRAY_SIZE(comp_pin_tokens), priv->array, @@ -1624,6 +1626,9 @@ out: if (widget_ops[swidget->id].ipc_free) widget_ops[swidget->id].ipc_free(swidget); + ida_destroy(&swidget->src_queue_ida); + ida_destroy(&swidget->sink_queue_ida); + sof_free_pin_binding(swidget, SOF_PIN_TYPE_SINK); sof_free_pin_binding(swidget, SOF_PIN_TYPE_SOURCE); |