ALSA: usbaudio: consolidate header files
[deliverable/linux.git] / sound / usb / usbaudio.h
CommitLineData
1da177e4
LT
1#ifndef __USBAUDIO_H
2#define __USBAUDIO_H
3/*
4 * (Tentative) USB Audio Driver for ALSA
5 *
6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
1da177e4
LT
24/* maximum number of endpoints per interface */
25#define MIDI_MAX_ENDPOINTS 2
26
27d10f56
CL
27/* handling of USB vendor/product ID pairs as 32-bit numbers */
28#define USB_ID(vendor, product) (((vendor) << 16) | (product))
29#define USB_ID_VENDOR(id) ((id) >> 16)
30#define USB_ID_PRODUCT(id) ((u16)(id))
31
1da177e4
LT
32/*
33 */
34
1da177e4
LT
35struct snd_usb_audio {
36 int index;
37 struct usb_device *dev;
86e07d34 38 struct snd_card *card;
27d10f56 39 u32 usb_id;
1da177e4 40 int shutdown;
98e89f60 41 unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
1da177e4 42 int num_interfaces;
f85bf29c 43 int num_suspended_intf;
1da177e4 44
53ee98fe
DM
45 /* for audio class v2 */
46 int clock_id;
47
1da177e4
LT
48 struct list_head pcm_list; /* list of pcm streams */
49 int pcm_devs;
50
51 struct list_head midi_list; /* list of midi interfaces */
1da177e4 52
84957a8a 53 struct list_head mixer_list; /* list of mixer interfaces */
1da177e4
LT
54};
55
56/*
57 * Information about devices with broken descriptors
58 */
59
60/* special values for .ifnum */
61#define QUIRK_NO_INTERFACE -2
62#define QUIRK_ANY_INTERFACE -1
63
854af957
CL
64enum quirk_type {
65 QUIRK_IGNORE_INTERFACE,
66 QUIRK_COMPOSITE,
67 QUIRK_MIDI_STANDARD_INTERFACE,
68 QUIRK_MIDI_FIXED_ENDPOINT,
69 QUIRK_MIDI_YAMAHA,
70 QUIRK_MIDI_MIDIMAN,
71 QUIRK_MIDI_NOVATION,
55de5ef9 72 QUIRK_MIDI_FASTLANE,
854af957 73 QUIRK_MIDI_EMAGIC,
cc7a59bd 74 QUIRK_MIDI_CME,
030a07e4 75 QUIRK_MIDI_US122L,
854af957
CL
76 QUIRK_AUDIO_STANDARD_INTERFACE,
77 QUIRK_AUDIO_FIXED_ENDPOINT,
854af957 78 QUIRK_AUDIO_EDIROL_UA1000,
310e0dc0 79 QUIRK_AUDIO_EDIROL_UAXX,
52a7a583 80 QUIRK_AUDIO_ALIGN_TRANSFER,
854af957
CL
81
82 QUIRK_TYPE_COUNT
83};
1da177e4 84
1da177e4
LT
85struct snd_usb_audio_quirk {
86 const char *vendor_name;
87 const char *product_name;
88 int16_t ifnum;
854af957 89 uint16_t type;
1da177e4
LT
90 const void *data;
91};
92
93/* data for QUIRK_MIDI_FIXED_ENDPOINT */
94struct snd_usb_midi_endpoint_info {
95 int8_t out_ep; /* ep number, 0 autodetect */
96 uint8_t out_interval; /* interval for interrupt endpoints */
97 int8_t in_ep;
98 uint8_t in_interval;
99 uint16_t out_cables; /* bitmask */
100 uint16_t in_cables; /* bitmask */
101};
102
103/* for QUIRK_MIDI_YAMAHA, data is NULL */
104
105/* for QUIRK_MIDI_MIDIMAN, data points to a snd_usb_midi_endpoint_info
106 * structure (out_cables and in_cables only) */
107
108/* for QUIRK_COMPOSITE, data points to an array of snd_usb_audio_quirk
109 * structures, terminated with .ifnum = -1 */
110
111/* for QUIRK_AUDIO_FIXED_ENDPOINT, data points to an audioformat structure */
112
113/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */
114
115/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */
116
117/* for QUIRK_IGNORE_INTERFACE, data is NULL */
118
6155aff8 119/* for QUIRK_MIDI_NOVATION and _RAW, data is NULL */
1da177e4
LT
120
121/* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info
122 * structure (out_cables and in_cables only) */
123
cc7a59bd 124/* for QUIRK_MIDI_CME, data is NULL */
f38275fe 125
1da177e4
LT
126/*
127 */
128
7d2b451e
SK
129/*E-mu USB samplerate control quirk*/
130enum {
131 EMU_QUIRK_SR_44100HZ = 0,
132 EMU_QUIRK_SR_48000HZ,
133 EMU_QUIRK_SR_88200HZ,
134 EMU_QUIRK_SR_96000HZ,
135 EMU_QUIRK_SR_176400HZ,
136 EMU_QUIRK_SR_192000HZ
137};
138
f4950882 139#define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8))
1da177e4
LT
140#define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16))
141#define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24))
142
143unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size);
144
145void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype);
146void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype);
147
86e07d34
TI
148int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe,
149 __u8 request, __u8 requesttype, __u16 value, __u16 index,
150 void *data, __u16 size, int timeout);
1da177e4 151
7a9b8063
TI
152int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
153 int ignore_error);
84957a8a 154void snd_usb_mixer_disconnect(struct list_head *p);
1da177e4 155
d82af9f9
CL
156int snd_usbmidi_create(struct snd_card *card,
157 struct usb_interface *iface,
158 struct list_head *midi_list,
159 const struct snd_usb_audio_quirk *quirk);
1da177e4
LT
160void snd_usbmidi_input_stop(struct list_head* p);
161void snd_usbmidi_input_start(struct list_head* p);
ee733397 162void snd_usbmidi_disconnect(struct list_head *p);
1da177e4 163
7d2b451e
SK
164void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
165 unsigned char samplerate_id);
166
1da177e4
LT
167/*
168 * retrieve usb_interface descriptor from the host interface
169 * (conditional for compatibility with the older API)
170 */
171#ifndef get_iface_desc
172#define get_iface_desc(iface) (&(iface)->desc)
173#define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc)
174#define get_ep_desc(ep) (&(ep)->desc)
175#define get_cfg_desc(cfg) (&(cfg)->desc)
176#endif
177
1da177e4
LT
178#ifndef snd_usb_get_speed
179#define snd_usb_get_speed(dev) ((dev)->speed)
180#endif
181
182#endif /* __USBAUDIO_H */
This page took 0.515839 seconds and 5 git commands to generate.