summaryrefslogtreecommitdiff
path: root/sound/firewire/fireworks
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-06-15 18:11:01 +0900
committerTakashi Iwai <tiwai@suse.de>2019-06-17 08:18:36 +0200
commit7bc93821a70adc621df443c8b7a4745023c36e7c (patch)
tree0474e9b97389716fb9e1320d6ceeba6b61be03d2 /sound/firewire/fireworks
parentc6b84ffbd5e78d6cf4aaafe5502e1bc99eb9657c (diff)
ALSA: firewire-lib: split allocation of isochronous resources from establishment of connection
In current implementation, establishment connection corresponds to allocation of isochronous resources. Although this is an ideal implementation of CMP described in IEC 61883-1, it's not enough efficient to recover PCM substream multiplexed in packet streaming. The packet streaming can always restart on the same allocated isochronous resources even if the previous packet streaming corrupted. This commit splits allocation of isochronous resources from establishment of connection so that CMP runs with allocated isochronous resources. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireworks')
-rw-r--r--sound/firewire/fireworks/fireworks_stream.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
index 61342c49dc38..81c1bb209a89 100644
--- a/sound/firewire/fireworks/fireworks_stream.c
+++ b/sound/firewire/fireworks/fireworks_stream.c
@@ -63,8 +63,7 @@ static int start_stream(struct snd_efw *efw, struct amdtp_stream *stream,
conn = &efw->in_conn;
// Establish connection via CMP.
- err = cmp_connection_establish(conn,
- amdtp_stream_get_max_payload(stream));
+ err = cmp_connection_establish(conn);
if (err < 0)
return err;
@@ -177,17 +176,25 @@ static int keep_resources(struct snd_efw *efw, struct amdtp_stream *stream,
{
unsigned int pcm_channels;
unsigned int midi_ports;
+ struct cmp_connection *conn;
+ int err;
if (stream == &efw->tx_stream) {
pcm_channels = efw->pcm_capture_channels[mode];
midi_ports = efw->midi_out_ports;
+ conn = &efw->out_conn;
} else {
pcm_channels = efw->pcm_playback_channels[mode];
midi_ports = efw->midi_in_ports;
+ conn = &efw->in_conn;
}
- return amdtp_am824_set_parameters(stream, rate, pcm_channels,
- midi_ports, false);
+ err = amdtp_am824_set_parameters(stream, rate, pcm_channels,
+ midi_ports, false);
+ if (err < 0)
+ return err;
+
+ return cmp_connection_reserve(conn, amdtp_stream_get_max_payload(stream));
}
int snd_efw_stream_reserve_duplex(struct snd_efw *efw, unsigned int rate)
@@ -228,8 +235,10 @@ int snd_efw_stream_reserve_duplex(struct snd_efw *efw, unsigned int rate)
return err;
err = keep_resources(efw, &efw->rx_stream, rate, mode);
- if (err < 0)
+ if (err < 0) {
+ cmp_connection_release(&efw->in_conn);
return err;
+ }
}
return 0;
@@ -285,6 +294,9 @@ void snd_efw_stream_stop_duplex(struct snd_efw *efw)
if (efw->substreams_counter == 0) {
stop_stream(efw, &efw->tx_stream);
stop_stream(efw, &efw->rx_stream);
+
+ cmp_connection_release(&efw->out_conn);
+ cmp_connection_release(&efw->in_conn);
}
}