1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun #ifndef __SOUND_HWDEP_H 3*4882a593Smuzhiyun #define __SOUND_HWDEP_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun /* 6*4882a593Smuzhiyun * Hardware dependent layer 7*4882a593Smuzhiyun * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun #include <sound/asound.h> 11*4882a593Smuzhiyun #include <linux/poll.h> 12*4882a593Smuzhiyun #include <linux/android_kabi.h> 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun struct snd_hwdep; 15*4882a593Smuzhiyun 16*4882a593Smuzhiyun /* hwdep file ops; all ops can be NULL */ 17*4882a593Smuzhiyun struct snd_hwdep_ops { 18*4882a593Smuzhiyun long long (*llseek)(struct snd_hwdep *hw, struct file *file, 19*4882a593Smuzhiyun long long offset, int orig); 20*4882a593Smuzhiyun long (*read)(struct snd_hwdep *hw, char __user *buf, 21*4882a593Smuzhiyun long count, loff_t *offset); 22*4882a593Smuzhiyun long (*write)(struct snd_hwdep *hw, const char __user *buf, 23*4882a593Smuzhiyun long count, loff_t *offset); 24*4882a593Smuzhiyun int (*open)(struct snd_hwdep *hw, struct file * file); 25*4882a593Smuzhiyun int (*release)(struct snd_hwdep *hw, struct file * file); 26*4882a593Smuzhiyun __poll_t (*poll)(struct snd_hwdep *hw, struct file *file, 27*4882a593Smuzhiyun poll_table *wait); 28*4882a593Smuzhiyun int (*ioctl)(struct snd_hwdep *hw, struct file *file, 29*4882a593Smuzhiyun unsigned int cmd, unsigned long arg); 30*4882a593Smuzhiyun int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file, 31*4882a593Smuzhiyun unsigned int cmd, unsigned long arg); 32*4882a593Smuzhiyun int (*mmap)(struct snd_hwdep *hw, struct file *file, 33*4882a593Smuzhiyun struct vm_area_struct *vma); 34*4882a593Smuzhiyun int (*dsp_status)(struct snd_hwdep *hw, 35*4882a593Smuzhiyun struct snd_hwdep_dsp_status *status); 36*4882a593Smuzhiyun int (*dsp_load)(struct snd_hwdep *hw, 37*4882a593Smuzhiyun struct snd_hwdep_dsp_image *image); 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1); 40*4882a593Smuzhiyun }; 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun struct snd_hwdep { 43*4882a593Smuzhiyun struct snd_card *card; 44*4882a593Smuzhiyun struct list_head list; 45*4882a593Smuzhiyun int device; 46*4882a593Smuzhiyun char id[32]; 47*4882a593Smuzhiyun char name[80]; 48*4882a593Smuzhiyun int iface; 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun #ifdef CONFIG_SND_OSSEMUL 51*4882a593Smuzhiyun int oss_type; 52*4882a593Smuzhiyun int ossreg; 53*4882a593Smuzhiyun #endif 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun struct snd_hwdep_ops ops; 56*4882a593Smuzhiyun wait_queue_head_t open_wait; 57*4882a593Smuzhiyun void *private_data; 58*4882a593Smuzhiyun void (*private_free) (struct snd_hwdep *hwdep); 59*4882a593Smuzhiyun struct device dev; 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun struct mutex open_mutex; 62*4882a593Smuzhiyun int used; /* reference counter */ 63*4882a593Smuzhiyun unsigned int dsp_loaded; /* bit fields of loaded dsp indices */ 64*4882a593Smuzhiyun unsigned int exclusive:1; /* exclusive access mode */ 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun ANDROID_KABI_RESERVE(1); 67*4882a593Smuzhiyun }; 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun extern int snd_hwdep_new(struct snd_card *card, char *id, int device, 70*4882a593Smuzhiyun struct snd_hwdep **rhwdep); 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun #endif /* __SOUND_HWDEP_H */ 73