asoc: msm-lsm-client: abort LAB buffering before stop session and close TX

Currently we only set read_abort flag to stop LAB buffering before we call
q6lsm_stop_lab. There is a possibility that this step is skipped under
certain circumstances. This might cause ADSP crash as a result. Therefore,
set flag read_abort before calling q6lsm_stop and q6lsm_close to make sure
LAB buffering is stopped before closing a SVA session.

Change-Id: I7364c31348f908d8920e32f811745549cf305901
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang 2019-12-16 17:07:41 -08:00 • committed by Gerrit - the friendly Code Review server
commit 9d98d48b38

View file

@ -1460,6 +1460,12 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
prtd->lsm_client->lab_started = false;
}
}
if (!atomic_read(&prtd->read_abort)) {
dev_dbg(rtd->dev,
"%s: set read_abort to stop buffering\n", __func__);
atomic_set(&prtd->read_abort, 1);
}
rc = q6lsm_stop(prtd->lsm_client, true);
if (!rc)
dev_dbg(rtd->dev,
@ -2665,6 +2671,12 @@ static int msm_lsm_close(struct snd_pcm_substream *substream)
__func__, ret);
}
}
if (!atomic_read(&prtd->read_abort)) {
dev_dbg(rtd->dev,
"%s: set read_abort to stop buffering\n", __func__);
atomic_set(&prtd->read_abort, 1);
}
ret = q6lsm_stop(prtd->lsm_client, true);
if (ret)
dev_err(rtd->dev,
@ -2695,6 +2707,11 @@ static int msm_lsm_close(struct snd_pcm_substream *substream)
SNDRV_PCM_STREAM_CAPTURE);
if (prtd->lsm_client->opened) {
if (!atomic_read(&prtd->read_abort)) {
dev_dbg(rtd->dev,
"%s: set read_abort to stop buffering\n", __func__);
atomic_set(&prtd->read_abort, 1);
}
q6lsm_close(prtd->lsm_client);
prtd->lsm_client->opened = false;
}