Merge "ASoC: core: Support for compress ioctls"

This commit is contained in:
qctecmdr 2019-12-30 16:55:17 -08:00 • committed by Gerrit - the friendly Code Review server
commit b988a01dbf
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;