Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Kuninori Morimoto and committed by
Mark Brown
ffaf886e 8908c36d

+29 -19
+3 -2
include/sound/soc.h
··· 1302 1302 struct snd_soc_dai_link *dai_link); 1303 1303 void snd_soc_of_put_dai_link_cpus(struct snd_soc_dai_link *dai_link); 1304 1304 1305 - int snd_soc_add_pcm_runtime(struct snd_soc_card *card, 1306 - struct snd_soc_dai_link *dai_link); 1305 + int snd_soc_add_pcm_runtimes(struct snd_soc_card *card, 1306 + struct snd_soc_dai_link *dai_link, 1307 + int num_dai_link); 1307 1308 void snd_soc_remove_pcm_runtime(struct snd_soc_card *card, 1308 1309 struct snd_soc_pcm_runtime *rtd); 1309 1310
+4 -6
sound/soc/intel/avs/boards/hdaudio.c
··· 194 194 return ret; 195 195 } 196 196 197 - for (n = 0; n < pcm_count; n++) { 198 - ret = snd_soc_add_pcm_runtime(card, &links[n]); 199 - if (ret < 0) { 200 - dev_err(card->dev, "add links failed: %d\n", ret); 201 - return ret; 202 - } 197 + ret = snd_soc_add_pcm_runtimes(card, links, pcm_count); 198 + if (ret < 0) { 199 + dev_err(card->dev, "add links failed: %d\n", ret); 200 + return ret; 203 201 } 204 202 205 203 ret = avs_create_dapm_routes(card->dev, codec, pcm_count, &routes, &n);
+21 -10
sound/soc/soc-core.c
··· 959 959 * topology component. And machine drivers can still define static 960 960 * DAI links in dai_link array. 961 961 */ 962 - int snd_soc_add_pcm_runtime(struct snd_soc_card *card, 963 - struct snd_soc_dai_link *dai_link) 962 + static int snd_soc_add_pcm_runtime(struct snd_soc_card *card, 963 + struct snd_soc_dai_link *dai_link) 964 964 { 965 965 struct snd_soc_pcm_runtime *rtd; 966 966 struct snd_soc_dai_link_component *codec, *platform, *cpu; ··· 1027 1027 snd_soc_remove_pcm_runtime(card, rtd); 1028 1028 return -EPROBE_DEFER; 1029 1029 } 1030 - EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime); 1030 + 1031 + int snd_soc_add_pcm_runtimes(struct snd_soc_card *card, 1032 + struct snd_soc_dai_link *dai_link, 1033 + int num_dai_link) 1034 + { 1035 + for (int i = 0; i < num_dai_link; i++) { 1036 + int ret = snd_soc_add_pcm_runtime(card, dai_link + i); 1037 + 1038 + if (ret < 0) 1039 + return ret; 1040 + } 1041 + 1042 + return 0; 1043 + } 1044 + EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtimes); 1031 1045 1032 1046 static void snd_soc_runtime_get_dai_fmt(struct snd_soc_pcm_runtime *rtd) 1033 1047 { ··· 1935 1921 { 1936 1922 struct snd_soc_pcm_runtime *rtd; 1937 1923 struct snd_soc_component *component; 1938 - struct snd_soc_dai_link *dai_link; 1939 - int ret, i; 1924 + int ret; 1940 1925 1941 1926 mutex_lock(&client_mutex); 1942 1927 mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); ··· 1952 1939 1953 1940 /* add predefined DAI links to the list */ 1954 1941 card->num_rtd = 0; 1955 - for_each_card_prelinks(card, i, dai_link) { 1956 - ret = snd_soc_add_pcm_runtime(card, dai_link); 1957 - if (ret < 0) 1958 - goto probe_end; 1959 - } 1942 + ret = snd_soc_add_pcm_runtimes(card, card->dai_link, card->num_links); 1943 + if (ret < 0) 1944 + goto probe_end; 1960 1945 1961 1946 /* card bind complete so register a sound card */ 1962 1947 ret = snd_card_new(card->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+1 -1
sound/soc/soc-topology.c
··· 1741 1741 goto err; 1742 1742 } 1743 1743 1744 - ret = snd_soc_add_pcm_runtime(tplg->comp->card, link); 1744 + ret = snd_soc_add_pcm_runtimes(tplg->comp->card, link, 1); 1745 1745 if (ret < 0) { 1746 1746 dev_err(tplg->dev, "ASoC: adding FE link failed\n"); 1747 1747 goto err;