alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Timur Tabi <timur@kernel.org>, Xiubo Li <Xiubo.Lee@gmail.com>,
	Fabio Estevam <festevam@gmail.com>,
	"S.j. Wang" <shengjiu.wang@nxp.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>,
	NXP Linux Team <linux-imx@nxp.com>,
	Mihai Serban <mihai.serban@nxp.com>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	Mihai Serban <mihai.serban@gmail.com>
Subject: Re: [alsa-devel] [PATCH] ASoC: fsl_sai: Fix noise when using EDMA
Date: Mon, 9 Sep 2019 12:32:38 -0700	[thread overview]
Message-ID: <20190909193238.GA10344@Asurada-Nvidia.nvidia.com> (raw)
In-Reply-To: <CAEnQRZBTc=beU7CX747RsM7KEsJethfZ0fPv=CkLQ1e3ofHMkA@mail.gmail.com>

On Fri, Sep 06, 2019 at 09:46:12AM +0300, Daniel Baluta wrote:
> On Fri, Sep 6, 2019 at 4:25 AM Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> >
> > On Fri, Aug 30, 2019 at 11:09:00PM +0300, Daniel Baluta wrote:
> > > From: Mihai Serban <mihai.serban@nxp.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@nxp.com>
> > > Signed-off-by: Mihai Serban <mihai.serban@nxp.com>
> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.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?
> 
> I think your suggestion is a little bit better than what we have. But what if

The better part of using "edma" word, I felt, is to match this
"soc" word in the structure name.

> in the future another DMA controler (not eDMA) will need the same constraint.

That sounds like a valid point to me, I don't feel it'd happen
that often though. I'd be okay if you insist to keep yours :)
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2019-09-09 19:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 20:09 [PATCH] ASoC: fsl_sai: Fix noise when using EDMA Daniel Baluta
2019-08-30 20:09 ` [alsa-devel] " Daniel Baluta
2019-09-06  1:24 ` Nicolin Chen
2019-09-06  6:46   ` Daniel Baluta
2019-09-09 19:32     ` Nicolin Chen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190909193238.GA10344@Asurada-Nvidia.nvidia.com \
    --to=nicoleotsuka@gmail.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=daniel.baluta@nxp.com \
    --cc=festevam@gmail.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihai.serban@gmail.com \
    --cc=mihai.serban@nxp.com \
    --cc=shengjiu.wang@nxp.com \
    --cc=timur@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).