From patchwork Thu Mar 5 05:05:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 5943401 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F4099F373 for ; Thu, 5 Mar 2015 05:05:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 89156202E5 for ; Thu, 5 Mar 2015 05:05:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 309B420173 for ; Thu, 5 Mar 2015 05:05:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7DA3C265200; Thu, 5 Mar 2015 06:05:34 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A821E26520E; Thu, 5 Mar 2015 06:05:23 +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 61D612652E5; Thu, 5 Mar 2015 06:05:19 +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 A2F23265200 for ; Thu, 5 Mar 2015 06:05:12 +0100 (CET) Received: by pabli10 with SMTP id li10so39493219pab.13 for ; Wed, 04 Mar 2015 21:05:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=oVyoBhZgrBuv5fo1g72UP6LjiZSPQxsToHwHSOGYYjo=; b=AXrPmK8C5/LvyRnmY43ORzer/VZUi26LNavzDO0XJDfSbMt3430GAup3eqYQoyIYv4 sb77rYv6yLwejRrtocLSETXppHDrK46tN2psaERVHdV5Vhv749XRBfSZOZbEMmZGWvbV /0bNPR9qXsgvuoJYtw1STwzJaGnYFksuMMOjwgKk14tdT3maTjj/1wR989bTqzUfC5Cf vMoXIoDQqXb8tp2/pZ10u7alvUjRLgDe+Xi2NGXgXbZECXOkDSa3EUL3BSYdM80Lg2Og CPgwNIKC+MxHQvlAlrdqcTskYv/nPS5JY+1fGo3ElsbD9MjnuxGe4U6Xy0WPTr/vdTjZ cqVQ== X-Received: by 10.66.186.5 with SMTP id fg5mr12493541pac.143.1425531911056; Wed, 04 Mar 2015 21:05:11 -0800 (PST) Received: from Asurada-CZ80.attlocal.net (99-189-113-45.lightspeed.sntcca.sbcglobal.net. [99.189.113.45]) by mx.google.com with ESMTPSA id ba12sm5642860pac.23.2015.03.04.21.05.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Mar 2015 21:05:10 -0800 (PST) From: Nicolin Chen To: broonie@kernel.org Date: Wed, 4 Mar 2015 21:05:04 -0800 Message-Id: <1425531904-3770-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, timur@tabi.org, tiwai@suse.de, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH] ASoC: fsl_ssi: Don't try to round-up for PM divisor 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP According to i.MX6 Series Reference Manual, the formula to calculate the sys clock is sysclk rate = bclk rate * (div2 + 1) * (7 * psr + 1) * (pm + 1) * 2 Commit aafa85e71a75 ("ASoC: fsl_ssi: Add DAI master mode support for SSI on i.MX series") added the divisor calculation which relies on the clk_round_rate(). However, at that time, clk_round_rate() didn't provide closest clock rates for some cases because it might not use a correct rounding policy. So using the original formula (pm + 1) for PM divisor was not able to give us a desired clock rate. And then we used (pm + 2) to do the trick. However, the clk-divider driver has been refined a lot since commit b11d282dbea2 ("clk: divider: fix rate calculation for fractional rates") Now using (pm + 2) trick would result an incorrect clock rate. So this patch fixes the problem by removing the useless trick. Reported-by: Stephane Cerveau Signed-off-by: Nicolin Chen --- sound/soc/fsl/fsl_ssi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 05575f4..6b0c8f7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -603,7 +603,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, factor = (div2 + 1) * (7 * psr + 1) * 2; for (i = 0; i < 255; i++) { - tmprate = freq * factor * (i + 2); + tmprate = freq * factor * (i + 1); if (baudclk_is_used) clkrate = clk_get_rate(ssi_private->baudclk);