diff mbox series

[RFC,v2,2/4] ASoC: Intel: avs: Separate path state from pipeline state

Message ID 20241112114006.2812697-3-amadeuszx.slawinski@linux.intel.com (mailing list archive)
State RFC
Headers show
Series Add support for detection | expand

Commit Message

Amadeusz Sławiński Nov. 12, 2024, 11:40 a.m. UTC
Currently path states use pipeline state defines. This is problematic if
machine state is to be used to start pipelines in special usecase
scenarios, so provide separate defines for path states and use them.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/intel/avs/path.c | 21 +++++++++++----------
 sound/soc/intel/avs/path.h |  8 ++++++++
 2 files changed, 19 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index f31d5e2caa7b0..fa9ca3faec871 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -891,7 +891,7 @@  static struct avs_path *avs_path_create_unlocked(struct avs_dev *adev, u32 dma_i
 	if (ret < 0)
 		goto err;
 
-	path->state = AVS_PPL_STATE_INVALID;
+	path->state = AVS_PATH_STATE_UNKNOWN;
 	return path;
 err:
 	avs_path_free_unlocked(path);
@@ -1033,7 +1033,7 @@  int avs_path_reset(struct avs_path *path)
 	struct avs_dev *adev = path->owner;
 	int ret;
 
-	if (path->state == AVS_PPL_STATE_RESET)
+	if (path->state == AVS_PATH_STATE_RESET)
 		return 0;
 
 	list_for_each_entry(ppl, &path->ppl_list, node) {
@@ -1041,12 +1041,12 @@  int avs_path_reset(struct avs_path *path)
 						 AVS_PPL_STATE_RESET);
 		if (ret) {
 			dev_err(adev->dev, "reset path failed: %d\n", ret);
-			path->state = AVS_PPL_STATE_INVALID;
+			path->state = AVS_PATH_STATE_UNKNOWN;
 			return AVS_IPC_RET(ret);
 		}
 	}
 
-	path->state = AVS_PPL_STATE_RESET;
+	path->state = AVS_PATH_STATE_RESET;
 	return 0;
 }
 
@@ -1056,7 +1056,7 @@  int avs_path_pause(struct avs_path *path)
 	struct avs_dev *adev = path->owner;
 	int ret;
 
-	if (path->state == AVS_PPL_STATE_PAUSED)
+	if (path->state == AVS_PATH_STATE_PAUSED)
 		return 0;
 
 	list_for_each_entry_reverse(ppl, &path->ppl_list, node) {
@@ -1064,12 +1064,12 @@  int avs_path_pause(struct avs_path *path)
 						 AVS_PPL_STATE_PAUSED);
 		if (ret) {
 			dev_err(adev->dev, "pause path failed: %d\n", ret);
-			path->state = AVS_PPL_STATE_INVALID;
+			path->state = AVS_PATH_STATE_UNKNOWN;
 			return AVS_IPC_RET(ret);
 		}
 	}
 
-	path->state = AVS_PPL_STATE_PAUSED;
+	path->state = AVS_PATH_STATE_PAUSED;
 	return 0;
 }
 
@@ -1079,7 +1079,7 @@  int avs_path_run(struct avs_path *path, int trigger)
 	struct avs_dev *adev = path->owner;
 	int ret;
 
-	if (path->state == AVS_PPL_STATE_RUNNING && trigger == AVS_TPLG_TRIGGER_AUTO)
+	if (path->state == AVS_PATH_STATE_RUNNING && trigger == AVS_TPLG_TRIGGER_AUTO)
 		return 0;
 
 	list_for_each_entry(ppl, &path->ppl_list, node) {
@@ -1090,11 +1090,12 @@  int avs_path_run(struct avs_path *path, int trigger)
 						 AVS_PPL_STATE_RUNNING);
 		if (ret) {
 			dev_err(adev->dev, "run path failed: %d\n", ret);
-			path->state = AVS_PPL_STATE_INVALID;
+			path->state = AVS_PATH_STATE_UNKNOWN;
 			return AVS_IPC_RET(ret);
 		}
 	}
 
-	path->state = AVS_PPL_STATE_RUNNING;
+	path->state = AVS_PATH_STATE_RUNNING;
+
 	return 0;
 }
diff --git a/sound/soc/intel/avs/path.h b/sound/soc/intel/avs/path.h
index bfd253c9fa951..a60e6d2f4ad5c 100644
--- a/sound/soc/intel/avs/path.h
+++ b/sound/soc/intel/avs/path.h
@@ -13,6 +13,14 @@ 
 #include "avs.h"
 #include "topology.h"
 
+enum avs_path_state {
+	AVS_PATH_STATE_UNKNOWN = 0,
+	AVS_PATH_STATE_RESET,
+	AVS_PATH_STATE_PAUSED,
+	AVS_PATH_STATE_DETECTING,
+	AVS_PATH_STATE_RUNNING,
+};
+
 struct avs_path {
 	u32 dma_id;
 	struct list_head ppl_list;