Commit 2af69581 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: add asoc_rtd_to_cpu/codec() macro

Now, snd_soc_pcm_runtime supports multi cpu_dai/codec_dai.
It still has cpu_dai/codec_dai for single DAI,
and has cpu_dais/codec_dais for multi DAIs.

	dais  = [][][][][][][][][][][][][][][][][][]
		^cpu_dais         ^codec_dais
		|--- num_cpus ---|--- num_codecs --|

	/* for multi DAIs */
	rtd->cpu_dais   = &rtd->dais[0];
	rtd->codec_dais = &rtd->dais[dai_link->num_cpus];

	/* for single DAI */
	rtd->cpu_dai    = rtd->cpu_dais[0];
	rtd->codec_dai	= rtd->codec_dais[0];

But, these can be replaced by dais.
This patch adds asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/875zevk5va.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent b2fc1c08
...@@ -1169,6 +1169,10 @@ struct snd_soc_pcm_runtime { ...@@ -1169,6 +1169,10 @@ struct snd_soc_pcm_runtime {
int num_components; int num_components;
struct snd_soc_component *components[0]; /* CPU/Codec/Platform */ struct snd_soc_component *components[0]; /* CPU/Codec/Platform */
}; };
/* see soc_new_pcm_runtime() */
#define asoc_rtd_to_cpu(rtd, n) (rtd)->dais[n]
#define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus]
#define for_each_rtd_components(rtd, i, component) \ #define for_each_rtd_components(rtd, i, component) \
for ((i) = 0; \ for ((i) = 0; \
((i) < rtd->num_components) && ((component) = rtd->components[i]);\ ((i) < rtd->num_components) && ((component) = rtd->components[i]);\
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment