xref: /linux/sound/usb/mixer.h (revision 400362f1d8dcfda3562e80e88cfc2a92cffaf9bf)
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;
61faa5d07SDaniel Mack 	struct usb_host_interface *hostif;
7f0b5e634SDaniel Mack 	struct list_head list;
8f0b5e634SDaniel Mack 	unsigned int ignore_ctl_error;
9f0b5e634SDaniel Mack 	struct urb *urb;
10f0b5e634SDaniel Mack 	/* array[MAX_ID_ELEMS], indexed by unit id */
11f0b5e634SDaniel Mack 	struct usb_mixer_elem_info **id_elems;
12f0b5e634SDaniel Mack 
1323caaf19SDaniel Mack 	/* the usb audio specification version this interface complies to */
1423caaf19SDaniel Mack 	int protocol;
1523caaf19SDaniel Mack 
16f0b5e634SDaniel Mack 	/* Sound Blaster remote control stuff */
17f0b5e634SDaniel Mack 	const struct rc_config *rc_cfg;
18f0b5e634SDaniel Mack 	u32 rc_code;
19f0b5e634SDaniel Mack 	wait_queue_head_t rc_waitq;
20f0b5e634SDaniel Mack 	struct urb *rc_urb;
21f0b5e634SDaniel Mack 	struct usb_ctrlrequest *rc_setup_packet;
22f0b5e634SDaniel Mack 	u8 rc_buffer[6];
23f0b5e634SDaniel Mack 
24f0b5e634SDaniel Mack 	u8 audigy2nx_leds[3];
25f0b5e634SDaniel Mack 	u8 xonar_u1_status;
26f0b5e634SDaniel Mack };
27f0b5e634SDaniel Mack 
289e38658fSDaniel Mack #define MAX_CHANNELS	16	/* max logical channels */
299e38658fSDaniel Mack 
309e38658fSDaniel Mack enum {
319e38658fSDaniel Mack 	USB_MIXER_BOOLEAN,
329e38658fSDaniel Mack 	USB_MIXER_INV_BOOLEAN,
339e38658fSDaniel Mack 	USB_MIXER_S8,
349e38658fSDaniel Mack 	USB_MIXER_U8,
359e38658fSDaniel Mack 	USB_MIXER_S16,
369e38658fSDaniel Mack 	USB_MIXER_U16,
379e38658fSDaniel Mack };
38f0b5e634SDaniel Mack 
39f0b5e634SDaniel Mack struct usb_mixer_elem_info {
40f0b5e634SDaniel Mack 	struct usb_mixer_interface *mixer;
41f0b5e634SDaniel Mack 	struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */
42f0b5e634SDaniel Mack 	struct snd_ctl_elem_id *elem_id;
43f0b5e634SDaniel Mack 	unsigned int id;
44f0b5e634SDaniel Mack 	unsigned int control;	/* CS or ICN (high byte) */
45f0b5e634SDaniel Mack 	unsigned int cmask; /* channel mask bitmap: 0 = master */
469f814105SEldad Zack 	unsigned int idx_off; /* Control index offset */
47a6a33259SDaniel Mack 	unsigned int ch_readonly;
48a6a33259SDaniel Mack 	unsigned int master_readonly;
49f0b5e634SDaniel Mack 	int channels;
50f0b5e634SDaniel Mack 	int val_type;
51f0b5e634SDaniel Mack 	int min, max, res;
52f0b5e634SDaniel Mack 	int dBmin, dBmax;
53f0b5e634SDaniel Mack 	int cached;
54f0b5e634SDaniel Mack 	int cache_val[MAX_CHANNELS];
55f0b5e634SDaniel Mack 	u8 initialized;
56f0b5e634SDaniel Mack };
57f0b5e634SDaniel Mack 
58f0b5e634SDaniel Mack int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
59f0b5e634SDaniel Mack 			 int ignore_error);
60f0b5e634SDaniel Mack void snd_usb_mixer_disconnect(struct list_head *p);
61f0b5e634SDaniel Mack 
62f0b5e634SDaniel Mack void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
63f0b5e634SDaniel Mack 
64f0b5e634SDaniel Mack int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
65f0b5e634SDaniel Mack 				int request, int validx, int value_set);
66f0b5e634SDaniel Mack 
67ef9d5970SDaniel Mack int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer,
68ef9d5970SDaniel Mack 			      struct snd_kcontrol *kctl);
69ef9d5970SDaniel Mack 
70285de9c0SFelix Homann int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
71285de9c0SFelix Homann 			  unsigned int size, unsigned int __user *_tlv);
72285de9c0SFelix Homann 
73*400362f1STakashi Iwai #ifdef CONFIG_PM
74*400362f1STakashi Iwai int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer);
75*400362f1STakashi Iwai int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume);
76*400362f1STakashi Iwai #endif
77*400362f1STakashi Iwai 
78f0b5e634SDaniel Mack #endif /* __USBMIXER_H */
79