All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Peter Meerwald <pmeerw@pmeerw.net>,
	Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Daniel Mack <zonque@gmail.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	alsa-devel@alsa-project.org, linux-omap@vger.kernel.org
Subject: Re: [alsa-devel] channel swapping issue on OMAP3/TWL4030 is back
Date: Fri, 22 Mar 2013 14:04:42 +0100	[thread overview]
Message-ID: <514C56EA.7020304@ti.com> (raw)
In-Reply-To: <alpine.DEB.2.01.1303221348250.7975@pmeerw.net>

Hi,

On 03/22/2013 01:49 PM, Peter Meerwald wrote:
> 
>>>> I'm running Linux 3.7 on a beagle-xm and observe very reproducible stereo 
>>>> channel swapping issue on playback of a stereo stream (one channel has a 
>>>> sine, the other is zero); the channel swap occurs on starting the playback
>>>
>>>> it appears that the swapping issue is back, probably due to the DMA rework 
>>>> in recent kernel?
>>>
>>> kernel 3.4 does not have the issue
>>
>> Well, then, I guess, you'll have to bisect it down.
> 
> here it is:
> 946cc36ae550ea52adee0f42ac5034a34b5393be is the first bad commit
> commit 946cc36ae550ea52adee0f42ac5034a34b5393be
> Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Date:   Fri Sep 14 15:05:58 2012 +0300
> 
>     ASoC: omap-pcm: Convert to use dmaengine
>     
>     Original author: Russell King <rmk+kernel@arm.linux.org.uk>
>     
>     Switch the omap-pcm to use dmaengine.
>     Certain features are not supported by after dmaengine conversion:
>     1. No period wakeup mode
>        DMA engine has no way to communicate this information through
>        standard channels.
>     
>     Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>     Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>     Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Yes the issue surfaced again with the dmaengine conversion. But at the end it
boils down to the OMAP dmaengine implementation.
For audio to work correctly we expect that the DMA _is_ started after the
omap_dma_issue_pending() call, but it is not true for OMAP.

omap_dma_issue_pending() will start a tasklet which is in charge to start the DMA.

In audio case this is how the call chain looks like:

beagle-gentoo ~ # aplay media/2ch-left-since.wav -q
[  473.128753] omap-dma-engine omap-dma-engine: allocating channel for 33
[  473.139587] omap_mcbsp_dai_set_dai_fmt
[  473.148345] omap_mcbsp_dai_hw_params:
[  473.155822] omap_mcbsp_config:
[  473.160369] omap_pcm_trigger: start
[  473.164062] omap_dma_prep_dma_cyclic (dma_ch: 2)
[  473.173828] omap_dma_issue_pending (dma_ch: 2)
[  473.177795] omap_mcbsp_dai_trigger: start
[  473.182006] omap_mcbsp_start
[  473.189025] omap_dma_sched
[  473.191864] omap_dma_start_sg (dma_ch: 2)

You can see that McBSP is started before the DMA because of the tasklet in
drivers/dma/dma-omap.c

Russell: can we remove the tasklet use from dma-omap and start the DMA right
away in omap_dma_issue_pending()? This is the only way to prevent channel swap
when starting audio.
Other devices might not care if the DMA is not started at the time we tell it
to start, but for audio we need to make sure it is.

-- 
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-03-22 13:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22  8:48 channel swapping issue on OMAP3/TWL4030 is back Peter Meerwald
2013-03-22  8:55 ` [alsa-devel] " Daniel Mack
2013-03-22  9:03   ` Peter Meerwald
2013-03-22  9:07     ` Daniel Mack
2013-03-22  9:56 ` Peter Meerwald
2013-03-22 10:11   ` Daniel Mack
2013-03-22 12:49     ` Peter Meerwald
2013-03-22 13:04       ` Peter Ujfalusi [this message]
2013-03-22 16:35         ` Russell King - ARM Linux
2013-03-25 12:39           ` Peter Ujfalusi
2013-03-25 17:15             ` Russell King - ARM Linux
2013-03-26  9:52               ` Peter Ujfalusi

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=514C56EA.7020304@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=zonque@gmail.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.