Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
	tiwai@suse.de, patches@opensource.wolfsonmicro.com,
	lgirdwood@gmail.com
Subject: Re: [PATCH 1/1] ALSA: compress_core: Ensure device is stopped when stream closed
Date: Fri, 26 Apr 2013 22:12:55 +0530	[thread overview]
Message-ID: <20130426164255.GF24632@intel.com> (raw)
In-Reply-To: <20130426134706.GA27501@opensource.wolfsonmicro.com>

On Fri, Apr 26, 2013 at 02:47:06PM +0100, Richard Fitzgerald wrote:
> If the stream state is running or paused when device file is
> closed snd_compr_free() will send a SNDRV_PCM_TRIGGER_STOP
> to the stream.
> 
> Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
> ---
>  sound/core/compress_offload.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index 91e6bcb..a81c5e4 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -132,6 +132,11 @@ static int snd_compr_open(struct inode *inode, struct file *f)
>  static int snd_compr_free(struct inode *inode, struct file *f)
>  {
>  	struct snd_compr_file *data = f->private_data;
> +
> +	if ((data->stream.runtime->state == SNDRV_PCM_STATE_RUNNING) ||
> +	    (data->stream.runtime->state == SNDRV_PCM_STATE_PAUSED))
> +		data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
two things:
1. I like Mark's idea the switch will make it look better :)
2. why do you want to do explicit stop when you are freeing. Esp the Paused
cases doesnt make sense. Shouldnt the DSP be able to handle this transistion?

--
~Vinod
> +
>  	data->stream.ops->free(&data->stream);
>  	kfree(data->stream.runtime->buffer);
>  	kfree(data->stream.runtime);
> -- 
> 1.7.2.5
> 

  parent reply	other threads:[~2013-04-26 17:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 13:47 [PATCH 1/1] ALSA: compress_core: Ensure device is stopped when stream closed Richard Fitzgerald
2013-04-26 13:48 ` Mark Brown
2013-04-26 13:56   ` Richard Fitzgerald
2013-04-26 15:38     ` Mark Brown
2013-04-26 16:42 ` Vinod Koul [this message]
2013-04-29  9:36   ` Richard Fitzgerald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130426164255.GF24632@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox