linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: aloop: Mark paused device as inactive
@ 2018-03-26  5:24 Robert Rosengren
  2018-03-26 14:43 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Rosengren @ 2018-03-26  5:24 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel; +Cc: linux-kernel, Robert Rosengren

Show paused ALSA aloop device as inactive, i.e. the control
"PCM Slave Active" set as false. Notification sent upon state change.

This makes it possible for client capturing from aloop device to know if
data is expected. Without it the client expects data even if playback
is paused.

Signed-off-by: Robert Rosengren <robertr@axis.com>
---
 sound/drivers/aloop.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 0333143a1fa7..5404ab11132d 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -291,6 +291,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
 		cable->pause |= stream;
 		loopback_timer_stop(dpcm);
 		spin_unlock(&cable->lock);
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			loopback_active_notify(dpcm);
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 	case SNDRV_PCM_TRIGGER_RESUME:
@@ -299,6 +301,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
 		cable->pause &= ~stream;
 		loopback_timer_start(dpcm);
 		spin_unlock(&cable->lock);
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+			loopback_active_notify(dpcm);
 		break;
 	default:
 		return -EINVAL;
@@ -879,9 +883,11 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,
 			[kcontrol->id.subdevice][kcontrol->id.device ^ 1];
 	unsigned int val = 0;
 
-	if (cable != NULL)
-		val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ?
-									1 : 0;
+	if (cable != NULL) {
+		unsigned int running = cable->running ^ cable->pause;
+
+		val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0;
+	}
 	ucontrol->value.integer.value[0] = val;
 	return 0;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: aloop: Mark paused device as inactive
  2018-03-26  5:24 [PATCH] ALSA: aloop: Mark paused device as inactive Robert Rosengren
@ 2018-03-26 14:43 ` Takashi Iwai
  2018-03-27  5:41   ` Robert Rosengren
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2018-03-26 14:43 UTC (permalink / raw)
  To: Robert Rosengren
  Cc: alsa-devel, Jaroslav Kysela, Robert Rosengren, linux-kernel

On Mon, 26 Mar 2018 07:24:49 +0200,
Robert Rosengren wrote:
> 
> Show paused ALSA aloop device as inactive, i.e. the control
> "PCM Slave Active" set as false. Notification sent upon state change.
> 
> This makes it possible for client capturing from aloop device to know if
> data is expected. Without it the client expects data even if playback
> is paused.
> 
> Signed-off-by: Robert Rosengren <robertr@axis.com>

The code change looks good, but just to be sure:
you've submitted from the address robert.rosengren@axis.com that is
different from the sign-off robertr@axis.com.  Is this intentional?
The former is recorded as the author in git history.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: aloop: Mark paused device as inactive
  2018-03-26 14:43 ` Takashi Iwai
@ 2018-03-27  5:41   ` Robert Rosengren
  2018-03-27  6:01     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Rosengren @ 2018-03-27  5:41 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On 03/26/2018 04:43 PM, Takashi Iwai wrote:
> On Mon, 26 Mar 2018 07:24:49 +0200,
> Robert Rosengren wrote:
>>
>> Show paused ALSA aloop device as inactive, i.e. the control
>> "PCM Slave Active" set as false. Notification sent upon state change.
>>
>> This makes it possible for client capturing from aloop device to know if
>> data is expected. Without it the client expects data even if playback
>> is paused.
>>
>> Signed-off-by: Robert Rosengren <robertr@axis.com>
> 
> The code change looks good, but just to be sure:
> you've submitted from the address robert.rosengren@axis.com that is
> different from the sign-off robertr@axis.com.  Is this intentional?
> The former is recorded as the author in git history.
> 
> 
> thanks,
> 
> Takashi
> 

Sorry for the confusion. It is not intentional to use different though both are valid, apparently I have used the longer one in earlier patches to kernel so please change:
Signed-off-by: Robert Rosengren <robert.rosengren@axis.com>

Thanks for letting me know!
Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALSA: aloop: Mark paused device as inactive
  2018-03-27  5:41   ` Robert Rosengren
@ 2018-03-27  6:01     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-03-27  6:01 UTC (permalink / raw)
  To: Robert Rosengren; +Cc: alsa-devel, Jaroslav Kysela, linux-kernel

On Tue, 27 Mar 2018 07:41:44 +0200,
Robert Rosengren wrote:
> 
> On 03/26/2018 04:43 PM, Takashi Iwai wrote:
> > On Mon, 26 Mar 2018 07:24:49 +0200,
> > Robert Rosengren wrote:
> >>
> >> Show paused ALSA aloop device as inactive, i.e. the control
> >> "PCM Slave Active" set as false. Notification sent upon state change.
> >>
> >> This makes it possible for client capturing from aloop device to know if
> >> data is expected. Without it the client expects data even if playback
> >> is paused.
> >>
> >> Signed-off-by: Robert Rosengren <robertr@axis.com>
> > 
> > The code change looks good, but just to be sure:
> > you've submitted from the address robert.rosengren@axis.com that is
> > different from the sign-off robertr@axis.com.  Is this intentional?
> > The former is recorded as the author in git history.
> > 
> > 
> > thanks,
> > 
> > Takashi
> > 
> 
> Sorry for the confusion. It is not intentional to use different though both are valid, apparently I have used the longer one in earlier patches to kernel so please change:
> Signed-off-by: Robert Rosengren <robert.rosengren@axis.com>

OK, applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-27  6:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26  5:24 [PATCH] ALSA: aloop: Mark paused device as inactive Robert Rosengren
2018-03-26 14:43 ` Takashi Iwai
2018-03-27  5:41   ` Robert Rosengren
2018-03-27  6:01     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).