volume: volume_cmd(): only stop/pause at running

We should only stop/pause it when the volume component is in
running status.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2017-02-11 10:17:58 +08:00 committed by Liam Girdwood
parent f3aec1d744
commit 7d0c7b6c1d
1 changed files with 7 additions and 2 deletions

View File

@ -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;
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;