[PATCH] ASoC: simple-card-utils: care simple_util_dai for dummy DAI

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



Simple Card Utils has simple_util_dai which is paired to snd_soc_dai,
and assmus that CPU/Codec DAI and its paired simple_util_dai are same
order for CPU/Codec

	simple_util_dai[0] <--> snd_soc_dai[0]
	simple_util_dai[1] <--> snd_soc_dai[1]
	...

So, it is using same index in for_each loop.

(X) gets simple_util_dai
(Y) gets snd_soc_dai

(Y)	for_each_rtd_cpu_dais(.., i, ..) {
(X)(A)		udai = simple_props_to_dai_cpu(.., i);
	}

(X)	for_each_prop_dai_cpu(.., i, ...) {
(Y)		dai = snd_soc_rtd_to_cpu(.., i);
		...
	}

But current Simple Card Utils didn't have simple_util_dai for
dummy DAI. So above (A) will get NULL pointer in such case.
This patch cares simple_util_dai for dummy DAI.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
 sound/soc/generic/simple-card-utils.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index d47c372228b34..24b371f320663 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -858,6 +858,10 @@ int simple_util_init_aux_jacks(struct simple_util_priv *priv, char *prefix)
 }
 EXPORT_SYMBOL_GPL(simple_util_init_aux_jacks);
 
+static struct simple_util_dai dummy_util_dais = {
+	.name = "dummy_util_dais",
+};
+
 int simple_util_init_priv(struct simple_util_priv *priv,
 			  struct link_info *li)
 {
@@ -929,6 +933,7 @@ int simple_util_init_priv(struct simple_util_priv *priv,
 			dai_link[i].cpus	= &snd_soc_dummy_dlc;
 			dai_props[i].num.cpus	=
 			dai_link[i].num_cpus	= 1;
+			dai_props[i].cpu_dai	= &dummy_util_dais;
 		}
 
 		if (li->num[i].codecs) {
@@ -951,6 +956,7 @@ int simple_util_init_priv(struct simple_util_priv *priv,
 			dai_link[i].codecs	= &snd_soc_dummy_dlc;
 			dai_props[i].num.codecs	=
 			dai_link[i].num_codecs	= 1;
+			dai_props[i].codec_dai	= &dummy_util_dais;
 		}
 
 		if (li->num[i].platforms) {
-- 
2.43.0





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux