ASoC: core: Support for compress ioctls

Compat driver should support compress ioctls when
COMPAT mode is enabled. Change adds support for
handling compress ioctls.

Change-Id: If7223ace326253240a1cd65bc9a111b8903977f1
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
This commit is contained in:
Gopikrishnaiah Anandan 2013-12-13 16:14:03 -08:00 committed by David Keitel
parent b45b11503a
commit 9772b42f48
2 changed files with 24 additions and 1 deletions

View file

@ -68,6 +68,8 @@ struct snd_pcm_ops {
int (*close)(struct snd_pcm_substream *substream);
int (*ioctl)(struct snd_pcm_substream * substream,
unsigned int cmd, void *arg);
int (*compat_ioctl)(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg);
int (*hw_params)(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int (*hw_free)(struct snd_pcm_substream *substream);

View file

@ -482,9 +482,27 @@ enum {
SNDRV_PCM_IOCTL_WRITEN_FRAMES32 = _IOW('A', 0x52, struct snd_xfern32),
SNDRV_PCM_IOCTL_READN_FRAMES32 = _IOR('A', 0x53, struct snd_xfern32),
SNDRV_PCM_IOCTL_SYNC_PTR32 = _IOWR('A', 0x23, struct snd_pcm_sync_ptr32),
};
static int snd_compressed_ioctl32(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;
if (substream->ops->compat_ioctl) {
err = substream->ops->compat_ioctl(substream, cmd, arg);
} else {
err = -ENOIOCTLCMD;
pr_err("%s failed cmd = %d\n", __func__, cmd);
}
pr_debug("%s called with cmd = %d\n", __func__, cmd);
return err;
}
static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{
struct snd_pcm_file *pcm_file;
@ -554,6 +572,9 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
return snd_pcm_ioctl_rewind_compat(substream, argp);
case SNDRV_PCM_IOCTL_FORWARD32:
return snd_pcm_ioctl_forward_compat(substream, argp);
default:
if (_IOC_TYPE(cmd) == 'C')
return snd_compressed_ioctl32(substream, cmd, argp);
}
return -ENOIOCTLCMD;