From patchwork Tue Jun 10 00:57:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 4325911 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 3E66BBEEAA for ; Tue, 10 Jun 2014 00:58:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7713A2018E for ; Tue, 10 Jun 2014 00:58:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 46E1B2015A for ; Tue, 10 Jun 2014 00:58:08 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2765926517C; Tue, 10 Jun 2014 02:58:06 +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 6D4B6265193; Tue, 10 Jun 2014 02:57:55 +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 DADB32651AD; Tue, 10 Jun 2014 02:57:53 +0200 (CEST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by alsa0.perex.cz (Postfix) with ESMTP id 591E626517C for ; Tue, 10 Jun 2014 02:57:43 +0200 (CEST) Received: by mail-pa0-f51.google.com with SMTP id ey11so77805pad.24 for ; Mon, 09 Jun 2014 17:57:41 -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:content-type :mime-version:content-transfer-encoding; bh=ZBkOImmM/le4mWYHg7sfqXogKTfOKCRr7huVNZLRhzU=; b=GmWYXg8oTUY6gn8fIKAootSEMI6mIv2TBQ4z5OfDSJY+cvlQeRp3KCwSk743TFB3DP GMEtv2HDRnxFVXLYt0cGnLgIPQMBrqi/tCB+GJNAYlvnEe0ej5Yrr3XLl6BD8VlRTZOv iIC3CoWlzYvzmpIfaYGWY/Qi/LuZXE68CWzHwHTtYOwi1UB3JJoPRQK5mWFUEwyzelRH Ku64wkNR9+VqqZPeLm6cMlzKI2ugFiuJ1zUj9jiVFlwg0z1JV2Q1UBxcOgbN7mT1JgY5 q5ul+0bAfwRquWEAKT/xUACUy5ZWU2WyAJ2l7wmD9L9CPIZT6Kog4L9SEMYiE/R7E5rx Co/g== X-Gm-Message-State: ALoCoQn7psAY4/SOlk3BseFzVBRdixiX7fkkVYYbJG3LIFz22InApC5njUrvAjdTcDkgWjDIfZEu X-Received: by 10.66.141.76 with SMTP id rm12mr1881960pab.138.1402361861653; Mon, 09 Jun 2014 17:57:41 -0700 (PDT) Received: from [192.168.1.112] (111-240-58-131.dynamic.hinet.net. [111.240.58.131]) by mx.google.com with ESMTPSA id om6sm66190309pbc.43.2014.06.09.17.57.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 17:57:40 -0700 (PDT) Message-ID: <1402361856.4636.0.camel@phoenix> From: Axel Lin To: Mark Brown Date: Tue, 10 Jun 2014 08:57:36 +0800 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 RESEND] 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 Tested-by: Oder Chiou --- sound/soc/codecs/Kconfig | 2 ++ sound/soc/codecs/rt5677.c | 18 ++---------------- 2 files changed, 4 insertions(+), 16 deletions(-) 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) { @@ -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;