From: Axel Lin Date: Tue, 3 Jun 2014 02:58:58 +0000 (+0800) Subject: ASoC: rt5677: Convert to use rl6231_calc_dmic_clk X-Git-Tag: v3.17-rc1~101^2~5^2~4^3~8 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9a53581efabec8d9c69933c360e2ab036a1da9bc;p=karo-tx-linux.git ASoC: rt5677: Convert to use rl6231_calc_dmic_clk Signed-off-by: Axel Lin Tested-by: Oder Chiou Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 1ffc6891fcbc..45f99a824c15 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -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");