summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGopikrishnaiah Anandan <agopik@codeaurora.org>2013-12-13 16:14:03 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:10:16 -0700
commit9772b42f4818b434e105f76ac31512e4c9c6cafe (patch)
tree6e666eaecde35e64a0e29115be7c4fe2d10fdc71
parentb45b11503a44b48e1bee649ecaf1867a4d800fa7 (diff)
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>
-rw-r--r--include/sound/pcm.h2
-rw-r--r--sound/core/pcm_compat.c23
2 files changed, 24 insertions, 1 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b293f60108ac..06d919d95cac 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -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);
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index b48b434444ed..7cfca1491f20 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -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;