Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2772555b authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown
Browse files

ASoC: simple-card: Add snd_card's name parsing from DT node support



If the DT is used and the CPU DAI device has only one DAI, the card
name will be like :

ALSA device list:
0: 40031000.sai-sgtl5000

And this name maybe a little ugly to some customers, so here the
card name parsing from DT node is supported.

Signed-off-by: default avatarXiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 30d0341e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -143,6 +143,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
	char *name;
	int ret;

	/* parsing the card name from DT */
	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");

	/* get CPU/CODEC common format via simple-audio-card,format */
	priv->daifmt = snd_soc_of_parse_daifmt(node, "simple-audio-card,") &
		(SND_SOC_DAIFMT_FORMAT_MASK | SND_SOC_DAIFMT_INV_MASK);
@@ -187,6 +190,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
			    GFP_KERNEL);
	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
				dai_link->codec_dai_name);
	if (!priv->snd_card.name)
		priv->snd_card.name = name;
	dai_link->name = dai_link->stream_name = name;