mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: <kuninori.morimoto.gx@renesas.com>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH] ASoC: simple-card: Add snd_card's name parsing from DT node support
Date: Thu, 16 Jan 2014 12:00:01 +0800	[thread overview]
Message-ID: <1389844801-29309-1-git-send-email-Li.Xiubo@freescale.com> (raw)

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>
---
 sound/soc/generic/simple-card   | 0
 sound/soc/generic/simple-card.  | 0
 sound/soc/generic/simple-card.c | 7 ++++++-
 3 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 sound/soc/generic/simple-card
 create mode 100644 sound/soc/generic/simple-card.

diff --git a/sound/soc/generic/simple-card b/sound/soc/generic/simple-card
new file mode 100644
index 0000000..e69de29
diff --git a/sound/soc/generic/simple-card. b/sound/soc/generic/simple-card.
new file mode 100644
index 0000000..e69de29
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 0e2fbdd..b40b57c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -143,6 +143,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			return ret;
 	}
 
+	/* parsing the card name from DT */
+	snd_soc_of_parse_card_name(&info->snd_card,
+					"simple-audio-card,name");
+
 	/* CPU sub-node */
 	ret = -EINVAL;
 	np = of_get_child_by_name(node, "simple-audio-card,cpu");
@@ -257,7 +261,8 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	/*
 	 * init snd_soc_card
 	 */
-	cinfo->snd_card.name		= cinfo->card;
+	if (!cinfo->snd_card.name)
+		cinfo->snd_card.name = cinfo->card;
 	cinfo->snd_card.owner		= THIS_MODULE;
 	cinfo->snd_card.dai_link	= &cinfo->snd_link;
 	cinfo->snd_card.num_links	= 1;
-- 
1.8.4



             reply	other threads:[~2014-01-16  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16  4:00 Xiubo Li [this message]
2014-01-16  5:03 ` David Rientjes
2014-01-16  8:16   ` Li.Xiubo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389844801-29309-1-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®