From patchwork Thu Nov 26 15:05:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 7707471 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 611D5C05CC for ; Thu, 26 Nov 2015 15:07:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F55320557 for ; Thu, 26 Nov 2015 15:07:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D8A8C20570 for ; Thu, 26 Nov 2015 15:07:18 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 05EF22667E1; Thu, 26 Nov 2015 16:07:18 +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, NO_DNS_FOR_FROM,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 0EB46261A5E; Thu, 26 Nov 2015 16:06:21 +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 B8465265005; Thu, 26 Nov 2015 16:06:19 +0100 (CET) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by alsa0.perex.cz (Postfix) with ESMTP id 9BD8B261A0A for ; Thu, 26 Nov 2015 16:06:11 +0100 (CET) Received: by wmvv187 with SMTP id v187so35375516wmv.1 for ; Thu, 26 Nov 2015 07:06:11 -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=VA1OXawPCnXEdUkwLSxQMAwT0+qMXQf7iDi8AC/7fNz3WhKKdhP3X2gcbI8FPjPAg/ IygjxjI3k6/HmKx3LuV9Cdt6uRRXv+L7iGVkpiR5iqVJR+JDdFRQFNkn+9qlW/qjFuoI llyxyR3Y2Jtxezr+M2o+Ujb7lG3GxTBg/426WoAIFtc07VEJFRIJ/ELOXKtdG4cAn5q7 lLx3GmqhkVh+qS1NlBT3AO6aIciYUk9B0ssMECo6LA8zQWFG+ZQ4CmQjHKZ4E98MaI/0 h/HrfdYtsLV5cy7h9giOZvtKiWLMA8Qu3bQZzvO+0CTX139Yrp2dJGuQANTRiSqHwrzV TLvg== 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=b4LkCFm7a1BjKqHf1FibPCAo5bv/2pSvtDibhhj99CbCJWdo37tsQEKRKCf8HALSJC BIqngtgE34LhU5oiEGPlB4lnRyoriGMHFgafwHqVDrRH5LqLTNHtDaG0MPZ1gT1XqJsF djP2TA8DETh3w8ab0sLYeRvdjtdlcB/qwszFwFn/TzwYW3XxVMtVSg1dLmNRWQpt+PFu 0U6jyZ64ioJFpi5V0Z08lu0dBwgzZCGMTXOF7ibORqvcVJipoUxKmJ3GQbLCJjnRV5o5 8iJUWYdyYl3AIakIW/sFWi9Q2YWpG9AssO1xR/imzkekMNQsiCeufWKJCKaSPPRSYtAl CnKA== X-Gm-Message-State: ALoCoQk57GFoqEFmNq6FSY6dyCxCCu6Xz5o6+JzBFP3TJwdLZd4xTg9qx89BX2qOT/S5dng/x94p X-Received: by 10.28.173.131 with SMTP id w125mr4471963wme.41.1448550371353; Thu, 26 Nov 2015 07:06:11 -0800 (PST) Received: from amolinux.invoxia.net ([94.228.188.198]) by smtp.gmail.com with ESMTPSA id gl4sm1079618wjd.17.2015.11.26.07.06.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Nov 2015 07:06:10 -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 16:05:37 +0100 Message-Id: <1448550341-11765-3-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448550341-11765-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1448550341-11765-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH v2 2/6] 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);