Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Roberto Fichera <kernel@tekno-soft.it>
To: Caleb Crome <caleb@crome.org>, Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	Markus Pargmann <mpa@pengutronix.de>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>
Subject: Re: fsl_ssi.c: Getting channel slips with fsl_ssi.c in TDM (network) mode.
Date: Thu, 29 Oct 2015 16:37:35 +0100	[thread overview]
Message-ID: <56323D3F.4080708@tekno-soft.it> (raw)
In-Reply-To: <CAG5mAdw220n3K8vfRAgixxeYa=rBp5YbOrn_8ecwH+KN0JOnnA@mail.gmail.com>

On 10/29/2015 03:55 PM, Caleb Crome wrote:
> On Thu, Oct 29, 2015 at 6:44 AM, Caleb Crome <caleb@crome.org> wrote:
>> On Wed, Oct 28, 2015 at 9:53 PM, Nicolin Chen <nicoleotsuka@gmail.com> wrote:
>>> I am actually thinking about setting a watermark to a larger number.
>>> I forgot how the SDMA script handles this number. But if this burst
>>> size means the overall data count per transaction, it might indicate
>>> that each FIFO only gets half of the burst size due to dual FIFOs.
>>>
>>> Therefore, if setting watermark to 8, each FIFO has 7 (15 - 8) space
>>> left, the largest safe burst size could be 14 (7 * 2) actually.
>> Oh, does this depend on the data size?  I'm using 16-bit data, so I
>> guess the bursts are measured in 2 byte units?  Does this mean that
>> the burst size should be dynamically adjusted depending on word size
>> (I guess done in hw_params)?
>>
>>> Nicolin
> Okay, so wm=8 and maxburst=14 definitely does not work at all,.  wm=8,
> maxburst=8 works okay, but still not perfect.
>
> I just discovered some new information:
>
> With wm=8 and maxburst=8 (which is my best setting so far), I just
> captured a problem at the very start of playing a file, and restarted
> enough times to capture it starting wrong:
>
> Instead of the playback starting with
>
> (hex numbers:  my ramp file has first nibble as channel, second nibble as frame)
>
> frame 0:  00, 10, 20, 30, 40, 50, 60, 70, 80, 90, a0, b0, c0, d0, e0, f0
> frame 1:  01, 11, 21, 31, 41, 51, 61, 71, 81, 91, a1, b1, c1, d1, e1, f1
>
> It started with:
>
> frame 0:  00, 00, 10, 20, 30, 40, 50, 60, 70, 80, 90, a0, b0, c0, d0, e0
> frame 1:  f0, 01, 11, 21, 31, 41, 51, 61, 71, 81, 91, a1, b1, c1, d1, e1
>
> So, the transfer started wrong right out of the gate -- with an extra
> sample inserted at the beginning. Again, my setup is:
> 1) use scope to capture the TDM bus.  Trigger on first data change
> 2) aplay myramp.wav
> 3) If okay, ctrl-c and goto 2.
> 4) The capture below shows everything off by 1 sample.
>
> The capture is here:
> https://drive.google.com/open?id=0B-KUa9Yf1o7iOXFtWXk2ZXdoUXc
>
> This test definitely reveals that there is a startup issue.  Now for
> the $64,000 question: what to do with this knowledge?  I'm quite
> unfamiliar with how the DMA works at all.

I'm my case for example, I'm using a iMX6SX SoC, I've changed fsl_ssi.c to start the SSI
clock generated internally by setting both RDMAE and TDMAE just once I'm pretty sure
that everything has been setup (DMA and callback). Note that I'm not using alsa because,
my target is to integrate SSI in TDM network mode with my DAHDI driver for VoIP app.

Back to the DMA question, in your case shouldn't be really a problem since all DMA
stuff is handled by the linux audio framework.

Regarding my SSI problem, I was able to keep the DMA working for few second once before
it get stopped and never retriggered. Currently I've 2 DMA channel one for TX and another for RX
I've changed my DTS and update my fsl_ssi to handle new clocks, I guess only the CLK_SPBA
has improved my situation. I've also tried to enable both RIE and TIE to service the ISR, with
and without SSI DMA support, but this end with a full system freeze. The ISR was never changed
in my fsl_ssi.c.

                ssi1: ssi@02028000 {
                    compatible = "fsl,imx6sx-ssi", "fsl,imx21-ssi";
                    reg = <0x02028000 0x4000>;
                    interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
                    clocks = <&clks IMX6SX_CLK_SSI1_IPG>,
                         <&clks IMX6SX_CLK_SSI1>,
--->>>                         <&clks IMX6SX_CLK_SPBA>,
                         <&clks IMX6SX_CLK_SDMA>;
                    clock-names = "ipg", "baud", "dma", "ahb";
                    dmas = <&sdma 37 1 0>, <&sdma 38 1 0>;
                    dma-names = "rx", "tx";


Another thing I'm looking is the sdma events (37 and 38) which are reported by the reference
manual to

37 -> SSI1 Receive 0 DMA request
38 -> SSI1 Transmit 0 DMA request

along that there are also

35 -> SSI1 Receive 1 DMA request
36 -> SSI1 Transmit 1 DMA request

I don't know actually how the two events types will behaves from the SDMA point of view.

I'm also considering to make plain new audio driver to at least try to use something which
is supposed to work fine with SSI.

>
> I'll start poking around the DMA I guess.

I guess it's a SSI startup problem.

>
> Thanks,
>   -Caleb
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>

  reply	other threads:[~2015-10-29 15:37 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
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 [this message]
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=56323D3F.4080708@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=mpa@pengutronix.de \
    --cc=nicoleotsuka@gmail.com \
    --cc=shawn.guo@linaro.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