aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2022-09-19 14:10:39 +0200
committerTakashi Iwai <tiwai@suse.de>2022-09-20 08:08:14 +0200
commit53f4f6b4e56d5fb6ef95a7e14c10ec244a79b996 (patch)
tree8718d8527e7c498d94902c7218ca06bb51d5d419
parentALSA: hda: add snd_hdac_stop_streams() helper (diff)
downloadlinux-dev-53f4f6b4e56d5fb6ef95a7e14c10ec244a79b996.tar.xz
linux-dev-53f4f6b4e56d5fb6ef95a7e14c10ec244a79b996.zip
ALSA: hda: ext: simplify logic for stream assignment
The logic is needlessly complicated, the basic rule is: The host streams can be found by checking the 'opened' boolean. The link streams can be found by checking the 'link_locked' boolean. Once a stream is found, it can be unconditionally decoupled. The snd_hdac_ext_stream_decouple_locked() routine will make sure the register status is modified as needed and the 'decoupled' boolean set. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20220919121041.43463-7-pierre-louis.bossart@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/hda/ext/hdac_ext_stream.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sound/hda/ext/hdac_ext_stream.c b/sound/hda/ext/hdac_ext_stream.c
index 9419abd7fc03..254df9a67bd2 100644
--- a/sound/hda/ext/hdac_ext_stream.c
+++ b/sound/hda/ext/hdac_ext_stream.c
@@ -267,19 +267,15 @@ hdac_ext_link_stream_assign(struct hdac_bus *bus,
if (hstream->direction != substream->stream)
continue;
- /* check if decoupled stream and not in use is available */
- if (hext_stream->decoupled && !hext_stream->link_locked) {
- res = hext_stream;
- break;
- }
-
+ /* check if link stream is available */
if (!hext_stream->link_locked) {
- snd_hdac_ext_stream_decouple_locked(bus, hext_stream, true);
res = hext_stream;
break;
}
+
}
if (res) {
+ snd_hdac_ext_stream_decouple_locked(bus, res, true);
res->link_locked = 1;
res->link_substream = substream;
}
@@ -308,13 +304,12 @@ hdac_ext_host_stream_assign(struct hdac_bus *bus,
continue;
if (!hstream->opened) {
- if (!hext_stream->decoupled)
- snd_hdac_ext_stream_decouple_locked(bus, hext_stream, true);
res = hext_stream;
break;
}
}
if (res) {
+ snd_hdac_ext_stream_decouple_locked(bus, res, true);
res->hstream.opened = 1;
res->hstream.running = 0;
res->hstream.substream = substream;