]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: rt5677: Convert to use rl6231_calc_dmic_clk
authorAxel Lin <axel.lin@ingics.com>
Tue, 3 Jun 2014 02:58:58 +0000 (10:58 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 16 Jun 2014 14:58:06 +0000 (15:58 +0100)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/rt5677.c

index 1ffc6891fcbc615e509fd30c1f88450f0d09cea7..45f99a824c1563e2beacfb8d045a011c0738fb15 100644 (file)
@@ -637,21 +637,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 {
        struct snd_soc_codec *codec = w->codec;
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
-       int div[] = {2, 3, 4, 6, 8, 12}, idx = -EINVAL, i;
-       int rate, red, bound, temp;
-
-       rate = rt5677->sysclk;
-       red = 3000000 * 12;
-       for (i = 0; i < ARRAY_SIZE(div); i++) {
-               bound = div[i] * 3000000;
-               if (rate > bound)
-                       continue;
-               temp = bound - rate;
-               if (temp < red) {
-                       red = temp;
-                       idx = i;
-               }
-       }
+       int idx = rl6231_calc_dmic_clk(rt5677->sysclk);
 
        if (idx < 0)
                dev_err(codec->dev, "Failed to set DMIC clock\n");