summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-06-15 00:25:02 +0000
committerMark Brown <broonie@kernel.org>2017-06-15 18:14:57 +0100
commit3296d07826ebc698113832acb426f037e9b3b253 (patch)
treee2be7fe1af7b699ab203c122656863ae4080dafb /sound
parentc564a5b18710f76da222ad9f14a4c0ebc2c4c74c (diff)
downloadtalos-obmc-linux-3296d07826ebc698113832acb426f037e9b3b253.tar.gz
talos-obmc-linux-3296d07826ebc698113832acb426f037e9b3b253.zip
ASoC: simple-card-utils: add asoc_simple_card_of_parse_routing()
Current simple card drivers are parsing routing on each own driver. Encapsulation is one of simple card util's purpose. Let's add asoc_simple_card_of_parse_routing for it. 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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 948a18842e64..a2b6d95bc2f9 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -375,6 +375,28 @@ int asoc_simple_card_clean_reference(struct snd_soc_card *card)
}
EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);
+int asoc_simple_card_of_parse_routing(struct snd_soc_card *card,
+ char *prefix,
+ int optional)
+{
+ struct device_node *node = card->dev->of_node;
+ char prop[128];
+
+ if (!prefix)
+ prefix = "";
+
+ snprintf(prop, sizeof(prop), "%s%s", prefix, "routing");
+
+ if (!of_property_read_bool(node, prop)) {
+ if (optional)
+ return 0;
+ return -EINVAL;
+ }
+
+ return snd_soc_of_parse_audio_routing(card, prop);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_routing);
+
/* Module information */
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
OpenPOWER on IntegriCloud