summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2016-07-11 23:59:16 +0000
committerMark Brown <broonie@kernel.org>2016-07-16 13:03:04 +0100
commitfc55c9b5a2ea794c4b6be937522bcfe98be4770a (patch)
tree6d1c00255504c1c256b9eaa3b876a0792dc5e713 /sound
parent2e8d1c7d544089fe4894c504020d7ac7eb1de531 (diff)
ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
simple-card needs to get its card name. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card-utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 48c73660b66a..d89a9a1b2471 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -75,3 +75,23 @@ int asoc_simple_card_set_dailink_name(struct device *dev,
return ret;
}
EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name);
+
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+ char *prefix)
+{
+ char prop[128];
+ int ret;
+
+ snprintf(prop, sizeof(prop), "%sname", prefix);
+
+ /* Parse the card name from DT */
+ ret = snd_soc_of_parse_card_name(card, prop);
+ if (ret < 0)
+ return ret;
+
+ if (!card->name && card->dai_link)
+ card->name = card->dai_link->name;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);