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