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

Keyon Jie yang.jie at linux.intel.com
Tue Feb 7 15:03:05 CET 2017


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



More information about the Sound-open-firmware mailing list