ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 20 Mar 2019 04:56:06 +0000 (13:56 +0900)
committerMark Brown <broonie@kernel.org>
Thu, 21 Mar 2019 14:52:11 +0000 (14:52 +0000)
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.

Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_be_hw_params_fixup() between in these
2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/simple_card_utils.h
sound/soc/generic/audio-graph-card.c
sound/soc/generic/simple-card-utils.c
sound/soc/generic/simple-card.c

index 204343789ae70145b0ac664fd25e6716dfa268a5..20d41bb14ea8b3a378ad4477e330db42100a487a 100644 (file)
@@ -89,6 +89,8 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream);
 int asoc_simple_hw_params(struct snd_pcm_substream *substream,
                          struct snd_pcm_hw_params *params);
 int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd);
+int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+                                  struct snd_pcm_hw_params *params);
 
 #define asoc_simple_card_parse_cpu(node, dai_link,                             \
                                   list_name, cells_name, is_single_link)       \
index b1ceefc608798b708678afa41a305ada110aae73..605126fb28108340307299f3db7ca3cfb64b2147 100644 (file)
@@ -62,17 +62,6 @@ static const struct snd_soc_ops graph_ops = {
        .hw_params      = asoc_simple_hw_params,
 };
 
-static int graph_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-                                   struct snd_pcm_hw_params *params)
-{
-       struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-       struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num);
-
-       asoc_simple_card_convert_fixup(&dai_props->adata, params);
-
-       return 0;
-}
-
 static void graph_parse_convert(struct device *dev,
                                struct device_node *ep,
                                struct asoc_simple_card_data *adata)
@@ -186,7 +175,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 
                /* BE settings */
                dai_link->no_pcm                = 1;
-               dai_link->be_hw_params_fixup    = graph_be_hw_params_fixup;
+               dai_link->be_hw_params_fixup    = asoc_simple_be_hw_params_fixup;
 
                dai =
                dai_props->codec_dai    = &priv->dais[li->dais++];
index c9b53b340028ed36877cce37134efbc9ae986109..ec4a010400a02d55875ae9eb9b5466694fceeae5 100644 (file)
@@ -293,6 +293,18 @@ err:
 }
 EXPORT_SYMBOL_GPL(asoc_simple_hw_params);
 
+int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+                                  struct snd_pcm_hw_params *params)
+{
+       struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+       struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num);
+
+       asoc_simple_card_convert_fixup(&dai_props->adata, params);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_be_hw_params_fixup);
+
 int asoc_simple_card_parse_dai(struct device_node *node,
                                    struct snd_soc_dai_link_component *dlc,
                                    struct device_node **dai_of_node,
index bf4482ecfe3e0cccb128d0bb0a74f61aa8b62e45..60a88a55c0710fe754909f372ba7fa7d842acd81 100644 (file)
@@ -32,17 +32,6 @@ static const struct snd_soc_ops simple_ops = {
        .hw_params      = asoc_simple_hw_params,
 };
 
-static int simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-                                    struct snd_pcm_hw_params *params)
-{
-       struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-       struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num);
-
-       asoc_simple_card_convert_fixup(&dai_props->adata, params);
-
-       return 0;
-}
-
 static void simple_parse_convert(struct device *dev,
                                 struct device_node *np,
                                 struct asoc_simple_card_data *adata)
@@ -154,7 +143,7 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 
                /* BE settings */
                dai_link->no_pcm                = 1;
-               dai_link->be_hw_params_fixup    = simple_be_hw_params_fixup;
+               dai_link->be_hw_params_fixup    = asoc_simple_be_hw_params_fixup;
 
                dai =
                dai_props->codec_dai    = &priv->dais[li->dais++];