All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roberto Fichera <kernel@tekno-soft.it>
To: Caleb Crome <caleb@crome.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Shengjiu Wang <shengjiu.wang@freescale.com>,
	Nicolin Chen <nicoleotsuka@gmail.com>,
	"arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>,
	Markus Pargmann <mpa@pengutronix.de>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	Fabio Estevam <festevam@gmail.com>
Subject: Re: fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode.
Date: Wed, 28 Oct 2015 15:48:19 +0100	[thread overview]
Message-ID: <5630E033.6080307@tekno-soft.it> (raw)
In-Reply-To: <CAG5mAdwrr6NZ_3bjfeGMDMJhFUubEXtdkbi2pJdmVV00VzQ7Fg@mail.gmail.com>

On 10/28/2015 03:24 PM, Caleb Crome wrote:
> On Wed, Oct 28, 2015 at 7:05 AM, Roberto Fichera <kernel@tekno-soft.it> wrote:
>> On 10/28/2015 02:59 PM, Caleb Crome wrote:
>>> On Wed, Oct 28, 2015 at 1:11 AM, Roberto Fichera <kernel@tekno-soft.it> wrote:
>>>> On 10/27/2015 07:57 PM, Fabio Estevam wrote:
>>>>> [Adding Roberto in the thread as he is also trying to get SSI TDM support/
>>>> Thanks Fabio,
>>>>
>>>> I'm also having the same issue but employing SSI in TDM master mode against a SLIC Si32178
>>>> using its PCM mode. PCLK is at 2048KHz, FSYNC is 8KHz slot length is 32 bits (SSI wants
>>>> this since when in master mode) but valid data set to be 8bits in the SSI register.
>>>>
>>>> My Current situation is that I've a custom fsl_ssi.c driver to control the SSI in TDM master mode
>>>> both PCLK and FSYNC works perfectly fine, the SLIC has a register that I can check via SPI for
>>>> such purpose, I can see the clocking status from its side. The main problem I've is exactly the same
>>>> Caleb is having, after a certain amount of SDMA transfers, roughly 1000 or so, everything stops
>>>> without any apparent reason.
>>> My problem is that the channels randomly slip a slot and all words end
>>> up in the wrong slot.  I suspect this is a DMA issue, but I really
>>> haven't diagnosed it yet.  I don't get a full stop on the data.
>> Ah! Ok!
>>
>>> FYI, I'm using a very recent 4.3 kernel from linus's repo, but 4.2
>>> behaved the same.
>> Can you please post the code you are using to setup the SSI, what PCLK and FSYNC rates?
> My codec is generating the clocks and the MX6 is in slave mode.  PCLK
> (I assume that's the bit clock or BCLK in my workld) is 12.288MHz, 
Yes! I meant BCLK.
> and
> the FSYNC is 48kHz.  16 channels/frame, 16 bits/channel.

Ok! In my case it's BCLK at 2048KHz and FSYNC 8KHz, 8 slots at 8bits

>
> I hardly changed the SSI driver at all.  It's goofy now for sure
> because I force it to 16 slots/frame no matter what, so beware.  Other
> than that, I also set the STCCR for 16 channels and set channels_max
> to 16.
>
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 37c5cd4..73778c2 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -749,7 +749,10 @@ static int fsl_ssi_hw_params(struct
> snd_pcm_substream *substream,
>                  CCSR_SSI_SCR_NET | CCSR_SSI_SCR_I2S_MODE_MASK,
>                  channels == 1 ? 0 : i2smode);
>      }
> -
> +    ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
> +    regmap_update_bits(regs, CCSR_SSI_SCR,
> +               CCSR_SSI_SCR_NET | CCSR_SSI_SCR_I2S_MODE_MASK,
> +               ssi_private->i2s_mode);
>      /*
>       * FIXME: The documentation says that SxCCR[WL] should not be
>       * modified while the SSI is enabled.  The only time this can
> @@ -863,6 +866,15 @@ static int _fsl_ssi_set_dai_fmt(struct device *dev,
>          return -EINVAL;
>      }
>      scr |= ssi_private->i2s_mode;
> +    // Set to 16 slots/frame
> +    regmap_update_bits(regs, CCSR_SSI_STCCR,
> +               CCSR_SSI_SxCCR_DC_MASK,
> +               CCSR_SSI_SxCCR_DC(16));
> +
> +    regmap_update_bits(regs, CCSR_SSI_SRCCR,
> +               CCSR_SSI_SxCCR_DC_MASK,
> +               CCSR_SSI_SxCCR_DC(16));
> +
>
>      /* DAI clock inversion */
>      switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
> @@ -1084,14 +1099,14 @@ static struct snd_soc_dai_driver
> fsl_ssi_dai_template = {
>      .playback = {
>          .stream_name = "CPU-Playback",
>          .channels_min = 1,
> -        .channels_max = 2,
> +        .channels_max = 16,
>          .rates = FSLSSI_I2S_RATES,
>          .formats = FSLSSI_I2S_FORMATS,
>      },
>      .capture = {
>          .stream_name = "CPU-Capture",
>          .channels_min = 1,
> -        .channels_max = 2,
> +        .channels_max = 16,
>          .rates = FSLSSI_I2S_RATES,
>          .formats = FSLSSI_I2S_FORMATS,
>      },
>
>
> There are other changes I've tried, including watermark changes (check
> out the alsa-dev archives on this thread for what I did before).  This
> morning I am about to try the watermark changes suggested by Nicolin
> Chen.
>
>> Did you have your own DMA handling?
> Nope, I don't really know how to do that.  I'm relying on the built in
> sdma driver (drivers/dma/imx-sdma.c) + fsl pcm
> (sound/soc/fsl/imx-pcm-dma.c) and my modified fsl_ssi.c driver.
In case you need to increase the SSI clock, have a look at CLK_SSI1_PODF within arch/arm/mach-imx/clk-imx6*.c
depending by your SoC, in this file you can change the max clock rate supported by the given SSI clock.

Have you tried to set the SSI in I2S_MODE_SLAVE BTW?

>
> -Caleb
>
>
>>> -Caleb
>>>
>>>>> On Tue, Oct 27, 2015 at 2:45 PM, Fabio Estevam <festevam@gmail.com> wrote:
>>>>>> On Tue, Oct 27, 2015 at 2:42 PM, Caleb Crome <caleb@crome.org> wrote:
>>>>>>> On Tue, Oct 27, 2015 at 9:10 AM, Fabio Estevam <festevam@gmail.com> wrote:
>>>>>>>> On Tue, Oct 27, 2015 at 2:02 PM, Caleb Crome <caleb@crome.org> wrote:
>>>>>>>>
>>>>>>>>>> Could you please try it without using the external SDMA firmware?
>>>>>>>>> I do need *some* SDMA firmware, correct?  The firmware that I'm using
>>>>>>>>> ends up in /lib/firmware/imx/sdma/sdma-imx6q.bin and is md5sum
>>>>>>>>> 5d4584134cc4cba62e1be2f382cd6f3a.
>>>>>>>> SSI can operate with the ROM SDMA firmware.
>>>>>>>>
>>>>>>>> I would like to know if this issue also happens if you don't pass the
>>>>>>>> external firmware and use the internal ROM SDMA firmware instead.
>>>>>>> Ah, good to know.  Do I just remove reference in the .dtsi file?
>>>>>>> Remove the file from the filesystem?  I'll do both to be doubly sure
>>>>>>> :-)
>>>>>> Just remove it from the rootfs. Then you will see a message from the
>>>>>> kernel saying that no external SDMA firmware could be found and that
>>>>>> the internal one is going to be used.
>>>>>>
>>>>>>>> Also, could you try bumping the SSI and SDMA clock rates at the maximum?
>>>>>>> Any idea how I do that?  I guess it's in the .dtsi file perhaps?  I'll
>>>>>>> poke around.
>>>>>> You can try to call clk_set_rate() with the maximum allowed frequency
>>>>>> inside the ssi driver. I don't recall on top of my head what is this
>>>>>> value though.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Fabio Estevam
>>>>> _______________________________________________
>>>>> Alsa-devel mailing list
>>>>> Alsa-devel@alsa-project.org
>>>>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>>>>
>>> _______________________________________________
>>> Alsa-devel mailing list
>>> Alsa-devel@alsa-project.org
>>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

  reply	other threads:[~2015-10-28 14:48 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 15:55 fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode Caleb Crome
2015-10-20  7:36 ` arnaud.mouiche
2015-10-20 17:43   ` Caleb Crome
2015-10-21  7:32     ` arnaud.mouiche
2015-10-21 19:37       ` Caleb Crome
2015-10-26 17:31         ` Caleb Crome
2015-10-27  7:13           ` Markus Pargmann
2015-10-27  9:41             ` Fabio Estevam
2015-10-27 16:02               ` Caleb Crome
2015-10-27 16:10                 ` Fabio Estevam
2015-10-27 16:42                   ` Caleb Crome
2015-10-27 16:45                     ` Fabio Estevam
2015-10-27 18:57                       ` Fabio Estevam
2015-10-28  8:11                         ` Roberto Fichera
2015-10-28 13:59                           ` Caleb Crome
2015-10-28 14:05                             ` Roberto Fichera
2015-10-28 14:24                               ` Caleb Crome
2015-10-28 14:48                                 ` Roberto Fichera [this message]
2015-10-28 22:09                             ` Caleb Crome
2015-10-29  8:04                               ` Roberto Fichera
2015-10-29 23:04                           ` Nicolin Chen
2015-10-30 11:42                             ` Roberto Fichera
2015-10-30 17:21                               ` Nicolin Chen
2015-10-28 13:53                       ` Caleb Crome
2015-10-27 20:11             ` Nicolin Chen
2015-10-28  8:23               ` Roberto Fichera
2015-10-29 23:05                 ` Nicolin Chen
2015-10-28 22:06               ` Caleb Crome
2015-10-29  4:53                 ` Nicolin Chen
2015-10-29 13:44                   ` Caleb Crome
2015-10-29 14:55                     ` Caleb Crome
2015-10-29 15:37                       ` Roberto Fichera
2015-10-29 15:54                         ` Caleb Crome
2015-10-29 16:02                           ` Roberto Fichera
2015-10-29 16:19                             ` Caleb Crome
2015-10-29 16:34                             ` Roberto Fichera
2015-10-29 16:39                               ` Caleb Crome
2015-10-29 16:59                                 ` Roberto Fichera
2015-10-29 18:36                           ` Nicolin Chen
2015-10-29 19:08                             ` Caleb Crome
2015-10-29 23:22                         ` Nicolin Chen
2015-10-29 18:11                       ` Nicolin Chen
2015-10-29 17:19                     ` Nicolin Chen
2015-10-29 19:06                       ` Caleb Crome
2015-10-29 19:28                         ` Nicolin Chen
2015-10-29 22:23                           ` Caleb Crome
2015-10-29 22:47                             ` Nicolin Chen
2015-10-29 23:33                               ` Caleb Crome
2015-10-30  1:29                                 ` Nicolin Chen
2015-10-30  8:29                                   ` arnaud.mouiche
2015-10-30  8:45                                     ` arnaud.mouiche
2015-10-30 16:07                                       ` Nicolin Chen
2015-10-30 15:49                                     ` Nicolin Chen
2015-10-30 18:10                                       ` Caleb Crome
2015-10-30 22:04                                   ` Caleb Crome
2015-10-30 22:35                                     ` Caleb Crome
2015-10-31  1:32                                       ` Nicolin Chen
2015-10-31 16:12                                         ` Caleb Crome
2015-10-31  1:48                                     ` Nicolin Chen
2015-10-31 16:22                                       ` Caleb Crome
2015-11-02 17:22                                         ` Nicolin Chen

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=5630E033.6080307@tekno-soft.it \
    --to=kernel@tekno-soft.it \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.mouiche@invoxia.com \
    --cc=caleb@crome.org \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=mpa@pengutronix.de \
    --cc=nicoleotsuka@gmail.com \
    --cc=shawn.guo@linaro.org \
    --cc=shengjiu.wang@freescale.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.