summaryrefslogtreecommitdiff
path: root/sound/firewire/fireworks/fireworks_stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-06-12 17:44:08 +0900
committerTakashi Iwai <tiwai@suse.de>2019-06-12 15:26:49 +0200
commit1dc5921082d48dc53e48e88ae2f9a24b9737307d (patch)
treef486dc00ac94d3ad18d83d53f232922876c0fd45 /sound/firewire/fireworks/fireworks_stream.c
parent33e41a5ce59ad34c822228d3811ba3785f1a97a2 (diff)
ALSA: fireworks: unify substream counter
This commit is a part of preparation to perform allocation/release of isochronous resources in pcm.hw_params/hw_free callbacks. It's inconvenient to handle two isochronous context separately each other. This commit unifies the counters to handle the two at the same time. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/fireworks/fireworks_stream.c')
-rw-r--r--sound/firewire/fireworks/fireworks_stream.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c
index 74e122e6e68a..2df39befcde0 100644
--- a/sound/firewire/fireworks/fireworks_stream.c
+++ b/sound/firewire/fireworks/fireworks_stream.c
@@ -194,9 +194,9 @@ int snd_efw_stream_start_duplex(struct snd_efw *efw, unsigned int rate)
unsigned int curr_rate;
int err = 0;
- /* Need no substreams */
- if (efw->playback_substreams == 0 && efw->capture_substreams == 0)
- goto end;
+ // Need no substreams.
+ if (efw->substreams_counter == 0)
+ return -EIO;
/*
* Considering JACK/FFADO streaming:
@@ -206,19 +206,15 @@ int snd_efw_stream_start_duplex(struct snd_efw *efw, unsigned int rate)
if (err < 0)
goto end;
- /* packet queueing error */
- if (amdtp_streaming_error(&efw->tx_stream))
- stop_stream(efw, &efw->tx_stream);
- if (amdtp_streaming_error(&efw->rx_stream))
- stop_stream(efw, &efw->rx_stream);
-
/* stop streams if rate is different */
err = snd_efw_command_get_sampling_rate(efw, &curr_rate);
if (err < 0)
goto end;
if (rate == 0)
rate = curr_rate;
- if (rate != curr_rate) {
+ if (rate != curr_rate ||
+ amdtp_streaming_error(&efw->tx_stream) ||
+ amdtp_streaming_error(&efw->rx_stream)) {
stop_stream(efw, &efw->tx_stream);
stop_stream(efw, &efw->rx_stream);
}
@@ -237,13 +233,12 @@ int snd_efw_stream_start_duplex(struct snd_efw *efw, unsigned int rate)
}
}
- /* start slave if needed */
- if (efw->capture_substreams > 0 &&
- !amdtp_stream_running(&efw->tx_stream)) {
+ if (!amdtp_stream_running(&efw->tx_stream)) {
err = start_stream(efw, &efw->tx_stream, rate);
if (err < 0) {
dev_err(&efw->unit->device,
"fail to start AMDTP slave stream:%d\n", err);
+ stop_stream(efw, &efw->tx_stream);
stop_stream(efw, &efw->rx_stream);
}
}
@@ -253,11 +248,9 @@ end:
void snd_efw_stream_stop_duplex(struct snd_efw *efw)
{
- if (efw->capture_substreams == 0) {
+ if (efw->substreams_counter == 0) {
stop_stream(efw, &efw->tx_stream);
-
- if (efw->playback_substreams == 0)
- stop_stream(efw, &efw->rx_stream);
+ stop_stream(efw, &efw->rx_stream);
}
}