[PATCH 05/10] ASoC: fsl-asoc-card: add new DAPM audio map for asrc

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

 



From: Elinor Montmasson <elinor.montmasson@xxxxxxxxxxxxxxxxxxxx>

Add the new DAPM audio map audio_map_asrc used with the dummy codec.
The dummy codec doesn't have any Playback or Capture DAPM widgets. DAPM
default audio maps are thus unused with it. However, when using the
ASRC, DAPM routes between CPU DAI and ASRC are still required.
The driver must then handle this use case.

Signed-off-by: Elinor Montmasson <elinor.montmasson@xxxxxxxxxxxxxxxxxxxx>
Co-authored-by: Philip-Dylan Gleonec <philip-dylan.gleonec@xxxxxxxxxxxxxxxxxxxx>
---
 sound/soc/fsl/fsl-asoc-card.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 5ef26ae512de..d8f4412be308 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -148,6 +148,13 @@ static const struct snd_soc_dapm_route audio_map_rx[] = {
 	{"ASRC-Capture",  NULL, "CPU-Capture"},
 };
 
+
+static const struct snd_soc_dapm_route audio_map_asrc[] = {
+	{"CPU-Playback",  NULL, "ASRC-Playback"},
+	{"ASRC-Capture",  NULL, "CPU-Capture"},
+};
+
+
 /* Add all possible widgets into here without being redundant */
 static const struct snd_soc_dapm_widget fsl_asoc_card_dapm_widgets[] = {
 	SND_SOC_DAPM_LINE("Line Out Jack", NULL),
@@ -803,6 +810,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 	/* Drop the second half of DAPM routes -- ASRC */
 	if (!asrc_pdev)
 		priv->card.num_dapm_routes /= 2;
+	else if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) {
+		/* Dummy codec doesn't provide Playback and Capture widgets */
+		priv->card.dapm_routes = audio_map_asrc;
+		priv->card.num_dapm_routes = 2;
+	}
 
 	if (of_property_read_bool(np, "audio-routing")) {
 		ret = snd_soc_of_parse_audio_routing(&priv->card, "audio-routing");
-- 
2.25.1




[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