]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: rsrc-card: use snd_soc_of_parse_audio_route/prefix for routing
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 15 Jul 2015 07:08:05 +0000 (07:08 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 16 Jul 2015 21:10:32 +0000 (22:10 +0100)
using common audio routing path method makes sense.
Let's use snd_soc_of_parse_audio_route/prefix.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
sound/soc/sh/rcar/rsrc-card.c

index c64155027288e20105f4741bc66de02951b7c1a3..962748a8d9194dee2101c681a80f18ed06825422 100644 (file)
@@ -6,6 +6,7 @@ Required properties:
 
 - compatible                           : "renesas,rsrc-card,<board>"
                                          Examples with soctypes are:
+                                           - "renesas,rsrc-card"
                                            - "renesas,rsrc-card,lager"
                                            - "renesas,rsrc-card,koelsch"
 Optional properties:
@@ -29,6 +30,12 @@ Optional subnode properties:
 - frame-inversion                      : bool property. Add this if the
                                          dai-link uses frame clock inversion.
 - convert-rate                         : platform specified sampling rate convert
+- audio-prefix                         : see audio-routing
+- audio-routing                                : A list of the connections between audio components.
+                                         Each entry is a pair of strings, the first being the connection's sink,
+                                         the second being the connection's source. Valid names for sources.
+                                         use audio-prefix if some components is using same sink/sources naming.
+                                         it can be used if compatible was "renesas,rsrc-card";
 
 Required CPU/CODEC subnodes properties:
 
index 84e935711e29e4424d560b3381b6357af6b84c00..d61db9c385eafd3bc6fca47edad10bff696b3ba2 100644 (file)
@@ -41,6 +41,7 @@ static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
 static const struct of_device_id rsrc_card_of_match[] = {
        { .compatible = "renesas,rsrc-card,lager",      .data = &routes_of_ssi0_ak4642 },
        { .compatible = "renesas,rsrc-card,koelsch",    .data = &routes_of_ssi0_ak4642 },
+       { .compatible = "renesas,rsrc-card", },
        {},
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
@@ -242,8 +243,15 @@ static int rsrc_card_parse_links(struct device_node *np,
                snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
 
                /* additional name prefix */
-               priv->codec_conf.of_node        = dai_link->codec_of_node;
-               priv->codec_conf.name_prefix    = of_data->prefix;
+               if (of_data) {
+                       priv->codec_conf.of_node = dai_link->codec_of_node;
+                       priv->codec_conf.name_prefix = of_data->prefix;
+               } else {
+                       snd_soc_of_parse_audio_prefix(&priv->snd_card,
+                                                     &priv->codec_conf,
+                                                     dai_link->codec_of_node,
+                                                     "audio-prefix");
+               }
 
                /* set dai_name */
                snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
@@ -361,8 +369,14 @@ static int rsrc_card_parse_of(struct device_node *node,
        priv->snd_card.num_links                = num;
        priv->snd_card.codec_conf               = &priv->codec_conf;
        priv->snd_card.num_configs              = 1;
-       priv->snd_card.of_dapm_routes           = of_data->routes;
-       priv->snd_card.num_of_dapm_routes       = of_data->num_routes;
+
+       if (of_data) {
+               priv->snd_card.of_dapm_routes           = of_data->routes;
+               priv->snd_card.num_of_dapm_routes       = of_data->num_routes;
+       } else {
+               snd_soc_of_parse_audio_routing(&priv->snd_card,
+                                              "audio-routing");
+       }
 
        /* Parse the card name from DT */
        snd_soc_of_parse_card_name(&priv->snd_card, "card-name");