Hi,
This patchset is the last part of patches for all of drivers in ALSA firewire stack to reserve/release isochronous resources in pcm.hw_params/hw_free callbacks, like the other patchsets:
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-June/150118.html https://mailman.alsa-project.org/pipermail/alsa-devel/2019-June/150863.html
In current implementation, the resources are reserved at the same time to start packet streaming, and released at the same time to stop packet streaming. However, once allocated, the resources are available independent of lifetime of each of packet streaming.
The isochronous resources are the resources of IEEE 1394 bus. On the other side of view, it's a kind of resources of hardware to maintain the bus (isochronous resource manager). For this kind of reservation and release, hw_params and hw_free operations are suitable in ALSA PCM interface.
Ideally, the operation to reserve/release isochronous resource should be separated from the operation to start/stop packet streaming. However, IEEE 1394 bus has reset event. Once reset occurs, isochronous resource manager releases allocated resources. The resources should be reallocated by requesters themselves. For this reason, in this patchset, bus generation is checked before starting packet streaming. If generation is updated, reallocation is requested to isochronous resource manager, then packet streaming starts.
Takashi Sakamoto (10): ALSA: firewire-motu: unify the count of subscriber for packet streaming ALSA: firewire-motu: unify midi callback function ALSA: firewire-motu: add helper function to keep isochronous resources ALSA: firewire-motu: code refactoring for condition to stop streaming ALSA: firewire-motu: rename helper functions to begin/finish streaming session ALSA: firewire-motu: minor code refactoring to stop isochronous context ALSA: firewire-motu: code refactoring to finish streaming session ALSA: firewire-motu: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks ALSA: firewire-motu: update isochronous resources when starting packet streaming after bus-reset ALSA: firewire-motu: code refactoring for pcm.hw_params/hw_free callbacks
sound/firewire/motu/motu-midi.c | 59 ++------- sound/firewire/motu/motu-pcm.c | 62 +++------ sound/firewire/motu/motu-stream.c | 203 +++++++++++++++--------------- sound/firewire/motu/motu.h | 7 +- 4 files changed, 135 insertions(+), 196 deletions(-)