diff mbox series

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

Message ID 20230901144550.520072-6-elinor.montmasson@savoirfairelinux.com (mailing list archive)
State New, archived
Headers show
Series [01/10] ASoC: fsl-asoc-card: add new compatible for dummy codec | expand

Commit Message

Elinor Montmasson Sept. 1, 2023, 2:45 p.m. UTC
From: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>

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@savoirfairelinux.com>
Co-authored-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
---
 sound/soc/fsl/fsl-asoc-card.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
diff mbox series

Patch

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");