xref: /linux/sound/usb/mixer.h (revision 9e38658f703732cb69936553cef4bdb4e5294f3f)
1f0b5e634SDaniel Mack #ifndef __USBMIXER_H
2f0b5e634SDaniel Mack #define __USBMIXER_H
3f0b5e634SDaniel Mack 
4f0b5e634SDaniel Mack struct usb_mixer_interface {
5f0b5e634SDaniel Mack 	struct snd_usb_audio *chip;
6f0b5e634SDaniel Mack 	struct list_head list;
7f0b5e634SDaniel Mack 	unsigned int ignore_ctl_error;
8f0b5e634SDaniel Mack 	struct urb *urb;
9f0b5e634SDaniel Mack 	/* array[MAX_ID_ELEMS], indexed by unit id */
10f0b5e634SDaniel Mack 	struct usb_mixer_elem_info **id_elems;
11f0b5e634SDaniel Mack 
1223caaf19SDaniel Mack 	/* the usb audio specification version this interface complies to */
1323caaf19SDaniel Mack 	int protocol;
1423caaf19SDaniel Mack 
15f0b5e634SDaniel Mack 	/* Sound Blaster remote control stuff */
16f0b5e634SDaniel Mack 	const struct rc_config *rc_cfg;
17f0b5e634SDaniel Mack 	u32 rc_code;
18f0b5e634SDaniel Mack 	wait_queue_head_t rc_waitq;
19f0b5e634SDaniel Mack 	struct urb *rc_urb;
20f0b5e634SDaniel Mack 	struct usb_ctrlrequest *rc_setup_packet;
21f0b5e634SDaniel Mack 	u8 rc_buffer[6];
22f0b5e634SDaniel Mack 
23f0b5e634SDaniel Mack 	u8 audigy2nx_leds[3];
24f0b5e634SDaniel Mack 	u8 xonar_u1_status;
25f0b5e634SDaniel Mack };
26f0b5e634SDaniel Mack 
27*9e38658fSDaniel Mack #define MAX_CHANNELS	16	/* max logical channels */
28*9e38658fSDaniel Mack 
29*9e38658fSDaniel Mack enum {
30*9e38658fSDaniel Mack 	USB_MIXER_BOOLEAN,
31*9e38658fSDaniel Mack 	USB_MIXER_INV_BOOLEAN,
32*9e38658fSDaniel Mack 	USB_MIXER_S8,
33*9e38658fSDaniel Mack 	USB_MIXER_U8,
34*9e38658fSDaniel Mack 	USB_MIXER_S16,
35*9e38658fSDaniel Mack 	USB_MIXER_U16,
36*9e38658fSDaniel Mack };
37f0b5e634SDaniel Mack 
38f0b5e634SDaniel Mack struct usb_mixer_elem_info {
39f0b5e634SDaniel Mack 	struct usb_mixer_interface *mixer;
40f0b5e634SDaniel Mack 	struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */
41f0b5e634SDaniel Mack 	struct snd_ctl_elem_id *elem_id;
42f0b5e634SDaniel Mack 	unsigned int id;
43f0b5e634SDaniel Mack 	unsigned int control;	/* CS or ICN (high byte) */
44f0b5e634SDaniel Mack 	unsigned int cmask; /* channel mask bitmap: 0 = master */
45a6a33259SDaniel Mack 	unsigned int ch_readonly;
46a6a33259SDaniel Mack 	unsigned int master_readonly;
47f0b5e634SDaniel Mack 	int channels;
48f0b5e634SDaniel Mack 	int val_type;
49f0b5e634SDaniel Mack 	int min, max, res;
50f0b5e634SDaniel Mack 	int dBmin, dBmax;
51f0b5e634SDaniel Mack 	int cached;
52f0b5e634SDaniel Mack 	int cache_val[MAX_CHANNELS];
53f0b5e634SDaniel Mack 	u8 initialized;
54f0b5e634SDaniel Mack };
55f0b5e634SDaniel Mack 
56f0b5e634SDaniel Mack int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
57f0b5e634SDaniel Mack 			 int ignore_error);
58f0b5e634SDaniel Mack void snd_usb_mixer_disconnect(struct list_head *p);
59f0b5e634SDaniel Mack 
60f0b5e634SDaniel Mack void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
61f0b5e634SDaniel Mack 
62f0b5e634SDaniel Mack int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
63f0b5e634SDaniel Mack 				int request, int validx, int value_set);
64edf7de31SOliver Neukum void snd_usb_mixer_inactivate(struct usb_mixer_interface *mixer);
65edf7de31SOliver Neukum int snd_usb_mixer_activate(struct usb_mixer_interface *mixer);
66f0b5e634SDaniel Mack 
67ef9d5970SDaniel Mack int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
68ef9d5970SDaniel Mack 			      struct snd_kcontrol *kctl);
69ef9d5970SDaniel Mack 
70f0b5e634SDaniel Mack #endif /* __USBMIXER_H */
71