Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0078bd74 authored by Eric Laurent's avatar Eric Laurent Committed by Dhananjay Kumar
Browse files

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: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarEric Laurent <elaurent@google.com>
Git-commit: 1526720efd071cd9fdbf6c581417cfd51aaaf965
Git-repo: https://android.googlesource.com/kernel/msm


Signed-off-by: default avatarDhananjay Kumar <dhakumar@codeaurora.org>
parent 413db9c2
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -297,6 +297,17 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	int ret = 0;

	/* for partial-drain/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) {
@@ -325,6 +336,17 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
	struct snd_soc_platform *platform = fe->platform;
	int ret = 0, stream;

	/* for partial-drain/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