All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
	Clemens Ladisch <clemens@ladisch.de>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>,
	"shiiba (Renesas)" <naoya.shiiba.nx@renesas.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Subject: Re: Question about SNDRV_PCM_STATE_DRAINING and DMA transfer
Date: Fri, 26 Sep 2014 10:15:35 +0200	[thread overview]
Message-ID: <542520A7.6050604@perex.cz> (raw)
In-Reply-To: <87lhp6n70k.wl%kuninori.morimoto.gx@gmail.com>

Dne 26.9.2014 v 10:03 Kuninori Morimoto napsal(a):
> 
> Hi Clemens
> 
> Thank you for your explain
> 
>>> We noticed that DMA seems transfered +1 time when Ctrl-C happen.
>>> But, is this correct ? is this our driver bug ?
>>> [...]
>>> 7. DMA transfer interrupt happen
>>>
>>>    It calls snd_pcm_period_elapsed() and try to transfer next 2048 byte
>>>    snd_pcm_playback_avail() in snd_pcm_update_state() return 8192 this time.
>>>    then, it calls snd_pcm_drain_done()
>>>
>>> 9. snd_soc_dai_ops :: trigger called with SNDRV_PCM_TRIGGER_STOP
>>>
>>>    driver stops DMA transfer
>>
>> There is no strong synchronization between snd_pcm_drain() and the rest
>> of the system; snd_pcm_drain() just waits for an underrun to happen.
>>
>> In other words, the last actual DMA transfer is likely to contain
>> invalid (outdated) samples, but gets aborted immediately.
> 
> I wonder why we need drain ?
> This "likely to contain invalid samples" will be solved if
> we can skip "complete drain" ?

The user app should do the flush instead the drain in this case...

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.

  reply	other threads:[~2014-09-26  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  4:36 Question about SNDRV_PCM_STATE_DRAINING and DMA transfer Kuninori Morimoto
2014-09-26  7:35 ` Clemens Ladisch
2014-09-26  8:03   ` Kuninori Morimoto
2014-09-26  8:15     ` Jaroslav Kysela [this message]
2014-09-26  8:45       ` Kuninori Morimoto
2014-09-26 10:07         ` Jaroslav Kysela
2014-09-26 10:31           ` Kuninori Morimoto

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=542520A7.6050604@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=clemens@ladisch.de \
    --cc=kuninori.morimoto.gx@gmail.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=naoya.shiiba.nx@renesas.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.