All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about SNDRV_PCM_STATE_DRAINING and DMA transfer
@ 2014-09-26  4:36 Kuninori Morimoto
  2014-09-26  7:35 ` Clemens Ladisch
  0 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2014-09-26  4:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, shiiba (Renesas), Kuninori Morimoto


Hi Mark, ALSA ML

We noticed that DMA seems transfered +1 time when Ctrl-C happen.
But, is this correct ? is this our driver bug ?
our buffer_size is 8192, and DMA transfers 2048 in 1 time.

1. Ctrl-C happen

   wait_for_avail() of snd_pcm_lib_write1() returns -ERESTARTSYS immediately
   no transfer() are called any more.

2. DMA transfer interrupt happen

   This is normal from driver point of view
   It calls snd_pcm_period_elapsed() and try to transfer next 2048 byte

3. snd_pcm_common_ioctl1() :: SNDRV_PCM_IOCTL_DRAIN is called

   it goes to SNDRV_PCM_STATE_DRAINING status in snd_pcm_drain()
   and it wait until all drained.

4. 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 2048 this time.

5. 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 4096 this time.

6. 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 6144 this time.

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   

2) / 4) / 5) / 6) / 7) continue DMA transfer.
but, 1) already quited from snd_pcm_lib_write1() I guess.
So, 2) and 7) uses same buffer ?
What/Where is wrong ?

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-26 10:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-09-26  8:45       ` Kuninori Morimoto
2014-09-26 10:07         ` Jaroslav Kysela
2014-09-26 10:31           ` Kuninori Morimoto

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.