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

Commit 3a4b1a3f authored by Ben Romberger's avatar Ben Romberger Committed by Gerrit - the friendly Code Review server
Browse files

Asoc: msm: qdsp6v2: Track compress stream open properly



Set the stream open flag immediately after the
stream is opened to ensure correct closure of
the stream if there is an error condition.

Change-Id: I61faf6ddf99ab504e492a4e37d577b67acf99f09
Signed-off-by: default avatarBen Romberger <bromberg@codeaurora.org>
parent 50239ba4
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -931,6 +931,12 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
	};

	pr_debug("%s: stream_id %d\n", __func__, ac->stream_id);
	stream_index = STREAM_ARRAY_INDEX(ac->stream_id);
	if (stream_index >= MAX_NUMBER_OF_STREAMS || stream_index < 0) {
		pr_err("%s: Invalid stream index:%d", __func__, stream_index);
		return -EINVAL;
	}

	if (prtd->codec_param.codec.format == SNDRV_PCM_FORMAT_S24_LE)
		bits_per_sample = 24;
	else if (prtd->codec_param.codec.format == SNDRV_PCM_FORMAT_S32_LE)
@@ -944,6 +950,8 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
				__func__, ret, prtd->compr_passthr);
			return ret;
		}
		prtd->gapless_state.stream_opened[stream_index] = 1;

		ret = msm_pcm_routing_reg_phy_compr_stream(
				soc_prtd->dai_link->be_id,
				ac->perf_mode,
@@ -967,6 +975,7 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
				__func__, ret, prtd->compr_passthr);
			 return -ENOMEM;
		}
		prtd->gapless_state.stream_opened[stream_index] = 1;

		pr_debug("%s: be_id %d\n", __func__, soc_prtd->dai_link->be_id);
		ret = msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id,
@@ -1001,13 +1010,7 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
		pr_err("%s: Set IO mode failed\n", __func__);
		return -EINVAL;
	}
	stream_index = STREAM_ARRAY_INDEX(ac->stream_id);
	if (stream_index >= MAX_NUMBER_OF_STREAMS || stream_index < 0) {
		pr_err("%s: Invalid stream index:%d", __func__, stream_index);
		return -EINVAL;
	}

	prtd->gapless_state.stream_opened[stream_index] = 1;
	runtime->fragments = prtd->codec_param.buffer.fragments;
	runtime->fragment_size = prtd->codec_param.buffer.fragment_size;
	pr_debug("allocate %d buffers each of size %d\n",