]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.16.8/alsa-aloop-mark-paused-device-as-inactive.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.16.8 / alsa-aloop-mark-paused-device-as-inactive.patch
CommitLineData
5bcf81f3
GKH
1From 306a4f3ca7f3c7dfa473ebd19d66e40e59d99734 Mon Sep 17 00:00:00 2001
2From: Robert Rosengren <robert.rosengren@axis.com>
3Date: Mon, 26 Mar 2018 07:24:49 +0200
4Subject: ALSA: aloop: Mark paused device as inactive
5
6From: Robert Rosengren <robert.rosengren@axis.com>
7
8commit 306a4f3ca7f3c7dfa473ebd19d66e40e59d99734 upstream.
9
10Show paused ALSA aloop device as inactive, i.e. the control
11"PCM Slave Active" set as false. Notification sent upon state change.
12
13This makes it possible for client capturing from aloop device to know if
14data is expected. Without it the client expects data even if playback
15is paused.
16
17Signed-off-by: Robert Rosengren <robert.rosengren@axis.com>
18Signed-off-by: Takashi Iwai <tiwai@suse.de>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 sound/drivers/aloop.c | 12 +++++++++---
23 1 file changed, 9 insertions(+), 3 deletions(-)
24
25--- a/sound/drivers/aloop.c
26+++ b/sound/drivers/aloop.c
27@@ -296,6 +296,8 @@ static int loopback_trigger(struct snd_p
28 cable->pause |= stream;
29 loopback_timer_stop(dpcm);
30 spin_unlock(&cable->lock);
31+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
32+ loopback_active_notify(dpcm);
33 break;
34 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
35 case SNDRV_PCM_TRIGGER_RESUME:
36@@ -304,6 +306,8 @@ static int loopback_trigger(struct snd_p
37 cable->pause &= ~stream;
38 loopback_timer_start(dpcm);
39 spin_unlock(&cable->lock);
40+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
41+ loopback_active_notify(dpcm);
42 break;
43 default:
44 return -EINVAL;
45@@ -892,9 +896,11 @@ static int loopback_active_get(struct sn
46 [kcontrol->id.subdevice][kcontrol->id.device ^ 1];
47 unsigned int val = 0;
48
49- if (cable != NULL)
50- val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ?
51- 1 : 0;
52+ if (cable != NULL) {
53+ unsigned int running = cable->running ^ cable->pause;
54+
55+ val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0;
56+ }
57 ucontrol->value.integer.value[0] = val;
58 return 0;
59 }