diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2019-06-11 16:21:08 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-06-11 17:02:03 +0300 |
commit | d18b0a6e42f7d4fca64f34ea0b76a312be632d7a (patch) | |
tree | df96e43f4bccc48b76253ca598a01610400d1a8d /sound/firewire/digi00x/digi00x-stream.c | |
parent | 6bc9322936f240d96b1a76d87a9f308456bf31bf (diff) | |
download | linux-d18b0a6e42f7d4fca64f34ea0b76a312be632d7a.tar.xz |
ALSA: firewire-digi00x: code refactoring to finish streaming session
This commit is a part of preparation to perform allocation/release
of isochronous resources in pcm.hw_params/hw_free callbacks.
The operation to finish packet streaming corresponds to stopping
isochronous contexts. This commit applies code refactoring to
move codes to stop into a helper function to finish the session.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/digi00x/digi00x-stream.c')
-rw-r--r-- | sound/firewire/digi00x/digi00x-stream.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/firewire/digi00x/digi00x-stream.c b/sound/firewire/digi00x/digi00x-stream.c index 455c43e81850..90e31b63ac2f 100644 --- a/sound/firewire/digi00x/digi00x-stream.c +++ b/sound/firewire/digi00x/digi00x-stream.c @@ -125,8 +125,12 @@ int snd_dg00x_stream_get_external_rate(struct snd_dg00x *dg00x, static void finish_session(struct snd_dg00x *dg00x) { - __be32 data = cpu_to_be32(0x00000003); + __be32 data; + + amdtp_stream_stop(&dg00x->tx_stream); + amdtp_stream_stop(&dg00x->rx_stream); + data = cpu_to_be32(0x00000003); snd_fw_transaction(dg00x->unit, TCODE_WRITE_QUADLET_REQUEST, DG00X_ADDR_BASE + DG00X_OFFSET_STREAMING_SET, &data, sizeof(data), 0); @@ -136,6 +140,10 @@ static void finish_session(struct snd_dg00x *dg00x) snd_fw_transaction(dg00x->unit, TCODE_WRITE_QUADLET_REQUEST, DG00X_ADDR_BASE + DG00X_OFFSET_ISOC_CHANNELS, &data, sizeof(data), 0); + + // Just after finishing the session, the device may lost transmitting + // functionality for a short time. + msleep(50); } static int begin_session(struct snd_dg00x *dg00x) @@ -289,8 +297,6 @@ int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x, unsigned int rate) amdtp_streaming_error(&dg00x->rx_stream)) { finish_session(dg00x); - amdtp_stream_stop(&dg00x->tx_stream); - amdtp_stream_stop(&dg00x->rx_stream); release_resources(dg00x); } @@ -346,8 +352,6 @@ end: error: finish_session(dg00x); - amdtp_stream_stop(&dg00x->tx_stream); - amdtp_stream_stop(&dg00x->rx_stream); release_resources(dg00x); return err; @@ -358,16 +362,8 @@ void snd_dg00x_stream_stop_duplex(struct snd_dg00x *dg00x) if (dg00x->substreams_counter > 0) return; - amdtp_stream_stop(&dg00x->tx_stream); - amdtp_stream_stop(&dg00x->rx_stream); finish_session(dg00x); release_resources(dg00x); - - /* - * Just after finishing the session, the device may lost transmitting - * functionality for a short time. - */ - msleep(50); } void snd_dg00x_stream_update_duplex(struct snd_dg00x *dg00x) |