From patchwork Thu Nov 26 14:07:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 7707341 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 B2112BF90C for ; Thu, 26 Nov 2015 14:08:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B770D20790 for ; Thu, 26 Nov 2015 14:08:53 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8281A20649 for ; Thu, 26 Nov 2015 14:08:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1EF352667E4; Thu, 26 Nov 2015 15:08:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2C4D3262632; Thu, 26 Nov 2015 15:08:00 +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 3BBC6261A90; Thu, 26 Nov 2015 15:07:57 +0100 (CET) Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by alsa0.perex.cz (Postfix) with ESMTP id 27A5D261A8C for ; Thu, 26 Nov 2015 15:07:50 +0100 (CET) Received: by wmww144 with SMTP id w144so23957446wmw.0 for ; Thu, 26 Nov 2015 06:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invoxia-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0050gJNWjDN+tVXObTDIJrH2JdNlcvWgcWSFATOW9Yo=; b=rapsbPRSvOsuc+7oNXFaeC71i7y+Hn/yDGJURAsUMnNrKz0liDxxccMfC4Ppcn3Wf0 hlfca9PverB7y5tC0p0oqiERi3QxWgmJbiBA/JNWa+3OPqwFXq5asJSx+1rlQHewp8fD 33CyIODiXdfLD3yT+PFt8KeJsKftan/9VgsmwXpk7FVD311piwRPpoAjje8B9DsAwoAb s4NKozxfIf5nVxtD4Xu3sDZzNq7pQ8xCHtwlrStEP1QMk7ZXjVBUbkBT0dMamltf5LK8 hc9SQ3ipWuY8CoHjgG1tdHotYS3vW3lGSezOtZVpxXK5GxZAm7F+3xkNNzlfd4BzHdR7 m8lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0050gJNWjDN+tVXObTDIJrH2JdNlcvWgcWSFATOW9Yo=; b=EuhGDuhmnCkwJxd2LiMbjhVEqQeVard/VOKD3HLMV3GueyrhfsyRzEzieZ29QSKmR8 QR68sTE0OWSImDC+C1wk7CX6vUjXWmzh2D1wBYm8m+cI+5s5hKMgFVmhpH1U9uqnqac2 VOvwOLvZfz1HQFKQEBxiAA8RlEd6+bFn9AhsoW/XZNxXHQofwoHBPRr0FEnxZHTiGWeM fj37J38kNyxvRGuy4adFYJIypcGHVu3hpePVq4DejbuRq3PU/VhJbYG6dc+H2sXER4LN gGohsK6VcvTZ4hYjmL/nYSMJ3Y0butVBVoE3HabaVg4tyaaxctqGy6HM1MS4biEb5lVU 52Gw== X-Gm-Message-State: ALoCoQnGR4YXLahmU+RVcBMRumhb1+8QyMQINH1DOIYXJVomg+TKs2feAjOSqk5ohsxFKI3aeFp3 X-Received: by 10.28.86.196 with SMTP id k187mr3848597wmb.61.1448546869769; Thu, 26 Nov 2015 06:07:49 -0800 (PST) Received: from amolinux.invoxia.net ([94.228.188.198]) by smtp.gmail.com with ESMTPSA id v196sm2907777wmv.10.2015.11.26.06.07.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Nov 2015 06:07:48 -0800 (PST) From: Arnaud Mouiche To: Caleb Crome , Roberto Fichera , Markus Pargmann , Fabio Estevam , "shawn.guo@linaro.org" , alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com Date: Thu, 26 Nov 2015 15:07:18 +0100 Message-Id: <1448546842-4584-2-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448546842-4584-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1448546842-4584-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH 1/5] ASoC: fsl_ssi: The IPG/5 limitation concerns the bitclk, not the sysclk. 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 im6sl reference manual 47.7.4: " Bit clock - Used to serially clock the data bits in and out of the SSI port. This clock is either generated internally (from SSI's sys clock) or taken from external clock source (through the Tx/Rx clock ports). [...] Care should be taken to ensure that the bit clock frequency (either internally generated by dividing the SSI's sys clock or sourced from external device through Tx/Rx clock ports) is never greater than 1/5 of the ipg_clk (from CCM) frequency. " Since, in master mode, the sysclk is a multiple of bitclk, we can easily reach a high sysclk value, whereas keeping a reasonable bitclk. ex: 8ch x 16bit x 48kHz = 6144000, requires a 24576000 sysclk (PM=1) yet ipg_clk/5 = 66Mhz/5 = 13.2 Signed-off-by: Arnaud Mouiche --- sound/soc/fsl/fsl_ssi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 4e5d7db..b34c09f 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -595,6 +595,15 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, if (IS_ERR(ssi_private->baudclk)) return -EINVAL; + /* + * Hardware limitation: The bclk rate must be + * never greater than 1/5 IPG clock rate + */ + if (freq * 5 > clk_get_rate(ssi_private->clk)) { + dev_err(cpu_dai->dev, "bitclk > ipgclk/5\n"); + return -EINVAL; + } + baudclk_is_used = ssi_private->baudclk_streams & ~(BIT(substream->stream)); /* It should be already enough to divide clock by setting pm alone */ @@ -611,13 +620,6 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, else clkrate = clk_round_rate(ssi_private->baudclk, tmprate); - /* - * Hardware limitation: The bclk rate must be - * never greater than 1/5 IPG clock rate - */ - if (clkrate * 5 > clk_get_rate(ssi_private->clk)) - continue; - clkrate /= factor; afreq = clkrate / (i + 1);