ASoC: dpcm: allow start or stop during pause for backend
diff mbox series

Message ID 004d01d607c1$7a3d5250$6eb7f6f0$@samsung.com
State Accepted
Commit 21fca8bdbb64df1297e8c65a746c4c9f4a689751
Headers show
Series
  • ASoC: dpcm: allow start or stop during pause for backend
Related show

Commit Message

Gyeongtaek Lee April 1, 2020, 1:04 a.m. UTC
soc_compr_trigger_fe() allows start or stop after pause_push.
In dpcm_be_dai_trigger(), however, only pause_release is allowed
command after pause_push.
So, start or stop after pause in compress offload is always
returned as error if the compress offload is used with dpcm.
To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed
for start or stop command.

Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
---
 sound/soc/soc-pcm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Vinod Koul April 1, 2020, 5:06 a.m. UTC | #1
Hello Gyeongtaek,

On 01-04-20, 10:04, �̰��� wrote:
> soc_compr_trigger_fe() allows start or stop after pause_push.
> In dpcm_be_dai_trigger(), however, only pause_release is allowed
> command after pause_push.
> So, start or stop after pause in compress offload is always
> returned as error if the compress offload is used with dpcm.
> To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed
> for start or stop command.

I think it makes sense to allow START if the stream is paused. Similarly
a STOP should be legal as well for paused stream, so:

Reviewed-by: Vinod Koul <vkoul@kernel.org>

> 
> Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com>
> ---
>  sound/soc/soc-pcm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 2c59b3688ca0..8f6f0ad50288 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -2236,7 +2236,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
>  		switch (cmd) {
>  		case SNDRV_PCM_TRIGGER_START:
>  			if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
> -			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
> +			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
> +			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
>  				continue;
>  
>  			ret = dpcm_do_trigger(dpcm, be_substream, cmd);
> @@ -2266,7 +2267,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
>  			be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
>  			break;
>  		case SNDRV_PCM_TRIGGER_STOP:
> -			if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
> +			if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) &&
> +			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
>  				continue;
>  
>  			if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))
> -- 
> 2.21.0
>

Patch
diff mbox series

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 2c59b3688ca0..8f6f0ad50288 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2236,7 +2236,8 @@  int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
 		switch (cmd) {
 		case SNDRV_PCM_TRIGGER_START:
 			if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
-			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) &&
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
 				continue;
 
 			ret = dpcm_do_trigger(dpcm, be_substream, cmd);
@@ -2266,7 +2267,8 @@  int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
 			be->dpcm[stream].state = SND_SOC_DPCM_STATE_START;
 			break;
 		case SNDRV_PCM_TRIGGER_STOP:
-			if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
+			if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_START) &&
+			    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED))
 				continue;
 
 			if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))