summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dai.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2020-10-09 15:42:31 +0100
committerMark Brown <broonie@kernel.org>2020-10-09 15:42:31 +0100
commitc890e30b069a2792a5a34e8510a7a437dd6f5b3d (patch)
treef7fc7cb5e6fddbe4cae599b41bb39ebc349b94cd /sound/soc/soc-dai.c
parent7ffe09eebf732f9c95623613fb706dada858c07d (diff)
parent86f29c7442ac4ba5fe19fc2ada457f76c0080dd6 (diff)
downloadlinux-c890e30b069a2792a5a34e8510a7a437dd6f5b3d.tar.gz
linux-c890e30b069a2792a5a34e8510a7a437dd6f5b3d.tar.bz2
linux-c890e30b069a2792a5a34e8510a7a437dd6f5b3d.zip
Merge remote-tracking branch 'asoc/for-5.10' into asoc-next
Diffstat (limited to 'sound/soc/soc-dai.c')
-rw-r--r--sound/soc/soc-dai.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 0dbd312aad08..4705c3da6280 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -32,6 +32,14 @@ static inline int _soc_dai_ret(struct snd_soc_dai *dai,
return ret;
}
+/*
+ * We might want to check substream by using list.
+ * In such case, we can update these macros.
+ */
+#define soc_dai_mark_push(dai, substream, tgt) ((dai)->mark_##tgt = substream)
+#define soc_dai_mark_pop(dai, substream, tgt) ((dai)->mark_##tgt = NULL)
+#define soc_dai_mark_match(dai, substream, tgt) ((dai)->mark_##tgt == substream)
+
/**
* snd_soc_dai_set_sysclk - configure DAI system or master clock.
* @dai: DAI
@@ -348,15 +356,26 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
dai->driver->ops->startup)
ret = dai->driver->ops->startup(substream, dai);
+ /* mark substream if succeeded */
+ if (ret == 0)
+ soc_dai_mark_push(dai, substream, startup);
+
return soc_dai_ret(dai, ret);
}
void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
- struct snd_pcm_substream *substream)
+ struct snd_pcm_substream *substream,
+ int rollback)
{
+ if (rollback && !soc_dai_mark_match(dai, substream, startup))
+ return;
+
if (dai->driver->ops &&
dai->driver->ops->shutdown)
dai->driver->ops->shutdown(substream, dai);
+
+ /* remove marked substream */
+ soc_dai_mark_pop(dai, substream, startup);
}
snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,