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

Commit fe625454 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: Change device switch handling



Change device handling of NOIRQ drivers. Clients
are expected to call RESET ioctl instead of XRUN
ioctl

Bug: 30615611
CRs-Fixed: 1051762
Change-Id: Ife6146d28c8bc834a79e861959eca03e58e12d5e
Signed-off-by: default avatarHaynes Mathew George <hgeorge@codeaurora.org>
parent 6beb213a
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -390,6 +390,30 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
	return ret;
}

static int msm_pcm_ioctl(struct snd_pcm_substream *substream,
			 unsigned int cmd, void *arg)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct msm_audio *prtd = runtime->private_data;
	int dir = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 0 : 1;
	struct audio_buffer *buf;

	switch (cmd) {
	case SNDRV_PCM_IOCTL1_RESET:
		pr_debug("%s: %s SNDRV_PCM_IOCTL1_RESET\n", __func__,
		       dir == 0 ? "P" : "C");
		buf = q6asm_shared_io_buf(prtd->audio_client, dir);

		if (buf && buf->data)
			memset(buf->data, 0, buf->actual_size);
		break;
	default:
		break;
	}

	return snd_pcm_lib_ioctl(substream, cmd, arg);
}

static snd_pcm_uframes_t msm_pcm_pointer(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
@@ -723,7 +747,7 @@ static struct snd_pcm_ops msm_pcm_ops = {
	.prepare        = msm_pcm_prepare,
	.copy           = msm_pcm_copy,
	.hw_params	= msm_pcm_hw_params,
	.ioctl          = snd_pcm_lib_ioctl,
	.ioctl          = msm_pcm_ioctl,
	.trigger        = msm_pcm_trigger,
	.pointer        = msm_pcm_pointer,
	.mmap           = msm_pcm_mmap,