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

Commit efc3dd39 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Dhananjay Kumar
Browse files

ASoC: msm: Adjust refcounts for FE Dai links in SOC compress framework



Adjust refcounts for FE Dai links in SOC compress framework

Change-Id: I3d894fc13e381eb066b3faed0fc76c31493523af
Signed-off-by: default avatarHaynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: default avatarDhananjay Kumar <dhakumar@codeaurora.org>
parent ef18b6ff
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -83,6 +83,10 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
	struct snd_soc_platform *platform = fe->platform;
	struct snd_soc_dpcm *dpcm;
	struct snd_soc_dapm_widget_list *list;

	struct snd_soc_dai *cpu_dai = fe->cpu_dai;
	struct snd_soc_dai *codec_dai = fe->codec_dai;

	int stream;
	int ret = 0;

@@ -139,6 +143,19 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)

	fe->dpcm[stream].state = SND_SOC_DPCM_STATE_OPEN;
	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;

	if (cstream->direction == SND_COMPRESS_PLAYBACK) {
		cpu_dai->playback_active++;
		codec_dai->playback_active++;
	} else {
		cpu_dai->capture_active++;
		codec_dai->capture_active++;
	}

	cpu_dai->active++;
	codec_dai->active++;
	fe->codec->active++;

	mutex_unlock(&fe->card->mutex);

	return 0;
@@ -250,6 +267,10 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
	struct snd_soc_dpcm *dpcm;
	int stream, ret;

	struct snd_soc_dai *cpu_dai = fe->cpu_dai;
	struct snd_soc_dai *codec_dai = fe->codec_dai;
	struct snd_soc_codec *codec = fe->codec;

	if (cstream->direction == SND_COMPRESS_PLAYBACK)
		stream = SNDRV_PCM_STREAM_PLAYBACK;
	else
@@ -257,6 +278,19 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)

	mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);

	if (cstream->direction == SND_COMPRESS_PLAYBACK) {
		cpu_dai->playback_active--;
		codec_dai->playback_active--;
		snd_soc_dai_digital_mute(codec_dai, 1, cstream->direction);
	} else {
		cpu_dai->capture_active--;
		codec_dai->capture_active--;
	}

	cpu_dai->active--;
	codec_dai->active--;
	codec->active--;

	fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;

	ret = dpcm_be_dai_hw_free(fe, stream);