[Sound-open-firmware] [PATCH 18/25] volume: volume_cmd(): only stop/pause at running

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Feb 8 13:09:34 CET 2017


On Tue, 2017-02-07 at 22:03 +0800, Keyon Jie wrote:
> We should only stop/pause it when the volume component is in
> running status.
> 
> Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
> ---
>  src/audio/volume.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/audio/volume.c b/src/audio/volume.c
> index 7a3f608..eb1530f 100644
> --- a/src/audio/volume.c
> +++ b/src/audio/volume.c
> @@ -429,10 +429,15 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data)
>  		dev->state = COMP_STATE_RUNNING;
>  		break;
>  	case COMP_CMD_STOP:
> -		dev->state = COMP_STATE_SETUP;
> +		if (dev->state == COMP_STATE_RUNNING ||
> +				dev->state == COMP_STATE_DRAINING ||
> +				dev->state == COMP_STATE_PAUSED)
> +			dev->state = COMP_STATE_SETUP;

indentation

>  		break;
>  	case COMP_CMD_PAUSE:
> -		dev->state = COMP_STATE_PAUSED;
> +		/* only support pausing for running */
> +		if (dev->state == COMP_STATE_RUNNING)
> +			dev->state = COMP_STATE_PAUSED;
>  		break;
>  	case COMP_CMD_RELEASE:
>  		dev->state = COMP_STATE_RUNNING;




More information about the Sound-open-firmware mailing list