ASoC: soc-core: adjust for graph on snd_soc_of_parse_audio_prefix
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 11 Nov 2016 01:19:03 +0000 (01:19 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 11 Nov 2016 15:19:35 +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 6dffa9540a30cd4a5a5994cfb8b8a81342c7654b..346223b38e0de90e54d73aa97965c469fee12561 100644 (file)
@@ -1651,7 +1651,11 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
                              unsigned int *rx_mask,
                              unsigned int *slots,
                              unsigned int *slot_width);
-void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+#define snd_soc_of_parse_audio_prefix(card, codec_conf, of_node, propname) \
+       snd_soc_of_parse_audio_prefix_from_node(card, NULL, codec_conf, \
+                                               of_node, propname)
+void snd_soc_of_parse_audio_prefix_from_node(struct snd_soc_card *card,
+                                  struct device_node *np,
                                   struct snd_soc_codec_conf *codec_conf,
                                   struct device_node *of_node,
                                   const char *propname);
index 81b604151f268da2a47049642523ed5f3f206544..e4c90806fa102fae018ac641685a455f69f90789 100644 (file)
@@ -3595,15 +3595,18 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
 }
 EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot);
 
-void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
+void snd_soc_of_parse_audio_prefix_from_node(struct snd_soc_card *card,
+                                  struct device_node *np,
                                   struct snd_soc_codec_conf *codec_conf,
                                   struct device_node *of_node,
                                   const char *propname)
 {
-       struct device_node *np = card->dev->of_node;
        const char *str;
        int ret;
 
+       if (!np)
+               np = card->dev->of_node;
+
        ret = of_property_read_string(np, propname, &str);
        if (ret < 0) {
                /* no prefix is not error */
@@ -3613,7 +3616,7 @@ void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
        codec_conf->of_node     = of_node;
        codec_conf->name_prefix = str;
 }
-EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix);
+EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_prefix_from_node);
 
 int snd_soc_of_parse_audio_routing_from_node(struct snd_soc_card *card,
                                   struct device_node *np,