summaryrefslogtreecommitdiff
path: root/sound/firewire/bebob
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/bebob
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/bebob')
-rw-r--r--sound/firewire/bebob/bebob_stream.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
index 9ef4663d13e5..1070a675179d 100644
--- a/sound/firewire/bebob/bebob_stream.c
+++ b/sound/firewire/bebob/bebob_stream.c
@@ -404,13 +404,11 @@ static int make_both_connections(struct snd_bebob *bebob)
{
int err = 0;
- err = cmp_connection_establish(&bebob->out_conn,
- amdtp_stream_get_max_payload(&bebob->tx_stream));
+ err = cmp_connection_establish(&bebob->out_conn);
if (err < 0)
return err;
- err = cmp_connection_establish(&bebob->in_conn,
- amdtp_stream_get_max_payload(&bebob->rx_stream));
+ err = cmp_connection_establish(&bebob->in_conn);
if (err < 0) {
cmp_connection_break(&bebob->out_conn);
return err;
@@ -533,14 +531,23 @@ static int keep_resources(struct snd_bebob *bebob, struct amdtp_stream *stream,
unsigned int rate, unsigned int index)
{
struct snd_bebob_stream_formation *formation;
+ struct cmp_connection *conn;
+ int err;
- if (stream == &bebob->tx_stream)
+ if (stream == &bebob->tx_stream) {
formation = bebob->tx_stream_formations + index;
- else
+ conn = &bebob->out_conn;
+ } else {
formation = bebob->rx_stream_formations + index;
+ conn = &bebob->in_conn;
+ }
+
+ err = amdtp_am824_set_parameters(stream, rate, formation->pcm,
+ formation->midi, false);
+ if (err < 0)
+ return err;
- return amdtp_am824_set_parameters(stream, rate, formation->pcm,
- formation->midi, false);
+ return cmp_connection_reserve(conn, amdtp_stream_get_max_payload(stream));
}
int snd_bebob_stream_reserve_duplex(struct snd_bebob *bebob, unsigned int rate)
@@ -591,8 +598,10 @@ int snd_bebob_stream_reserve_duplex(struct snd_bebob *bebob, unsigned int rate)
return err;
err = keep_resources(bebob, &bebob->rx_stream, rate, index);
- if (err < 0)
+ if (err < 0) {
+ cmp_connection_release(&bebob->out_conn);
return err;
+ }
}
return 0;
@@ -685,6 +694,9 @@ void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob)
amdtp_stream_stop(&bebob->tx_stream);
break_both_connections(bebob);
+
+ cmp_connection_release(&bebob->out_conn);
+ cmp_connection_release(&bebob->in_conn);
}
}