Skip to contentSkip to conversation

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

PATCH Superseded Xiubo Li 2 participants 3 messages Jan 16, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xiubo Li

author
#0 lore raw

PATCH 1/1 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.

---
 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.
sound/soc/generic/simple-card new file +0 -0
new file mode 100644
index 0000000..e69de29
sound/soc/generic/simple-card. new file +0 -0
new file mode 100644
index 0000000..e69de29
sound/soc/generic/simple-card.c +6 -1
index 0e2fbdd..b40b57c 100644
@@ -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;
Signature · 1 line
1.8.4
#1 lore raw
Quoted 9 lines · Xiubo Li

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.

Quoted 8 lines
---
 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.

Probably not the intention to create these empty files.

#2 lore raw

Hi David,

Quoted 8 lines
Quoted 6 lines
 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.

Probably not the intention to create these empty files.

Yes, I have resent this patch.

Thanks very much,

Best Regards,