aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2023-03-27 00:34:26 +0000
committerMark Brown <broonie@kernel.org>2023-03-28 01:26:03 +0100
commitffaf886e249ee269f9084c21fbd8617ce9b83817 (patch)
treed7af22793ae055b74d63af8c67aa97965c67d6dc /sound/soc/soc-core.c
parentASoC: qcom: audioreach: drop stray 'get' from error message (diff)
downloadwireguard-linux-ffaf886e249ee269f9084c21fbd8617ce9b83817.tar.xz
wireguard-linux-ffaf886e249ee269f9084c21fbd8617ce9b83817.zip
ASoC: soc-core.c: add snd_soc_add_pcm_runtimes()
Current ASoC supports snd_soc_add_pcm_runtime(), but user need to call it one-by-one if it has multi dai_links. This patch adds snd_soc_add_pcm_runtimes() which supports multi dai_links. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87h6u76nhq.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2faa0d8d0d8e..9bbcff492c1e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -959,8 +959,8 @@ EXPORT_SYMBOL_GPL(snd_soc_remove_pcm_runtime);
* topology component. And machine drivers can still define static
* DAI links in dai_link array.
*/
-int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
- struct snd_soc_dai_link *dai_link)
+static int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_dai_link_component *codec, *platform, *cpu;
@@ -1027,7 +1027,21 @@ _err_defer:
snd_soc_remove_pcm_runtime(card, rtd);
return -EPROBE_DEFER;
}
-EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime);
+
+int snd_soc_add_pcm_runtimes(struct snd_soc_card *card,
+ struct snd_soc_dai_link *dai_link,
+ int num_dai_link)
+{
+ for (int i = 0; i < num_dai_link; i++) {
+ int ret = snd_soc_add_pcm_runtime(card, dai_link + i);
+
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtimes);
static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd)
{
@@ -1921,8 +1935,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
{
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_component *component;
- struct snd_soc_dai_link *dai_link;
- int ret, i;
+ int ret;
mutex_lock(&client_mutex);
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
@@ -1939,11 +1952,9 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
/* add predefined DAI links to the list */
card->num_rtd = 0;
- for_each_card_prelinks(card, i, dai_link) {
- ret = snd_soc_add_pcm_runtime(card, dai_link);
- if (ret < 0)
- goto probe_end;
- }
+ ret = snd_soc_add_pcm_runtimes(card, card->dai_link, card->num_links);
+ if (ret < 0)
+ goto probe_end;
/* card bind complete so register a sound card */
ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,