summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dai.h4
-rw-r--r--sound/soc/soc-compress.c8
-rw-r--r--sound/soc/soc-dai.c13
3 files changed, 19 insertions, 6 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 4bf759f025d2..6f54401d3de9 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -196,7 +196,8 @@ int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream);
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
- struct snd_compr_stream *cstream);
+ struct snd_compr_stream *cstream,
+ int rollback);
int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream, int cmd);
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
@@ -400,6 +401,7 @@ struct snd_soc_dai {
/* function mark */
struct snd_pcm_substream *mark_startup;
struct snd_pcm_substream *mark_hw_params;
+ struct snd_compr_stream *mark_compr_startup;
/* bit field */
unsigned int probed:1;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 792c2aa1a3c0..d85b6b174006 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -45,7 +45,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
snd_soc_component_compr_free(cstream, NULL);
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 0);
snd_soc_dapm_stream_stop(rtd, stream);
@@ -91,7 +91,7 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
machine_err:
snd_soc_component_compr_free(cstream, component);
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
out:
mutex_unlock(&rtd->card->pcm_mutex);
pm_err:
@@ -165,7 +165,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
machine_err:
snd_soc_component_compr_free(cstream, component);
open_err:
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 1);
out:
dpcm_path_put(&list);
be_err:
@@ -211,7 +211,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
snd_soc_component_compr_free(cstream, NULL);
- snd_soc_dai_compr_shutdown(cpu_dai, cstream);
+ snd_soc_dai_compr_shutdown(cpu_dai, cstream, 0);
mutex_unlock(&fe->card->mutex);
return 0;
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 2686a566649b..9afc6e8c3f9f 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -612,16 +612,27 @@ int snd_soc_dai_compr_startup(struct snd_soc_dai *dai,
dai->driver->cops->startup)
ret = dai->driver->cops->startup(cstream, dai);
+ /* mark cstream if succeeded */
+ if (ret == 0)
+ soc_dai_mark_push(dai, cstream, compr_startup);
+
return soc_dai_ret(dai, ret);
}
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_startup);
void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai,
- struct snd_compr_stream *cstream)
+ struct snd_compr_stream *cstream,
+ int rollback)
{
+ if (rollback && !soc_dai_mark_match(dai, cstream, compr_startup))
+ return;
+
if (dai->driver->cops &&
dai->driver->cops->shutdown)
dai->driver->cops->shutdown(cstream, dai);
+
+ /* remove marked cstream */
+ soc_dai_mark_pop(dai, cstream, compr_startup);
}
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_shutdown);