Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4644701ybe; Mon, 16 Sep 2019 16:09:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCrR2NgJer3NjE00luyQSrxxTtBgr6e5nzvuJTyiB4OeDEfEPkhDDyyVunujNJOKoSS/cy X-Received: by 2002:aa7:ce89:: with SMTP id y9mr1682172edv.255.1568675391397; Mon, 16 Sep 2019 16:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568675391; cv=none; d=google.com; s=arc-20160816; b=AXeRRFaLqNiDe59dpm1gEhSrAN2JYi3ZKEOyNA2VEoox3pQhUxChGEZ74u1WJoCmUn pjvgIyAIUBuHX+OohVDfKYBEFfQOIkh6F4x+z8MBSrZk90cLkxoCcDscipvSYv85rPMJ BoeqrV5+5T2zMrjO2xyLUDSIJ7e93khFfRfPV3XvzupvKhLxb9mrxtg6BiWAstsbj1jK mzWtMgaNMTzsptQg2HVuFEQxQi0zv3m+7JCT8hRi8L4rNnL1WjubQwPVWEqEG93oxvcD M6mh+vPa7UCMvmGKoaVCWbIA2QJJXBpb/xrJStMTgsZyDKYZCZeeZ8UMnmJuETB1ghQM VEaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kENGSqKmUqPPdpHJ6m4GwChtS1EbaBEMgzUsVpqeX1U=; b=ksPR9fp6crhjGS0PI5wWxshO2aX6cgVt0yUP6z3SjuSPOANL4n3DGnVTJ25ZGiBDtR R+KMVhH7aaFHM/HqAfXfkvxXyyTaysgTF0mcJTtCOlQGXqyzrj8BxNzyjndz2hQ6ATUe wby5UFp0mkz8qP+DKJ+eKJAjQp/9wCpdBpvK/CQL+isR4SP5ngKfoq4jzowPfvONDj0x 7d365eQ8xWOkZq3B8c6Y4L6HvYnbhcxOiXZLaShctLnN0HUYNyOgyV5TFVI7o35Xhy0g A53pspCGA/WmjeYPephq1E6psk936W6t5QNy7/pGdfVPdk5rAoUuhhy3ecmDMRbeJp3A 373w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KYTlY74K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si290067edu.405.2019.09.16.16.09.28; Mon, 16 Sep 2019 16:09:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KYTlY74K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728433AbfIPWtZ (ORCPT + 99 others); Mon, 16 Sep 2019 18:49:25 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44887 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726968AbfIPWtZ (ORCPT ); Mon, 16 Sep 2019 18:49:25 -0400 Received: by mail-pg1-f196.google.com with SMTP id i18so803875pgl.11 for ; Mon, 16 Sep 2019 15:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kENGSqKmUqPPdpHJ6m4GwChtS1EbaBEMgzUsVpqeX1U=; b=KYTlY74KGSWbho4hQT1Kz82jdfOZ08vd1IhAQfCPuEcB4xZTP3z/C9rAnkmFp1JoAo gedBCFiDQTnXsZgbXrBCiGGdkSJFfPq+XWVE54HBL8CTVR0AEkyFd/QTUPKZVNXBe9Fd QcFCPfmbvXIuaqCeeDI/lnLsMwthaUuTCxCLyK+MoF8FOWi0NgdgQtB9UJ9rzf9SBd8p Zl8rVKIOO7ORISi5P5uJ/ZtceGBrc7H8r7zT2AwfU2IgYkhh59k19jRWxDduIOeZJmyu v/pqhBQ1+LnLnNNNo4JhWPg/zHc+OBwamLbmzEuVnMjQNwp/xio4ydA3yBFeSRplafn8 6YEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kENGSqKmUqPPdpHJ6m4GwChtS1EbaBEMgzUsVpqeX1U=; b=TDjad5mHjY4ceZpZDkSCNY1fsIbJ9NDQ+P6FlTtU5nBLHLQHzAYfP1QUH/FzWY0aqK lDXOmQeFmQxGDi6tawgIbdl+oxe9/EOx8yuSDJC33sVZarpDG1Mn4bUpAm+EaDZkcPpi W+7WaGn7aeLU+B1mtfAj2rnfxSYD1sJjV2TpBqdbDxqIkd82qDC5d3YiMB8s1Hac6nsi BuSZMcqYTV7+HMJS1v9+XEiwaTO34ZSp0qCW+jLdP7NpdZvr/gssC3Fy3YrMChJtvH/d i8ok0dtoQXVM3rVit3GOSbtH9Tuts07SNN0Thwv42kr12txWL2trgbZIUJqG14fIH/J5 wQPg== X-Gm-Message-State: APjAAAUXwrPJAXHhNkY7Yl3xusFfY8rHoiZ84vKmnad8mhgLTuN0XSXp 0an7q54vDXkq86Xt8gXQ7BE= X-Received: by 2002:a62:1b85:: with SMTP id b127mr813216pfb.56.1568674164260; Mon, 16 Sep 2019 15:49:24 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id l23sm118212pgj.53.2019.09.16.15.49.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Sep 2019 15:49:24 -0700 (PDT) Date: Mon, 16 Sep 2019 15:49:05 -0700 From: Nicolin Chen To: Daniel Baluta Cc: broonie@kernel.org, timur@kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Mihai Serban Subject: Re: [PATCH v2 1/3] ASoC: fsl_sai: Fix noise when using EDMA Message-ID: <20190916224905.GB12789@Asurada-Nvidia.nvidia.com> References: <20190913192807.8423-1-daniel.baluta@nxp.com> <20190913192807.8423-2-daniel.baluta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190913192807.8423-2-daniel.baluta@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 13, 2019 at 10:28:05PM +0300, Daniel Baluta wrote: > From: Mihai Serban > > EDMA requires the period size to be multiple of maxburst. Otherwise the > remaining bytes are not transferred and thus noise is produced. > > We can handle this issue by adding a constraint on > SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value. > > Signed-off-by: Mihai Serban > Signed-off-by: Daniel Baluta Acked-by: Nicolin Chen Thanks > --- > Changes since v1: > * rename variable to use_edma as per Nicolin's suggestion. > > sound/soc/fsl/fsl_sai.c | 15 +++++++++++++++ > sound/soc/fsl/fsl_sai.h | 1 + > 2 files changed, 16 insertions(+) > > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c > index ef0b74693093..b517e4bc1b87 100644 > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -628,6 +628,16 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream, > FSL_SAI_CR3_TRCE_MASK, > FSL_SAI_CR3_TRCE); > > + /* > + * EDMA controller needs period size to be a multiple of > + * tx/rx maxburst > + */ > + if (sai->soc_data->use_edma) > + snd_pcm_hw_constraint_step(substream->runtime, 0, > + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, > + tx ? sai->dma_params_tx.maxburst : > + sai->dma_params_rx.maxburst); > + > ret = snd_pcm_hw_constraint_list(substream->runtime, 0, > SNDRV_PCM_HW_PARAM_RATE, &fsl_sai_rate_constraints); > > @@ -1026,30 +1036,35 @@ static int fsl_sai_remove(struct platform_device *pdev) > > static const struct fsl_sai_soc_data fsl_sai_vf610_data = { > .use_imx_pcm = false, > + .use_edma = false, > .fifo_depth = 32, > .reg_offset = 0, > }; > > static const struct fsl_sai_soc_data fsl_sai_imx6sx_data = { > .use_imx_pcm = true, > + .use_edma = false, > .fifo_depth = 32, > .reg_offset = 0, > }; > > static const struct fsl_sai_soc_data fsl_sai_imx7ulp_data = { > .use_imx_pcm = true, > + .use_edma = false, > .fifo_depth = 16, > .reg_offset = 8, > }; > > static const struct fsl_sai_soc_data fsl_sai_imx8mq_data = { > .use_imx_pcm = true, > + .use_edma = false, > .fifo_depth = 128, > .reg_offset = 8, > }; > > static const struct fsl_sai_soc_data fsl_sai_imx8qm_data = { > .use_imx_pcm = true, > + .use_edma = true, > .fifo_depth = 64, > .reg_offset = 0, > }; > diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h > index b12cb578f6d0..76b15deea80c 100644 > --- a/sound/soc/fsl/fsl_sai.h > +++ b/sound/soc/fsl/fsl_sai.h > @@ -157,6 +157,7 @@ > > struct fsl_sai_soc_data { > bool use_imx_pcm; > + bool use_edma; > unsigned int fifo_depth; > unsigned int reg_offset; > }; > -- > 2.17.1 >