diff mbox

[3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk

Message ID 1401764338.15216.3.camel@phoenix (mailing list archive)
State Accepted
Commit 9a53581efabec8d9c69933c360e2ab036a1da9bc
Headers show

Commit Message

Axel Lin June 3, 2014, 2:58 a.m. UTC
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 sound/soc/codecs/rt5677.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

Comments

Mark Brown June 9, 2014, 8:16 p.m. UTC | #1
On Tue, Jun 03, 2014 at 10:58:58AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 1ffc689..45f99a8 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");