ALSA: dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 11 Jun 2019 13:21:16 +0000 (22:21 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 11 Jun 2019 14:02:09 +0000 (16:02 +0200)
commit3cd2c2d780a23e8b847c9ec22e8bc9dd6e685cbe
tree12f84ce4d581a56b8c6eaca9cd8bc5dd266978cb
parentc738aed136a74e9fafd90e5c8a0b13bf068a39f7
ALSA: dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks

Once allocated, isochronous resources are available for packet
streaming, even if the streaming is cancelled. For this reason,
current implementation handles allocation of the resources and
starting packet streaming at the same time. However, this brings
complicated procedure to start packet streaming.

This commit separates the allocation and starting. The allocation is
done in pcm.hw_params callback and available till pcm.hw_free callback.
Even if any XRUN occurs, pcm.prepare callback is done to restart
packet streaming without releasing/allocating the resources.

There are two points to stop packet streaming; in pcm.hw_params and
pcm.prepare callbacks. The former point is a case that packet streaming
is already started for any MIDI substream then packet streaming is
requested with different sampling transfer frequency for any PCM
substream. The latter point is cases of any XRUN or packet queueing
error.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/dice/dice-midi.c
sound/firewire/dice/dice-pcm.c
sound/firewire/dice/dice-stream.c
sound/firewire/dice/dice.h