1#ifndef __USBAUDIO_H
2#define __USBAUDIO_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#define USB_ID(vendor, product) (((vendor) << 16) | (product))
26#define USB_ID_VENDOR(id) ((id) >> 16)
27#define USB_ID_PRODUCT(id) ((u16)(id))
28
29
30
31
32
33struct snd_usb_audio {
34 int index;
35 struct usb_device *dev;
36 struct snd_card *card;
37 struct usb_interface *pm_intf;
38 u32 usb_id;
39 struct mutex mutex;
40 unsigned int autosuspended:1;
41 atomic_t active;
42 atomic_t shutdown;
43 atomic_t usage_count;
44 wait_queue_head_t shutdown_wait;
45 unsigned int txfr_quirk:1;
46 unsigned int tx_length_quirk:1;
47
48 int num_interfaces;
49 int num_suspended_intf;
50 int sample_rate_read_error;
51
52 int badd_profile;
53
54 struct list_head pcm_list;
55 struct list_head ep_list;
56 int pcm_devs;
57
58 struct list_head midi_list;
59
60 struct list_head mixer_list;
61
62 int setup;
63 bool autoclock;
64 bool keep_iface;
65
66
67
68 struct usb_host_interface *ctrl_intf;
69};
70
71#define usb_audio_err(chip, fmt, args...) \
72 dev_err(&(chip)->dev->dev, fmt, ##args)
73#define usb_audio_warn(chip, fmt, args...) \
74 dev_warn(&(chip)->dev->dev, fmt, ##args)
75#define usb_audio_info(chip, fmt, args...) \
76 dev_info(&(chip)->dev->dev, fmt, ##args)
77#define usb_audio_dbg(chip, fmt, args...) \
78 dev_dbg(&(chip)->dev->dev, fmt, ##args)
79
80
81
82
83
84
85#define QUIRK_NO_INTERFACE -2
86#define QUIRK_ANY_INTERFACE -1
87
88enum quirk_type {
89 QUIRK_IGNORE_INTERFACE,
90 QUIRK_COMPOSITE,
91 QUIRK_AUTODETECT,
92 QUIRK_MIDI_STANDARD_INTERFACE,
93 QUIRK_MIDI_FIXED_ENDPOINT,
94 QUIRK_MIDI_YAMAHA,
95 QUIRK_MIDI_ROLAND,
96 QUIRK_MIDI_MIDIMAN,
97 QUIRK_MIDI_NOVATION,
98 QUIRK_MIDI_RAW_BYTES,
99 QUIRK_MIDI_EMAGIC,
100 QUIRK_MIDI_CME,
101 QUIRK_MIDI_AKAI,
102 QUIRK_MIDI_US122L,
103 QUIRK_MIDI_FTDI,
104 QUIRK_MIDI_CH345,
105 QUIRK_AUDIO_STANDARD_INTERFACE,
106 QUIRK_AUDIO_FIXED_ENDPOINT,
107 QUIRK_AUDIO_EDIROL_UAXX,
108 QUIRK_AUDIO_ALIGN_TRANSFER,
109 QUIRK_AUDIO_STANDARD_MIXER,
110
111 QUIRK_TYPE_COUNT
112};
113
114struct snd_usb_audio_quirk {
115 const char *vendor_name;
116 const char *product_name;
117 const char *profile_name;
118 int16_t ifnum;
119 uint16_t type;
120 const void *data;
121};
122
123#define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8))
124#define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16))
125#define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24))
126
127int snd_usb_lock_shutdown(struct snd_usb_audio *chip);
128void snd_usb_unlock_shutdown(struct snd_usb_audio *chip);
129
130extern bool snd_usb_use_vmalloc;
131
132#endif
133