ASoC: simple-card: use asoc_simple_card_parse_clk()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 19 Jul 2016 02:53:13 +0000 (02:53 +0000)
committerMark Brown <broonie@kernel.org>
Fri, 5 Aug 2016 11:31:37 +0000 (12:31 +0100)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/simple-card.c

index 43295f02498239ef0578168f281f2856e38f6b5a..b37c81b09203a94add45608e9324c3823f0bcbba 100644 (file)
@@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
                              int *args_count)
 {
        struct of_phandle_args args;
-       struct clk *clk;
-       u32 val;
        int ret;
 
        if (!np)
@@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
        if (ret)
                return ret;
 
-       /*
-        * Parse dai->sysclk come from "clocks = <&xxx>"
-        * (if system has common clock)
-        *  or "system-clock-frequency = <xxx>"
-        *  or device's module clock.
-        */
-       if (of_property_read_bool(np, "clocks")) {
-               clk = of_clk_get(np, 0);
-               if (IS_ERR(clk)) {
-                       ret = PTR_ERR(clk);
-                       return ret;
-               }
-
-               dai->sysclk = clk_get_rate(clk);
-               dai->clk = clk;
-       } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-               dai->sysclk = val;
-       } else {
-               clk = of_clk_get(args.np, 0);
-               if (!IS_ERR(clk))
-                       dai->sysclk = clk_get_rate(clk);
-       }
-
        return 0;
 }
 
@@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
        struct device *dev = simple_priv_to_dev(priv);
        struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
        struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+       struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
+       struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
        struct device_node *cpu = NULL;
        struct device_node *plat = NULL;
        struct device_node *codec = NULL;
@@ -370,6 +347,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
        if (ret < 0)
                goto dai_link_of_err;
 
+       ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+       if (ret < 0)
+               goto dai_link_of_err;
+
+       ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+       if (ret < 0)
+               goto dai_link_of_err;
+
        if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
                ret = -EINVAL;
                goto dai_link_of_err;