Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-12 22:18:26 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-12 22:21:14 +0100
commit0dd7af59d17d1b81092f991eb7b73391ca0c720a (patch)
tree6b659d23ef42063dfd1510594b42b9b41828bc4e
parente59cea2562acc89f8f310c5976eef21e67271eb2 (diff)
ALSA: compress: Fix stop handling on compressed capture streams
-rw-r--r--patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch57
-rw-r--r--series.conf1
2 files changed, 58 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch b/patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch
new file mode 100644
index 0000000000..f847773c08
--- /dev/null
+++ b/patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch
@@ -0,0 +1,57 @@
+From: Charles Keepax <ckeepax@opensource.cirrus.com>
+Date: Tue, 5 Feb 2019 16:29:40 +0000
+Subject: [PATCH] ALSA: compress: Fix stop handling on compressed capture
+ streams
+References: bnc#1012628
+Patch-mainline: 4.20.8
+Git-commit: 4f2ab5e1d13d6aa77c55f4914659784efd776eb4
+
+commit 4f2ab5e1d13d6aa77c55f4914659784efd776eb4 upstream.
+
+It is normal user behaviour to start, stop, then start a stream
+again without closing it. Currently this works for compressed
+playback streams but not capture ones.
+
+The states on a compressed capture stream go directly from OPEN to
+PREPARED, unlike a playback stream which moves to SETUP and waits
+for a write of data before moving to PREPARED. Currently however,
+when a stop is sent the state is set to SETUP for both types of
+streams. This leaves a capture stream in the situation where a new
+start can't be sent as that requires the state to be PREPARED and
+a new set_params can't be sent as that requires the state to be
+OPEN. The only option being to close the stream, and then reopen.
+
+Correct this issues by allowing snd_compr_drain_notify to set the
+state depending on the stream direction, as we already do in
+set_params.
+
+Fixes: 49bb6402f1aa ("ALSA: compress_core: Add support for capture streams")
+Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ include/sound/compress_driver.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
+index ea8c93bbb0e0..e87f2d5b3cc6 100644
+--- a/include/sound/compress_driver.h
++++ b/include/sound/compress_driver.h
+@@ -171,7 +171,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
+ if (snd_BUG_ON(!stream))
+ return;
+
+- stream->runtime->state = SNDRV_PCM_STATE_SETUP;
++ if (stream->direction == SND_COMPRESS_PLAYBACK)
++ stream->runtime->state = SNDRV_PCM_STATE_SETUP;
++ else
++ stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
++
+ wake_up(&stream->runtime->sleep);
+ }
+
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 28c02fd8e0..143b1d091a 100644
--- a/series.conf
+++ b/series.conf
@@ -1041,6 +1041,7 @@
patches.kernel.org/4.20.8-302-net-mlx5e-Use-the-inner-headers-to-determine-t.patch
patches.kernel.org/4.20.8-303-net-mlx5e-Force-CHECKSUM_UNNECESSARY-for-short.patch
patches.kernel.org/4.20.8-304-xfs-eof-trim-writeback-mapping-as-soon-as-it-i.patch
+ patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch
########################################################
# Build fixes that apply to the vanilla kernel too.