ASoC: rsrc-card: move rsrc_card_parse_daifmt() to upper side
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 15 Jun 2015 06:23:30 +0000 (06:23 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 16 Jun 2015 11:34:02 +0000 (12:34 +0100)
This is prepare for DPCM cleanup

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>
sound/soc/sh/rcar/rsrc-card.c

index 8162b7d66c4d3e7688d9afb83d438851402180c8..d0d74b52eb1d30cd50d81a4abb5055ba58985696 100644 (file)
@@ -171,6 +171,41 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
        return 0;
 }
 
+static int rsrc_card_parse_daifmt(struct device_node *node,
+                                 struct rsrc_card_priv *priv,
+                                 struct device_node *codec,
+                                 int idx)
+{
+       struct device_node *bitclkmaster = NULL;
+       struct device_node *framemaster = NULL;
+       struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
+       struct rsrc_card_dai *cpu_dai = &dai_props->cpu_dai;
+       struct rsrc_card_dai *codec_dai = &dai_props->codec_dai;
+       unsigned int daifmt;
+
+       daifmt = snd_soc_of_parse_daifmt(node, NULL,
+                                        &bitclkmaster, &framemaster);
+       daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
+
+       if (!bitclkmaster && !framemaster)
+               return -EINVAL;
+
+       if (codec == bitclkmaster)
+               daifmt |= (codec == framemaster) ?
+                       SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
+       else
+               daifmt |= (codec == framemaster) ?
+                       SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
+
+       cpu_dai->fmt    = daifmt;
+       codec_dai->fmt  = daifmt;
+
+       of_node_put(bitclkmaster);
+       of_node_put(framemaster);
+
+       return 0;
+}
+
 static int
 rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
                       struct device_node *np,
@@ -266,41 +301,6 @@ rsrc_card_sub_parse_of(struct rsrc_card_priv *priv,
        return 0;
 }
 
-static int rsrc_card_parse_daifmt(struct device_node *node,
-                                 struct rsrc_card_priv *priv,
-                                 struct device_node *codec,
-                                 int idx)
-{
-       struct device_node *bitclkmaster = NULL;
-       struct device_node *framemaster = NULL;
-       struct rsrc_card_dai_props *dai_props = rsrc_priv_to_props(priv, idx);
-       struct rsrc_card_dai *cpu_dai = &dai_props->cpu_dai;
-       struct rsrc_card_dai *codec_dai = &dai_props->codec_dai;
-       unsigned int daifmt;
-
-       daifmt = snd_soc_of_parse_daifmt(node, NULL,
-                                        &bitclkmaster, &framemaster);
-       daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-       if (!bitclkmaster && !framemaster)
-               return -EINVAL;
-
-       if (codec == bitclkmaster)
-               daifmt |= (codec == framemaster) ?
-                       SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-       else
-               daifmt |= (codec == framemaster) ?
-                       SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-       cpu_dai->fmt    = daifmt;
-       codec_dai->fmt  = daifmt;
-
-       of_node_put(bitclkmaster);
-       of_node_put(framemaster);
-
-       return 0;
-}
-
 static int rsrc_card_dai_link_of(struct device_node *node,
                                 struct rsrc_card_priv *priv,
                                 int idx)