From patchwork Wed Feb 17 00:46:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 8333351 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2BE28C02AA for ; Wed, 17 Feb 2016 00:46:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C2E8202EC for ; Wed, 17 Feb 2016 00:46:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 221BC201F5 for ; Wed, 17 Feb 2016 00:46:34 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 10A1326664F; Wed, 17 Feb 2016 01:46:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2F3592657B8; Wed, 17 Feb 2016 01:46:20 +0100 (CET) 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 ABED026583F; Wed, 17 Feb 2016 01:46:18 +0100 (CET) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by alsa0.perex.cz (Postfix) with ESMTP id 8ECB9265794 for ; Wed, 17 Feb 2016 01:46:12 +0100 (CET) Received: by mail-pa0-f46.google.com with SMTP id fy10so876138pac.1 for ; Tue, 16 Feb 2016 16:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; bh=jn8J89DfEbwdLUTOf0xSgCYED3qph8MwzHz4z0Fts38=; b=Ym62PXKpb41g1s602gj6ySZbtivi1HIV+jG9/RCKFyMOhgwLfKAHgspLsLPjJ/sKAc 8bDZsNm/CA3Hfn/yA/fnXqZU0x8ifHnwBZz3ZIx7rO/Ts0Ixbm4LwS2SLfPjw6kbscDL Gf/E508oVsVzh8LMV6xS0keK8UGEU/RYtfajwpco47lGQwMNUlTK87v3pAtKCC/1BwFl EFbzop/mFOSM+w4FJ1CoGFFJL1Zbt4oTFVH/LopflIki0XeywV8eyuSLgJWZ4rK24Bb3 KHnF+bCJA7qQRtZX5mAWrZ7PcTOcDYdCqzL+0gGf1HbBBmOcfZ6jmHUoYSqqN4yilWCF 00sw== 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=jn8J89DfEbwdLUTOf0xSgCYED3qph8MwzHz4z0Fts38=; b=bZrITEVgBKBj2/uvQ++QwOcVkQo41joVJO3L8j3JFR5aP0CtF9k5rqDYNY9ZVkyy5s +vVnvCH4+u7juINlifQALU9zmb0T0WukTi8L+q99gh4MWpcvSScTnmD1YZ7/Z9RTCs4h QzFVKRQKe0gcam4qazdEMx3UJCfXTVpIRA+o1CQHow2Ofe5/VYoexW0kui66bVONcqEr Irjx0boklHxKoSVFhmWL/mvwtTZx66PB4xvQP1wYN7PmPnpnuQyl4EAykHSIGBYMwwhL jTD+STnkAV9paBSJjV3D7HH1rgnS8xsmWLvPdmBhaplP+DLHyiyGG41+8Mgpc8NTcKRs vafQ== X-Gm-Message-State: AG10YOQenIoDfTdk8hBo/8dR2VptIwCT+fhyStfmG+IWBoThNrGphq6BIcgiDz76nWmiJQ== X-Received: by 10.66.55.102 with SMTP id r6mr34723393pap.67.1455669971423; Tue, 16 Feb 2016 16:46:11 -0800 (PST) Received: from phoenix (1-161-45-195.dynamic.hinet.net. [1.161.45.195]) by smtp.gmail.com with ESMTPSA id li13sm26223150pab.6.2016.02.16.16.46.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 16 Feb 2016 16:46:09 -0800 (PST) Message-ID: <1455669967.6195.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Wed, 17 Feb 2016 08:46:07 +0800 X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Cc: alsa-devel@alsa-project.org, Liam Girdwood , anish kumar Subject: [alsa-devel] [PATCH RFT] ASoC: max98926: Fix blr_clk_ratio calculation 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 Current code calculates blr_clk_ratio before setting max98926->ch_size, fix it. Signed-off-by: Axel Lin Acked-by: anish kumar --- Hi Anish, I don't have this h/w, please review and test this patch. thanks, Axel sound/soc/codecs/max98926.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/max98926.c b/sound/soc/codecs/max98926.c index 66884ebd..5245e10 100644 --- a/sound/soc/codecs/max98926.c +++ b/sound/soc/codecs/max98926.c @@ -383,8 +383,7 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream, int rate = params_rate(params), i; struct snd_soc_codec *codec = dai->codec; struct max98926_priv *max98926 = snd_soc_codec_get_drvdata(codec); - /* BCLK/LRCLK ratio calculation */ - int blr_clk_ratio = params_channels(params) * max98926->ch_size; + int blr_clk_ratio; switch (params_format(params)) { case SNDRV_PCM_FORMAT_S16_LE: @@ -414,6 +413,9 @@ static int max98926_dai_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } + /* BCLK/LRCLK ratio calculation */ + blr_clk_ratio = params_channels(params) * max98926->ch_size; + switch (blr_clk_ratio) { case 32: regmap_update_bits(max98926->regmap,