[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190906012438.GA17926@Asurada-Nvidia.nvidia.com>
Date: Thu, 5 Sep 2019 18:24:39 -0700
From: Nicolin Chen <nicoleotsuka@...il.com>
To: Daniel Baluta <daniel.baluta@....com>
Cc: broonie@...nel.org, festevam@...il.com, Xiubo.Lee@...il.com,
shengjiu.wang@....com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, timur@...nel.org,
mihai.serban@...il.com, Mihai Serban <mihai.serban@....com>,
NXP Linux Team <linux-imx@....com>
Subject: Re: [PATCH] ASoC: fsl_sai: Fix noise when using EDMA
On Fri, Aug 30, 2019 at 11:09:00PM +0300, Daniel Baluta wrote:
> From: Mihai Serban <mihai.serban@....com>
>
> 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.
>
> Cc: NXP Linux Team <linux-imx@....com>
> Signed-off-by: Mihai Serban <mihai.serban@....com>
> Signed-off-by: Daniel Baluta <daniel.baluta@....com>
> ---
> 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 728307acab90..fe126029f4e3 100644
> --- a/sound/soc/fsl/fsl_sai.c
> +++ b/sound/soc/fsl/fsl_sai.c
> @@ -612,6 +612,16 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
> FSL_SAI_CR3_TRCE_MASK,
> FSL_SAI_CR3_TRCE);
>
> + /*
> + * some DMA controllers need period size to be a multiple of
> + * tx/rx maxburst
> + */
> + if (sai->soc_data->use_constraint_period_size)
> + 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);
I feel that PERIOD_SIZE could be used for some other cases than
being related to maxburst....
> static const struct of_device_id fsl_sai_ids[] = {
> diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
> index b89b0ca26053..3a3f6f8e5595 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_constraint_period_size;
....so maybe the soc specific flag here could be something like
bool use_edma;
What do you think?
Powered by blists - more mailing lists