[alsa-devel] [PATCH 2/3] ASoC: add snd_soc_of_get_port_dai_name()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Feb 5 11:11:17 CET 2013
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 <kuninori.morimoto.gx at renesas.com>
---
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
More information about the Alsa-devel
mailing list