From patchwork Mon Jan 18 15:26:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Mouiche X-Patchwork-Id: 8055451 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 48563BEEE5 for ; Mon, 18 Jan 2016 15:28:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A50B20489 for ; Mon, 18 Jan 2016 15:28:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EAF4D203E3 for ; Mon, 18 Jan 2016 15:28:08 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DA3612651C7; Mon, 18 Jan 2016 16:28:07 +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=-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 6AAD02652F1; Mon, 18 Jan 2016 16:27:08 +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 31C6A2652F5; Mon, 18 Jan 2016 16:27:07 +0100 (CET) Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by alsa0.perex.cz (Postfix) with ESMTP id 9F8FC261B32 for ; Mon, 18 Jan 2016 16:26:41 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id b14so128391287wmb.1 for ; Mon, 18 Jan 2016 07:26:41 -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=lwaSBufob3hsP+2VyEjEuKlYaJNNAmSCECc3C7B8ang=; b=sQPq3oY98P+a4zaimHvE5gH3ZKaqvM9Q2BoUAmX638Mf7p5V6ZT2nSmeRCl9VmZtOM iDd9g9owbUNGhVOVp3y9MKPGx4v9t6Dr9Dm/enVs+mN/EF6r6MCS4IaUopXQbq6jSsKS wHBD5ecb6il/1bS5qMdFMXcX3TEhGI+RQjXKTFVKyGgn5EfN317vr4oMZYAZMjE0n3Hs v+CB2DulpVd4GqhZ5vUBY/DmQKMVXYDXbhUSjCnR9gPPZTs3okhYlEbpsgqNpSLolzyq ybVvnFUm77SJuxRrN0MhvfOuk5qij8eKmySIU4ocmQ/5I4er/z/fWxH2XPnYSPqZmeO3 V19g== 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=lwaSBufob3hsP+2VyEjEuKlYaJNNAmSCECc3C7B8ang=; b=RIothGWVuoAngplwcGlEyo3kFQSuHP07q4DRWAPreyqI946kqu+lK4r1zniorkJPTa koQ5QWTCtSnx5zllngzg7T8ezMs1ukTO/uYkEQrBN7VPlK3Q/lD91/VzbxnJNe3iYJyX qOSeV7krg9KhrFvO46TRmiYwJR0N2xmzgDekudu/76CMXjed+V1ZSxL8LUivKMIf7IHr d+wItFk3nZqEX16Ia+d3uZasyaLzxqvxXrcgF5EH26sZ0pYdnqBUn4oGvvtmCH30cS2b rCd8g+oAB+ExDsaJkQMsJZr7PuJMAjXjzfe47PeMjncbuu/7hI0tRn8xjuTLIEDv4Uf+ GAOw== X-Gm-Message-State: AG10YOTueBlJNKKGgjevx9+mY5qQv8uh4DZATRJuh/bckI7XirpENeRGodEhjJv3cGIzVsBc X-Received: by 10.194.174.36 with SMTP id bp4mr10095794wjc.137.1453130801473; Mon, 18 Jan 2016 07:26:41 -0800 (PST) Received: from localhost.localdomain (AAnnecy-653-1-87-247.w90-41.abo.wanadoo.fr. [90.41.34.247]) by smtp.gmail.com with ESMTPSA id g3sm24306496wjw.31.2016.01.18.07.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jan 2016 07:26:40 -0800 (PST) From: Arnaud Mouiche To: Timur Tabi , Nicolin Chen , Xiubo Li , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, Caleb Crome Date: Mon, 18 Jan 2016 16:26:07 +0100 Message-Id: <1453130771-24419-3-git-send-email-arnaud.mouiche@invoxia.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453130771-24419-1-git-send-email-arnaud.mouiche@invoxia.com> References: <1453130771-24419-1-git-send-email-arnaud.mouiche@invoxia.com> Cc: Arnaud Mouiche Subject: [alsa-devel] [PATCH v3 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 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 cfc78b8..dbd5f10 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -679,6 +679,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 */ @@ -695,13 +704,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);