[Sound-open-firmware] [PATCH v3 17/27] component: status: rename COMP_STATE_STOPPED to COMP_STATE_SETUP

Keyon Jie yang.jie at linux.intel.com
Sat Feb 11 03:17:57 CET 2017


For component 'inactive, but ready' status, naming 'SETUP' may
be more understandable than 'STOPPED', and 'SETUP' is consistent
with ALSA.

     new()        params()       start()
none ======> init =======> setup ======> running
     <======      <=======       <======
     free()       reset()         stop()
---
 src/audio/dai.c                    |  2 +-
 src/audio/host.c                   |  2 +-
 src/audio/mixer.c                  |  2 +-
 src/audio/volume.c                 |  2 +-
 src/include/reef/audio/component.h | 12 +++++++++---
 5 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/audio/dai.c b/src/audio/dai.c
index e827045..9c40b2f 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -403,7 +403,7 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data)
 			dai_trigger(dd->ssp, cmd, dd->direction);
 		/* go through */
 		case COMP_STATE_PREPARE:
-			dev->state = COMP_STATE_INIT;
+			dev->state = COMP_STATE_SETUP;
 			break;
 		}
 		break;
diff --git a/src/audio/host.c b/src/audio/host.c
index 7c0e9f3..5c9f1ad 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -688,7 +688,7 @@ static int host_stop(struct comp_dev *dev)
 	local_elem->src = source_elem->src;
 	hd->next_inc = hd->period->size;
 
-	dev->state = COMP_STATE_STOPPED;
+	dev->state = COMP_STATE_SETUP;
 	return 0;
 }
 
diff --git a/src/audio/mixer.c b/src/audio/mixer.c
index 3a8d12f..4487862 100644
--- a/src/audio/mixer.c
+++ b/src/audio/mixer.c
@@ -250,7 +250,7 @@ static int mixer_reset(struct comp_dev *dev)
 	list_for_item(blist, &dev->bsource_list) {
 		source = container_of(blist, struct comp_buffer, sink_list);
 		/* only mix the sources with the same state with mixer*/
-		if (source->source->state > COMP_STATE_STOPPED)
+		if (source->source->state > COMP_STATE_SETUP)
 			return 1; /* should not reset the downstream components */
 	}
 
diff --git a/src/audio/volume.c b/src/audio/volume.c
index 75684b6..03e9dd4 100644
--- a/src/audio/volume.c
+++ b/src/audio/volume.c
@@ -429,7 +429,7 @@ 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_STOPPED;
+		dev->state = COMP_STATE_SETUP;
 		break;
 	case COMP_CMD_PAUSE:
 		dev->state = COMP_STATE_PAUSED;
diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h
index bbd9b33..9275abd 100644
--- a/src/include/reef/audio/component.h
+++ b/src/include/reef/audio/component.h
@@ -40,10 +40,16 @@
 #include <reef/dma.h>
 #include <reef/stream.h>
 
-/* audio component states */
+/* audio component states
+ * the states may transform as below:
+ *        new()         params()          start()
+ * none	-----> init ------> setup -----> running
+ * none	<----- init <------ setup <----- running
+ *        free()          reset()             stop()
+ */
 #define COMP_STATE_INIT		0	/* component being initialised */
-#define COMP_STATE_SUSPEND	1	/* component suspended */
-#define COMP_STATE_STOPPED	2	/* component inactive, but ready */
+#define COMP_STATE_SETUP       1       /* component inactive, but ready */
+#define COMP_STATE_SUSPEND     2       /* component suspended */
 #define COMP_STATE_DRAINING	3	/* component draining */
 #define COMP_STATE_PREPARE	4	/* component prepared */
 #define COMP_STATE_PAUSED	5	/* component paused */
-- 
2.7.4



More information about the Sound-open-firmware mailing list