ALSA: firewire-motu: reserve/release isochronous resources in pcm.hw_params/hw_free...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 17 Jun 2019 08:15:08 +0000 (17:15 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 18 Jun 2019 06:45:31 +0000 (08:45 +0200)
commit8edc56ec8f14a586a55b2ab2fda76e6bf4738ee6
treee41c78039331da3eda25e75ba7ad6522d7941b86
parentec694fba2ac9406cb3fc3c3216db3de9ed3174a7
ALSA: firewire-motu: 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/motu/motu-midi.c
sound/firewire/motu/motu-pcm.c
sound/firewire/motu/motu-stream.c
sound/firewire/motu/motu.h