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>
This commit is contained in:
Chao Song
2022-11-07 10:57:06 +02:00
committed by Mark Brown
parent 3b3acedbd0
commit c84443db0f
3 changed files with 131 additions and 13 deletions

View File

@@ -422,6 +422,9 @@ struct snd_sof_widget {
char **sink_pin_binding;
char **src_pin_binding;
struct ida src_queue_ida;
struct ida sink_queue_ida;
void *private; /* core does not touch this */
};
@@ -435,6 +438,9 @@ struct snd_sof_route {
struct snd_sof_widget *sink_widget;
bool setup;
int src_queue_id;
int dst_queue_id;
void *private;
};