ALSA: firewire-digi00x: update isochronous resources when starting packet streaming...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 11 Jun 2019 13:21:12 +0000 (22:21 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 11 Jun 2019 14:02:06 +0000 (16:02 +0200)
After bus reset, isochronous resource manager releases all of allocated
isochronous resources. The nodes to transfer isochronous packet should
request reallocation of the resources.

However, between the bus-reset and invocation of 'struct fw_driver.update'
handler, ALSA PCM application can detect this situation by XRUN because
the target device cancelled to transmit packets once bus-reset occurs.

Due to the above mechanism, ALSA fireface driver just stops packet
streaming in the update handler, thus pcm.prepare handler should
request the reallocation.

This commit requests the reallocation in pcm.prepare callback when
bus generation is changed.

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

index 3b903e4..3c5e1c5 100644 (file)
@@ -303,6 +303,7 @@ void snd_dg00x_stream_release_duplex(struct snd_dg00x *dg00x)
 
 int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x)
 {
+       unsigned int generation = dg00x->rx_resources.generation;
        int err = 0;
 
        if (dg00x->substreams_counter == 0)
@@ -312,6 +313,16 @@ int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x)
            amdtp_streaming_error(&dg00x->rx_stream))
                finish_session(dg00x);
 
+       if (generation != fw_parent_device(dg00x->unit)->card->generation) {
+               err = fw_iso_resources_update(&dg00x->tx_resources);
+               if (err < 0)
+                       goto error;
+
+               err = fw_iso_resources_update(&dg00x->rx_resources);
+               if (err < 0)
+                       goto error;
+       }
+
        /*
         * No packets are transmitted without receiving packets, reagardless of
         * which source of clock is used.