From 4c69e8bc415865095e7d6ee3b456b97c9edf7746 Mon Sep 17 00:00:00 2001 From: Banajit Goswami Date: Mon, 21 Nov 2016 18:14:37 -0800 Subject: [PATCH] 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 Signed-off-by: Banajit Goswami Signed-off-by: Meng Wang --- include/sound/pcm.h | 4 ++++ sound/core/pcm_compat.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 9576a47f2baf..82e6c3496169 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -54,6 +54,10 @@ struct snd_pcm_ops { int (*close)(struct snd_pcm_substream *substream); int (*ioctl)(struct snd_pcm_substream * substream, unsigned int cmd, void *arg); +#ifdef CONFIG_AUDIO_QGKI + int (*compat_ioctl)(struct snd_pcm_substream *substream, + unsigned int cmd, void *arg); +#endif int (*hw_params)(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); int (*hw_free)(struct snd_pcm_substream *substream); diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 6f9003b1869a..6735ec629b87 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c @@ -635,6 +635,27 @@ enum { #endif /* CONFIG_X86_X32 */ }; +#ifdef CONFIG_AUDIO_QGKI +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; +} +#endif + static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_pcm_file *pcm_file; @@ -712,6 +733,11 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32: return snd_pcm_ioctl_channel_info_x32(substream, argp); #endif /* CONFIG_X86_X32 */ +#ifdef CONFIG_AUDIO_QGKI + default: + if (_IOC_TYPE(cmd) == 'C') + return snd_compressed_ioctl32(substream, cmd, argp); +#endif } return -ENOIOCTLCMD;