Skip to content
Snippets Groups Projects
Commit db1730df authored by Vidyakumar Athota's avatar Vidyakumar Athota Committed by z00208928
Browse files

ASoC: qdsp6v2: reset LAB buffers to zero during stop


Since LAB buffers are not reset during LAB_STOP command,
there is a chance that the userspace get stale data from
the previous LAB data buffers. Clear the buffers at every
LAB_STOP command.

Change-Id: Id410dbe28d2f62e52c56677a8b0f297369111385
Signed-off-by: default avatarVidyakumar Athota <vathota@codeaurora.org>
parent ec70927f
Branches
Tags
No related merge requests found
...@@ -963,6 +963,7 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream, ...@@ -963,6 +963,7 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
"%s: Stopping LSM client session\n", "%s: Stopping LSM client session\n",
__func__); __func__);
if (prtd->lsm_client->started) { if (prtd->lsm_client->started) {
int i;
if (prtd->lsm_client->lab_enable) { if (prtd->lsm_client->lab_enable) {
atomic_set(&prtd->read_abort, 1); atomic_set(&prtd->read_abort, 1);
if (prtd->lsm_client->lab_started) { if (prtd->lsm_client->lab_started) {
...@@ -972,6 +973,9 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream, ...@@ -972,6 +973,9 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
"%s: stop lab failed ret %d\n", "%s: stop lab failed ret %d\n",
__func__, ret); __func__, ret);
prtd->lsm_client->lab_started = false; prtd->lsm_client->lab_started = false;
for (i = 0; i < prtd->lsm_client->hw_params.period_count; i++)
memset(prtd->lsm_client->lab_buffer[i].data, 0,
prtd->lsm_client->lab_buffer[i].size);
} }
} }
ret = q6lsm_stop(prtd->lsm_client, true); ret = q6lsm_stop(prtd->lsm_client, true);
...@@ -1035,6 +1039,7 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream, ...@@ -1035,6 +1039,7 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
dev_dbg(rtd->dev, "%s: stopping LAB\n", __func__); dev_dbg(rtd->dev, "%s: stopping LAB\n", __func__);
if (prtd->lsm_client->lab_enable && if (prtd->lsm_client->lab_enable &&
prtd->lsm_client->lab_started) { prtd->lsm_client->lab_started) {
int i;
atomic_set(&prtd->read_abort, 1); atomic_set(&prtd->read_abort, 1);
rc = q6lsm_stop_lab(prtd->lsm_client); rc = q6lsm_stop_lab(prtd->lsm_client);
if (rc) if (rc)
...@@ -1043,6 +1048,9 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream, ...@@ -1043,6 +1048,9 @@ static int msm_lsm_ioctl_shared(struct snd_pcm_substream *substream,
__func__, __func__,
prtd->lsm_client->session, rc); prtd->lsm_client->session, rc);
prtd->lsm_client->lab_started = false; prtd->lsm_client->lab_started = false;
for (i = 0; i < prtd->lsm_client->hw_params.period_count; i++)
memset(prtd->lsm_client->lab_buffer[i].data, 0,
prtd->lsm_client->lab_buffer[i].size);
} }
break; break;
default: default:
...@@ -1875,7 +1883,7 @@ static int msm_lsm_pcm_copy(struct snd_pcm_substream *substream, int ch, ...@@ -1875,7 +1883,7 @@ static int msm_lsm_pcm_copy(struct snd_pcm_substream *substream, int ch,
return 0; return 0;
} }
rc = wait_event_timeout(prtd->period_wait, rc = wait_event_timeout(prtd->period_wait,
(atomic_read(&prtd->buf_count) | (atomic_read(&prtd->buf_count) ||
atomic_read(&prtd->read_abort)), (2 * HZ)); atomic_read(&prtd->read_abort)), (2 * HZ));
if (!rc) { if (!rc) {
dev_err(rtd->dev, dev_err(rtd->dev,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment