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>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
This commit is contained in:
Banajit Goswami 2016-11-21 18:14:37 -08:00 • committed by Meng Wang
commit 4c69e8bc41
2 changed files with 30 additions and 0 deletions

View file

@ -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);

View file

@ -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;