From patchwork Tue Jun 3 02:58:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 4284831 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 298A5BEEA7 for ; Tue, 3 Jun 2014 02:59:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 606F320254 for ; Tue, 3 Jun 2014 02:59:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 303162021F for ; Tue, 3 Jun 2014 02:59:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2950826559E; Tue, 3 Jun 2014 04:59:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4762026558E; Tue, 3 Jun 2014 04:59:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 069DD265591; Tue, 3 Jun 2014 04:59:16 +0200 (CEST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by alsa0.perex.cz (Postfix) with ESMTP id 291A8265594 for ; Tue, 3 Jun 2014 04:59:04 +0200 (CEST) Received: by mail-ve0-f176.google.com with SMTP id jz11so6173012veb.21 for ; Mon, 02 Jun 2014 19:59:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=j/osoIbv7HdXL2g27SEqrlJsWtSSmD/fQVldAZKyo6I=; b=OSncEjPrkFtdBST+tWmY9CEvuoTFDzAGEkiU9CbE0VjSrQCQuwFJ/q/t1QWT4M8xL7 eqFGG2r/CHSxAzZa3aiMYMZysKqiUYP019WAOBG7jBrZNkZRg/jl448bH4lRS8pe8oE8 e2Uo0eJOEsmfXchb36ddiUli5lhwzAkK/C+rhj13SHTP3YRWrQ8sXW00i1YYC0WgyI+g FRECWWEV0KJj69CSBr0iRhlmp0UTwKuCfBP/si1OhcxRqQ+ETCn6eiE7jbTocUtmDyNK nwszYKRMpRPczZkdT+9ShiPrWzjiyqY7A3KMxunH/LSHzNqYzyMEJKSx2cZM9gjmFsX9 gCsA== X-Gm-Message-State: ALoCoQlX49l9GVfKgp1KjhX+GbYBsaspV2WhFHjQ2FIQpKnDMNLi2n8TjDWNP1tkoeEi5XyphWvg X-Received: by 10.52.243.225 with SMTP id xb1mr5999983vdc.36.1401764343406; Mon, 02 Jun 2014 19:59:03 -0700 (PDT) Received: from [192.168.0.102] (218-164-129-98.dynamic.hinet.net. [218.164.129.98]) by mx.google.com with ESMTPSA id al1sm15880554vec.8.2014.06.02.19.59.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Jun 2014 19:59:02 -0700 (PDT) Message-ID: <1401764338.15216.3.camel@phoenix> From: Axel Lin To: Mark Brown Date: Tue, 03 Jun 2014 10:58:58 +0800 In-Reply-To: <1401764201.15216.0.camel@phoenix> References: <1401764201.15216.0.camel@phoenix> X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Cc: Oder Chiou , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH 3/3] ASoC: rt5677: Convert to use rl6231_calc_dmic_clk X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Axel Lin --- sound/soc/codecs/rt5677.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) 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");