From patchwork Tue May 3 12:13:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 9003491 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 B66909F372 for ; Tue, 3 May 2016 13:01:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD59E20221 for ; Tue, 3 May 2016 13:01:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id ED220200DB for ; Tue, 3 May 2016 13:00:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF6D5265D7A; Tue, 3 May 2016 15:00:53 +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.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 E7C482660C4; Tue, 3 May 2016 14:44:46 +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 BE7862660C4; Tue, 3 May 2016 14:44:45 +0200 (CEST) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by alsa0.perex.cz (Postfix) with ESMTP id 4188D26655F for ; Tue, 3 May 2016 14:14:11 +0200 (CEST) Received: by mail-wm0-f51.google.com with SMTP id e201so143693153wme.0 for ; Tue, 03 May 2016 05:14:11 -0700 (PDT) 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=KGgynz1G7GKTHc6tVIHwcuwi+PEdBwqiklFq/bfpRE0=; b=b+tBya5ufD1I8qggBDSpKT0Leed68BnjtIrPyDv6NiEXIjkyK3AEnSDUAmjD1LRgRV Wu1ib7iA22IbDCe4KX2izuGC81y24MZwI1TlQiVENoXDSp0bOHkNpGEx1C5K8Whovgf7 qrgEUaczlibY+2X13fdTfErIwYnN6KCn17bqNFJ7xYGzAFkyr6iThv/HYlLS5tEtcg/G t3ohps7zLGf+bzy7Wr4t5x9hiGtUwwzZdhWEOv6jtkK8WBnkiwe8q3UVADjA+drTJ+SZ OfifNTyQA23ruL7UgTdYGhJ9q2qNLs9BwbMpGd0KHXoO5hcopuiuWSN3yUWiwr2TaKfX s5WA== 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=KGgynz1G7GKTHc6tVIHwcuwi+PEdBwqiklFq/bfpRE0=; b=EHohcmlxjDbMgBqRN3HYsuvDBNZSpXkH1lpvP1a9qCMkWwl+x4xNB6mTwVNmDfxgN9 ePMAV7q6QNGotixNhlQT13pSMzeMy6z/5HnJkbtmQh5gmFdyzwzPFZ3jbbf5YHpjuoWI IIJCT84QoJVWXevkb7h60dwtm3lecEUowdfsEtuakQfMuF8KgvuOp+qEcacDecgmvd12 PMJw7O0CTrny2Dga/1FMGm6cMf4F0hQWaypM8AkRHNYhJGYNv1cQ6l5eGteokMZNZp4k 5y/r7PzDDtOJFtUAedjdpP57ZoDhRE969iveg4ZiZq1ALjyMQ70ufZklojk5DkNOtpa/ QOAQ== X-Gm-Message-State: AOPr4FVBvVN37iekfcvWiFGBgZ5nfxRIO2Yx+GiR3vfrD4tpaOp4c5wmIV+8uXWSGT0/mtdN X-Received: by 10.28.37.129 with SMTP id l123mr19253145wml.1.1462277651066; Tue, 03 May 2016 05:14:11 -0700 (PDT) Received: from localhost.localdomain (AAnnecy-653-1-104-42.w90-41.abo.wanadoo.fr. [90.41.64.42]) by smtp.gmail.com with ESMTPSA id k133sm24323995wmg.7.2016.05.03.05.14.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 May 2016 05:14:10 -0700 (PDT) From: Arnaud Mouiche To: Timur Tabi , Nicolin Chen , Xiubo Li , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, festevam@gmail.com, caleb@crome.org Date: Tue, 3 May 2016 14:13:56 +0200 Message-Id: <1462277640-20052-3-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462277640-20052-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1462277640-20052-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH v4 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 Reviewed-by: Fabio Estevam Tested-by: Caleb Crome --- 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 472141f..1a9d0ad 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -671,6 +671,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 */ @@ -687,13 +696,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);