ASoC: compress: dont aquire lock for draining states
Both draining and partial draning states will take a while getting executed. The
lock aquired will block the other operations like pause, stop etc which are
perfectly valid cmds during these states. So don't use mutex while invoking DSP
for these ops.
Change-Id: I38f824f6b983de218e86d31af23c628930905427
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 3d9f043..3d8033b 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -301,6 +301,17 @@
struct snd_soc_dai *codec_dai = rtd->codec_dai;
int ret = 0;
+ /* for partial drain and drain cmd, don't acquire lock while invoking DSP.
+ * These calls will be blocked till these operation can complete which
+ * will be a while. And during that time, app can invoke STOP, PAUSE etc
+ */
+ if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
+ cmd == SND_COMPR_TRIGGER_DRAIN) {
+ if (platform->driver->compr_ops &&
+ platform->driver->compr_ops->trigger)
+ return platform->driver->compr_ops->trigger(cstream, cmd);
+ }
+
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
if (platform->driver->compr_ops && platform->driver->compr_ops->trigger) {
@@ -331,6 +342,17 @@
struct snd_soc_platform *platform = fe->platform;
int ret = 0, stream;
+ /* for partial drain and drain cmd, don't acquire lock while invoking DSP.
+ * These calls will be blocked till these operation can complete which
+ * will be a while. And during that time, app can invoke STOP, PAUSE etc
+ */
+ if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
+ cmd == SND_COMPR_TRIGGER_DRAIN) {
+ if (platform->driver->compr_ops &&
+ platform->driver->compr_ops->trigger)
+ return platform->driver->compr_ops->trigger(cstream, cmd);
+ }
+
if (cstream->direction == SND_COMPRESS_PLAYBACK)
stream = SNDRV_PCM_STREAM_PLAYBACK;
else