Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm_dmaengine: Add check during device suspend
@ 2014-05-19  9:23 Tushar Behera
  2014-05-19  9:28 ` Lars-Peter Clausen
  2014-05-19  9:34 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Tushar Behera @ 2014-05-19  9:23 UTC (permalink / raw)
  To: linux-kernel, alsa-devel; +Cc: tiwai, perex, lars

Currently snd_dmaengine_pcm_trigger() calls dmaengine_pause()
unconditinally during device suspend. In case where DMA controller
doesn't support PAUSE/RESUME functionality, this call is not able
to stop the DMA controller. In this scenario, audio playback doesn't
resume after device resume.

Calling dmaengine_pause/dmaengine_terminate_all conditionally fixes
the issue.

It has been tested with audio playback on Samsung platform having
PL330 DMA controller which doesn't support PAUSE/RESUME.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/core/pcm_dmaengine.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
index 94d0873..76cbb9e 100644
--- a/sound/core/pcm_dmaengine.c
+++ b/sound/core/pcm_dmaengine.c
@@ -182,6 +182,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
 int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 {
 	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
+	struct snd_pcm_runtime *runtime = substream->runtime;
 	int ret;
 
 	switch (cmd) {
@@ -196,6 +197,11 @@ int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 		dmaengine_resume(prtd->dma_chan);
 		break;
 	case SNDRV_PCM_TRIGGER_SUSPEND:
+		if (runtime->info & SNDRV_PCM_INFO_PAUSE)
+			dmaengine_pause(prtd->dma_chan);
+		else
+			dmaengine_terminate_all(prtd->dma_chan);
+		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		dmaengine_pause(prtd->dma_chan);
 		break;
-- 
1.7.9.5

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

* Re: [PATCH] ALSA: pcm_dmaengine: Add check during device suspend
  2014-05-19  9:23 [PATCH] ALSA: pcm_dmaengine: Add check during device suspend Tushar Behera
@ 2014-05-19  9:28 ` Lars-Peter Clausen
  2014-05-19  9:34 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-05-19  9:28 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, alsa-devel, tiwai, perex

On 05/19/2014 11:23 AM, Tushar Behera wrote:
> Currently snd_dmaengine_pcm_trigger() calls dmaengine_pause()
> unconditinally during device suspend. In case where DMA controller
> doesn't support PAUSE/RESUME functionality, this call is not able
> to stop the DMA controller. In this scenario, audio playback doesn't
> resume after device resume.
>
> Calling dmaengine_pause/dmaengine_terminate_all conditionally fixes
> the issue.
>
> It has been tested with audio playback on Samsung platform having
> PL330 DMA controller which doesn't support PAUSE/RESUME.
>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

Thanks.

> ---
>   sound/core/pcm_dmaengine.c |    6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
> index 94d0873..76cbb9e 100644
> --- a/sound/core/pcm_dmaengine.c
> +++ b/sound/core/pcm_dmaengine.c
> @@ -182,6 +182,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
>   int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>   {
>   	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
> +	struct snd_pcm_runtime *runtime = substream->runtime;
>   	int ret;
>
>   	switch (cmd) {
> @@ -196,6 +197,11 @@ int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>   		dmaengine_resume(prtd->dma_chan);
>   		break;
>   	case SNDRV_PCM_TRIGGER_SUSPEND:
> +		if (runtime->info & SNDRV_PCM_INFO_PAUSE)
> +			dmaengine_pause(prtd->dma_chan);
> +		else
> +			dmaengine_terminate_all(prtd->dma_chan);
> +		break;
>   	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
>   		dmaengine_pause(prtd->dma_chan);
>   		break;
>

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

* Re: [PATCH] ALSA: pcm_dmaengine: Add check during device suspend
  2014-05-19  9:23 [PATCH] ALSA: pcm_dmaengine: Add check during device suspend Tushar Behera
  2014-05-19  9:28 ` Lars-Peter Clausen
@ 2014-05-19  9:34 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-05-19  9:34 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, alsa-devel, perex, lars

At Mon, 19 May 2014 14:53:53 +0530,
Tushar Behera wrote:
> 
> Currently snd_dmaengine_pcm_trigger() calls dmaengine_pause()
> unconditinally during device suspend. In case where DMA controller
> doesn't support PAUSE/RESUME functionality, this call is not able
> to stop the DMA controller. In this scenario, audio playback doesn't
> resume after device resume.
> 
> Calling dmaengine_pause/dmaengine_terminate_all conditionally fixes
> the issue.
> 
> It has been tested with audio playback on Samsung platform having
> PL330 DMA controller which doesn't support PAUSE/RESUME.
> 
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>

Thanks, applied with Ack from Las.  Found in for-linus branch of sound
git tree.


Takashi

> ---
>  sound/core/pcm_dmaengine.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
> index 94d0873..76cbb9e 100644
> --- a/sound/core/pcm_dmaengine.c
> +++ b/sound/core/pcm_dmaengine.c
> @@ -182,6 +182,7 @@ static int dmaengine_pcm_prepare_and_submit(struct snd_pcm_substream *substream)
>  int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>  {
>  	struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
> +	struct snd_pcm_runtime *runtime = substream->runtime;
>  	int ret;
>  
>  	switch (cmd) {
> @@ -196,6 +197,11 @@ int snd_dmaengine_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>  		dmaengine_resume(prtd->dma_chan);
>  		break;
>  	case SNDRV_PCM_TRIGGER_SUSPEND:
> +		if (runtime->info & SNDRV_PCM_INFO_PAUSE)
> +			dmaengine_pause(prtd->dma_chan);
> +		else
> +			dmaengine_terminate_all(prtd->dma_chan);
> +		break;
>  	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
>  		dmaengine_pause(prtd->dma_chan);
>  		break;
> -- 
> 1.7.9.5
> 

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

end of thread, other threads:[~2014-05-19  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19  9:23 [PATCH] ALSA: pcm_dmaengine: Add check during device suspend Tushar Behera
2014-05-19  9:28 ` Lars-Peter Clausen
2014-05-19  9:34 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox