]>
Commit | Line | Data |
---|---|---|
5bcf81f3 GKH |
1 | From 306a4f3ca7f3c7dfa473ebd19d66e40e59d99734 Mon Sep 17 00:00:00 2001 |
2 | From: Robert Rosengren <robert.rosengren@axis.com> | |
3 | Date: Mon, 26 Mar 2018 07:24:49 +0200 | |
4 | Subject: ALSA: aloop: Mark paused device as inactive | |
5 | ||
6 | From: Robert Rosengren <robert.rosengren@axis.com> | |
7 | ||
8 | commit 306a4f3ca7f3c7dfa473ebd19d66e40e59d99734 upstream. | |
9 | ||
10 | Show paused ALSA aloop device as inactive, i.e. the control | |
11 | "PCM Slave Active" set as false. Notification sent upon state change. | |
12 | ||
13 | This makes it possible for client capturing from aloop device to know if | |
14 | data is expected. Without it the client expects data even if playback | |
15 | is paused. | |
16 | ||
17 | Signed-off-by: Robert Rosengren <robert.rosengren@axis.com> | |
18 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
19 | Signed-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 | } |