Thread (1 message) 1 message, 1 author, 2013-02-05
DORMANTno replies

[PATCH 2/3] ASoC: add snd_soc_of_get_port_dai_name()

From: Kuninori Morimoto <hidden>
Date: 2013-02-05 10:11:17
Also in: alsa-devel
Subsystem: sound, sound - soc layer / dynamic audio power management (asoc), the rest · Maintainers: Jaroslav Kysela, Takashi Iwai, Liam Girdwood, Mark Brown, Linus Torvalds

Possibly related (same subject, not in this thread)

This patch adds snd_soc_of_get_port_dai_name() to get
dai name from device_node and port number.

Signed-off-by: Kuninori Morimoto <redacted>
---
 include/sound/soc.h  |    2 ++
 sound/soc/soc-core.c |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e227880..be3cdd6 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1171,6 +1171,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 				   const char *propname);
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 				     const char *prefix);
+const char *snd_soc_of_get_port_dai_name(struct device_node *of_node,
+					 int port);
 
 #include <sound/soc-dai.h>
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 63f2627..2cf3a94 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4286,6 +4286,24 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt);
 
+const char *snd_soc_of_get_port_dai_name(struct device_node *of_node, int port)
+{
+	struct snd_soc_dai *dai;
+	int i = 0;
+
+	list_for_each_entry(dai, &dai_list, list) {
+		if (dai->dev->of_node == of_node) {
+			if (port == i)
+				return dai->name;
+
+			i++;
+		}
+	}
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_of_get_port_dai_name);
+
 static int __init snd_soc_init(void)
 {
 #ifdef CONFIG_DEBUG_FS
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help