From 22a2fc81658b3eebcfcc110de97bcbd32f5ee301 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 16 Mar 2020 15:36:58 +0900 Subject: ASoC: soc-core: Merge CPU/Codec DAIs ALSA SoC is currently categorizing CPU/Codec DAIs, and it works well. But modern devices require more complex connections, for example Codec to Codec, etc, and future devices will enable to more complex connections. Because of these background, CPU/Codec DAIs categorizing is no longer good much to modern device. Currently, rtd has both CPU/Codec DAIs pointer. rtd->cpu_dais = [][][][][][][][][] rtd->codec_dais = [][][][][][][][][] This patch merges these into DAIs pointer. rtd->dais = [][][][][][][][][][][][][][][][][][] ^cpu_dais ^codec_dais |--- num_cpus ---|--- num_codecs --| Then, we can merge for_each_rtd_cpu/codec_dais() from this patch. - for_each_rtd_cpu_dais() { - ... - } - for_each_rtd_codec_dais() { - ... - } + for_each_rtd_dais() { + ... + } Signed-off-by: Kuninori Morimoto Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/87wo7kolfa.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index d97c4aa779a2..539211bd0f94 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1145,6 +1145,7 @@ struct snd_soc_pcm_runtime { struct snd_compr *compr; struct snd_soc_dai *codec_dai; struct snd_soc_dai *cpu_dai; + struct snd_soc_dai **dais; struct snd_soc_dai **codec_dais; unsigned int num_codecs; @@ -1184,7 +1185,11 @@ struct snd_soc_pcm_runtime { (i)++) #define for_each_rtd_codec_dais_rollback(rtd, i, dai) \ for (; (--(i) >= 0) && ((dai) = rtd->codec_dais[i]);) - +#define for_each_rtd_dais(rtd, i, dai) \ + for ((i) = 0; \ + ((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \ + ((dai) = (rtd)->dais[i]); \ + (i)++) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); -- cgit v1.2.3