From patchwork Tue Jun 3 02:58:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 4284821 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D8E189F387 for ; Tue, 3 Jun 2014 02:58:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E22A20254 for ; Tue, 3 Jun 2014 02:58:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D4F622021F for ; Tue, 3 Jun 2014 02:58:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CCE8026559A; Tue, 3 Jun 2014 04:58:28 +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 BDDAE26558E; Tue, 3 Jun 2014 04:58:23 +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 3E86D265591; Tue, 3 Jun 2014 04:58:22 +0200 (CEST) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by alsa0.perex.cz (Postfix) with ESMTP id 1B361265582 for ; Tue, 3 Jun 2014 04:58:13 +0200 (CEST) Received: by mail-vc0-f175.google.com with SMTP id id10so6075045vcb.20 for ; Mon, 02 Jun 2014 19:58:13 -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=QyW9O22f/dGWEV7/kda9HH09Ccpa1JuIXSh7Yaa3rEo=; b=aTHeBCFIG+1pQTbLg67si/79YCefOtCSNqtJ0dEP8sjxCb9Vc5qTl5Tci6Pxc60ZyW lc371s6RdU3ERQWS8CLTEZ/TeOCp7y6XCrN+cE9l8Fk9LIHjSdgc0rc+mg4IMsvlqbhA g/RfbNgdizgRfzZQwIOg+1Sj0Y/2IS9rd14d3tLZKTDC87/BS2EDvSsx4gDs5VJSFzhc rsh/uE6uupw2y3D7VtgF0VVna/J54mp5Qy23HMKtJvDoQ9piBYIMg0hl5LMsjrRY3Oog CCxD4fik1ywymNu/j7FJCtTSwglYJIDO6RfxSaxVgnlsX4m7zI9xlR2V3vtmd6L9I1RT JGmA== X-Gm-Message-State: ALoCoQnvhj38V2p0lk7ReExV2KwXMarQ0fSwQSZBJphESBUQ5v2yBT7N+vlaccDQFb0wLMk9aQff X-Received: by 10.221.24.207 with SMTP id rf15mr33964193vcb.17.1401764293067; Mon, 02 Jun 2014 19:58:13 -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 z12sm26020948vdg.22.2014.06.02.19.58.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Jun 2014 19:58:12 -0700 (PDT) Message-ID: <1401764288.15216.2.camel@phoenix> From: Axel Lin To: Mark Brown Date: Tue, 03 Jun 2014 10:58:08 +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 2/3] ASoC: rt5677: Convert to use rl6231_get_clk_info 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/Kconfig | 2 ++ sound/soc/codecs/rt5677.c | 18 ++---------------- 2 files changed, 4 insertions(+), 16 deletions(-) { @@ -2822,7 +2808,7 @@ static int rt5677_hw_params(struct snd_pcm_substream *substream, int pre_div, bclk_ms, frame_size; rt5677->lrck[dai->id] = params_rate(params); - pre_div = get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); + pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); if (pre_div < 0) { dev_err(codec->dev, "Unsupported clock setting\n"); return -EINVAL; diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cbfa1e1..9d88845 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -445,9 +445,11 @@ config SND_SOC_RL6231 default y if SND_SOC_RT5640=y default y if SND_SOC_RT5645=y default y if SND_SOC_RT5651=y + default y if SND_SOC_RT5677=y default m if SND_SOC_RT5640=m default m if SND_SOC_RT5645=m default m if SND_SOC_RT5651=m + default m if SND_SOC_RT5677=m config SND_SOC_RT5631 tristate diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 60fff7f..1ffc689 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@ -27,6 +27,7 @@ #include #include +#include "rl6231.h" #include "rt5677.h" #define RT5677_DEVICE_ID 0x6327 @@ -2798,21 +2799,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { { "PDM2R", NULL, "PDM2 R Mux" }, }; -static int get_clk_info(int sclk, int rate) -{ - int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16}; - - if (sclk <= 0 || rate <= 0) - return -EINVAL; - - rate = rate << 8; - for (i = 0; i < ARRAY_SIZE(pd); i++) - if (sclk == rate * pd[i]) - return i; - - return -EINVAL; -} - static int rt5677_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)