[RFC PATCH v2 4/4] ASoC: Intel: avs: Pause detecting pipeline before reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



FW pipeline machine state follows specific order, so running path
needs to be paused before it can reset pipelines.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@xxxxxxxxxxxxxxx>
---
 sound/soc/intel/avs/path.c | 5 +++++
 sound/soc/intel/avs/path.h | 1 +
 sound/soc/intel/avs/pcm.c  | 8 ++++++++
 3 files changed, 14 insertions(+)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 5e7b9151178fa..3511ee7c0e22e 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -1102,3 +1102,8 @@ int avs_path_run(struct avs_path *path, int trigger)
 
 	return 0;
 }
+
+bool avs_path_is_detecting(struct avs_path *path)
+{
+	return (path->state == AVS_PATH_STATE_DETECTING);
+}
diff --git a/sound/soc/intel/avs/path.h b/sound/soc/intel/avs/path.h
index a60e6d2f4ad5c..48441a44c547b 100644
--- a/sound/soc/intel/avs/path.h
+++ b/sound/soc/intel/avs/path.h
@@ -76,5 +76,6 @@ int avs_path_unbind(struct avs_path *path);
 int avs_path_reset(struct avs_path *path);
 int avs_path_pause(struct avs_path *path);
 int avs_path_run(struct avs_path *path, int trigger);
+bool avs_path_is_detecting(struct avs_path *path);
 
 #endif
diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 0b618b1d04689..f54dc1ee6b9b2 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -178,6 +178,14 @@ static int avs_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_d
 	if (!data->path)
 		return 0;
 
+	if (avs_path_is_detecting(data->path)) {
+		ret = avs_path_pause(data->path);
+		if (ret < 0) {
+			dev_err(dai->dev, "pause path failed: %d\n", ret);
+			return ret;
+		}
+	}
+
 	ret = avs_path_reset(data->path);
 	if (ret < 0) {
 		dev_err(dai->dev, "reset path failed: %d\n", ret);
-- 
2.34.1





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux