summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-link.c12
-rw-r--r--sound/soc/soc-pcm.c4
2 files changed, 13 insertions, 3 deletions
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index 2a8881978930..409ae4940da3 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -119,16 +119,26 @@ int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
rtd->dai_link->ops->hw_params)
ret = rtd->dai_link->ops->hw_params(substream, params);
+ /* mark substream if succeeded */
+ if (ret == 0)
+ soc_link_mark_push(rtd, substream, hw_params);
+
return soc_link_ret(rtd, ret);
}
-void snd_soc_link_hw_free(struct snd_pcm_substream *substream)
+void snd_soc_link_hw_free(struct snd_pcm_substream *substream, int rollback)
{
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+ if (rollback && !soc_link_mark_match(rtd, substream, hw_params))
+ return;
+
if (rtd->dai_link->ops &&
rtd->dai_link->ops->hw_free)
rtd->dai_link->ops->hw_free(substream);
+
+ /* remove marked substream */
+ soc_link_mark_pop(rtd, substream, hw_params);
}
int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 697c9cb4a127..8c69288f1bf5 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -886,7 +886,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
}
/* free any machine hw params */
- snd_soc_link_hw_free(substream);
+ snd_soc_link_hw_free(substream, 0);
/* free any component resources */
snd_soc_pcm_component_hw_free(substream, NULL);
@@ -1028,7 +1028,7 @@ codec_err:
codec_dai->rate = 0;
}
- snd_soc_link_hw_free(substream);
+ snd_soc_link_hw_free(substream, 1);
mutex_unlock(&rtd->card->pcm_mutex);
return ret;