]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: simple-card: Add snd_card's name parsing from DT node support
authorXiubo Li <Li.Xiubo@freescale.com>
Fri, 24 Jan 2014 07:43:02 +0000 (15:43 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 3 Feb 2014 12:45:34 +0000 (12:45 +0000)
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: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/generic/simple-card.c

index 65833feb995f63a2d9cc8417bc7b565d241236b4..0890fcdc9251528e40087872d6584254749a62f6 100644 (file)
@@ -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,7 +190,8 @@ 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);
-       priv->snd_card.name = name;
+       if (!priv->snd_card.name)
+               priv->snd_card.name = name;
        dai_link->name = dai_link->stream_name = name;
 
        /* simple-card assumes platform == cpu */