Re: [PATCH RFC v3 3/4] ASoC: Add multiple CPU DAI support in DAPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 1/16/20 2:26 PM, Bard liao wrote:
From: Shreyas NC <shreyas.nc@xxxxxxxxx>

DAPM handles DAIs during soc_dapm_stream_event() and during addition
and creation of DAI widgets i.e., dapm_add_valid_dai_widget() and
dapm_connect_dai_link_widgets().

Extend these functions to handle multiple cpu dai.

Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
Signed-off-by: Shreyas NC <shreyas.nc@xxxxxxxxx>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
---
  sound/soc/soc-dapm.c | 131 +++++++++++++++++++++++++------------------
  1 file changed, 75 insertions(+), 56 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 442846f12cd4..7a0538b45faf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -4274,16 +4274,15 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
  	return 0;
  }
-static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
-					  struct snd_soc_pcm_runtime *rtd)
+static void dapm_add_valid_dai_widget(struct snd_soc_card *card,
+				      struct snd_soc_pcm_runtime *rtd,
+				      struct snd_soc_dai *codec_dai,
+				      struct snd_soc_dai *cpu_dai)

[...]

+static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
+					  struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_dai *codec_dai;
+	int i;
+
+	if (rtd->num_cpus > 1) {
+		if (rtd->num_codecs == rtd->num_cpus)
+			for_each_rtd_codec_dai(rtd, i, codec_dai)
+				dapm_add_valid_dai_widget(card, rtd,
+							  codec_dai,
+							  rtd->cpu_dais[i]);
+		else
+			dev_err(card->dev,
+				"N cpus to M codecs link is not supported yet\n");
+	} else {
+		for_each_rtd_codec_dai(rtd, i, codec_dai)
+			dapm_add_valid_dai_widget(card, rtd,
+						  codec_dai, rtd->cpu_dais[0]);


I would suggest introducing the new helper in an earlier patch, then the addition of the multi-cpu-dai case would be a lot easier to review - and make sure there's no regression.

This patch is difficult to double-check with too many unrelated code moves due to the new helper.

  	}
  }
@@ -4417,9 +4434,11 @@ static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
  	int event)
  {
  	struct snd_soc_dai *codec_dai;
+	struct snd_soc_dai *cpu_dai;
  	int i;
- soc_dapm_dai_stream_event(rtd->cpu_dai, stream, event);
+	for_each_rtd_cpu_dai(rtd, i, cpu_dai)
+		soc_dapm_dai_stream_event(cpu_dai, stream, event);
  	for_each_rtd_codec_dai(rtd, i, codec_dai)
  		soc_dapm_dai_stream_event(codec_dai, stream, event);
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux