ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_routing
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 11 Nov 2016 01:18:35 +0000 (01:18 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 11 Nov 2016 15:19:34 +0000 (15:19 +0000)
It is assuming that the card related information is located on
"card" node, but graph case doesn't have it.
This patch adds node parameter to adjust for graph support

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-core.c

index 4f1c784e44f634016153b3ff4f0a1b7d3b652b95..148bf553d59870f6768e5afa5c453e52fbf7d8c1 100644 (file)
@@ -1655,8 +1655,13 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
                                   struct snd_soc_codec_conf *codec_conf,
                                   struct device_node *of_node,
                                   const char *propname);
-int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
-                                  const char *propname);
+
+#define snd_soc_of_parse_audio_routing(card, propname) \
+       snd_soc_of_parse_audio_routing_from_node(card, NULL, propname)
+int snd_soc_of_parse_audio_routing_from_node(struct snd_soc_card *card,
+                                            struct device_node *np,
+                                            const char *propname);
+
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
                                     const char *prefix,
                                     struct device_node **bitclkmaster,
index c0bbcd9032613a78aef551ce697cabc792880bad..ec881b8825b6b6bf8dcddc3607c9860e840ace7d 100644 (file)
@@ -3615,14 +3615,17 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix);
 
-int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
+int snd_soc_of_parse_audio_routing_from_node(struct snd_soc_card *card,
+                                  struct device_node *np,
                                   const char *propname)
 {
-       struct device_node *np = card->dev->of_node;
        int num_routes;
        struct snd_soc_dapm_route *routes;
        int i, ret;
 
+       if (!np)
+               np = card->dev->of_node;
+
        num_routes = of_property_count_strings(np, propname);
        if (num_routes < 0 || num_routes & 1) {
                dev_err(card->dev,
@@ -3669,7 +3672,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing);
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing_from_node);
 
 unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
                                     const char *prefix,