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

Commit df2a792c authored by Meng Wang's avatar Meng Wang Committed by Gerrit - the friendly Code Review server
Browse files

ALSA: core: Add support to handle compressed audio IOCTLs



This is needed to support the compressed audio till the
compressed core is done with development.

Change-Id: Ifbde76e3bd0f354063bf2677dcca2f922fc3aeb9
Signed-off-by: default avatarAsish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: default avatarMeng Wang <mwang@codeaurora.org>
parent 73345215
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <linux/dma-mapping.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/compress_offload.h>
#include <sound/info.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -1259,6 +1260,20 @@ static int snd_pcm_start_lock_irq(struct snd_pcm_substream *substream)
				       SNDRV_PCM_STATE_RUNNING);
}

static int snd_compressed_ioctl(struct snd_pcm_substream *substream,
				unsigned int cmd, void __user *arg)
{
	struct snd_pcm_runtime *runtime;
	int err = 0;

	if (PCM_RUNTIME_CHECK(substream))
		return -ENXIO;
	runtime = substream->runtime;
	pr_debug("%s called with cmd = %d\n", __func__, cmd);
	err = substream->ops->ioctl(substream, cmd, arg);
	return err;
}

/*
 * stop callbacks
 */
@@ -2949,6 +2964,13 @@ static int snd_pcm_common_ioctl(struct file *file,
		return snd_pcm_rewind_ioctl(substream, arg);
	case SNDRV_PCM_IOCTL_FORWARD:
		return snd_pcm_forward_ioctl(substream, arg);
	case SNDRV_COMPRESS_GET_CAPS:
	case SNDRV_COMPRESS_GET_CODEC_CAPS:
	case SNDRV_COMPRESS_SET_PARAMS:
	case SNDRV_COMPRESS_GET_PARAMS:
	case SNDRV_COMPRESS_TSTAMP:
	case SNDRV_COMPRESS_DRAIN:
		return snd_compressed_ioctl(substream, cmd, arg);
	}
	pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd);
	return -ENOTTY;
@@ -2961,7 +2983,10 @@ static long snd_pcm_ioctl(struct file *file, unsigned int cmd,

	pcm_file = file->private_data;

	if (((cmd >> 8) & 0xff) != 'A')
	if ((((cmd >> 8) & 0xff) != 'A') &&
		((pcm_file->substream->stream == SNDRV_PCM_STREAM_CAPTURE) ||
		(pcm_file->substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
		(((cmd >> 8) & 0xff) != 'C'))))
		return -ENOTTY;

	return snd_pcm_common_ioctl(file, pcm_file->substream, cmd,