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

Commit 5b660a4d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Copy multiple frames per msm-pcm-q6 copy"

parents 7ceea7e7 6907ed4a
Loading
Loading
Loading
Loading
+52 −43
Original line number Diff line number Diff line
@@ -611,8 +611,10 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
	pr_debug("%s: prtd->out_count = %d\n",
				__func__, atomic_read(&prtd->out_count));

	while (fbytes > 0) {
		if (prtd->reset_event) {
		pr_err("%s: In SSR return ENETRESET before wait\n", __func__);
			pr_err("%s: In SSR return ENETRESET before wait\n",
				__func__);
			return -ENETRESET;
		}

@@ -620,11 +622,14 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
				(atomic_read(&prtd->out_count)), 5 * HZ);
		if (!ret) {
			pr_err("%s: wait_event_timeout failed\n", __func__);
			ret = -ETIMEDOUT;
			goto fail;
		}
		ret = 0;

		if (prtd->reset_event) {
		pr_err("%s: In SSR return ENETRESET after wait\n", __func__);
			pr_err("%s: In SSR return ENETRESET after wait\n",
				__func__);
			return -ENETRESET;
		}

@@ -633,22 +638,25 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
			return 0;
		}

	data = q6asm_is_cpu_buf_avail(IN, prtd->audio_client, &size, &idx);
	if (size < fbytes) {
		fbytes = size;
	}
		data = q6asm_is_cpu_buf_avail(IN, prtd->audio_client, &size,
			&idx);
		if (fbytes > size)
			xfer = size;
		else
			xfer = fbytes;

		bufptr = data;
		if (bufptr) {
			pr_debug("%s:fbytes =%d: xfer=%d size=%d\n",
						__func__, fbytes, xfer, size);
		xfer = fbytes;
			if (copy_from_user(bufptr, buf, xfer)) {
				ret = -EFAULT;
				goto fail;
			}
			buf += xfer;
			fbytes -= xfer;
		pr_debug("%s:fbytes = %d: xfer=%d\n", __func__, fbytes, xfer);
			pr_debug("%s:fbytes = %d: xfer=%d\n", __func__, fbytes,
				xfer);
			if (atomic_read(&prtd->start)) {
				pr_debug("%s:writing %d bytes of buffer to dsp\n",
						__func__, xfer);
@@ -662,6 +670,7 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
				atomic_inc(&prtd->out_needed);
			atomic_dec(&prtd->out_count);
		}
	}
fail:
	return  ret;
}