[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190916224905.GB12789@Asurada-Nvidia.nvidia.com>
Date: Mon, 16 Sep 2019 15:49:05 -0700
From: Nicolin Chen <nicoleotsuka@...il.com>
To: Daniel Baluta <daniel.baluta@....com>
Cc: broonie@...nel.org, timur@...nel.org, Xiubo.Lee@...il.com,
festevam@...il.com, lgirdwood@...il.com, perex@...ex.cz,
tiwai@...e.com, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, Mihai Serban <mihai.serban@....com>
Subject: Re: [PATCH v2 1/3] ASoC: fsl_sai: Fix noise when using EDMA
On Fri, Sep 13, 2019 at 10:28:05PM +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.
>
> Signed-off-by: Mihai Serban <mihai.serban@....com>
> Signed-off-by: Daniel Baluta <daniel.baluta@....com>
Acked-by: Nicolin Chen <nicoleotsuka@...il.com>
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
>
Powered by blists - more mailing lists