diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-03-04 13:46:13 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-03-05 02:17:14 -0500 |
commit | e5779998bf8b70e48a6cc208c8b61b33bd6117ea (patch) | |
tree | 512568f0fc4b81eac8019522c10df5b81483bcca /sound/usb/usbaudio.h | |
parent | 3e1aebef6fb55e35668d2d7cf608cf03f30c904f (diff) |
ALSA: usb-audio: refactor code
Clean up the usb audio driver by factoring out a lot of functions to
separate files. Code for procfs, quirks, urbs, format parsers etc all
got a new home now.
Moved almost all special quirk handling to quirks.c and introduced new
generic functions to handle them, so the exceptions do not pollute the
whole driver.
Renamed usbaudio.c to card.c because this is what it actually does now.
Renamed usbmidi.c to midi.c for namespace clarity.
Removed more things from usbaudio.h.
The non-standard drivers were adopted accordingly.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbaudio.h')
-rw-r--r-- | sound/usb/usbaudio.h | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 49a691a0b281..d679e72a3e5c 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define USB_ID_PRODUCT(id) ((u16)(id)) | 27 | #define USB_ID_PRODUCT(id) ((u16)(id)) |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * | ||
30 | */ | 31 | */ |
31 | 32 | ||
32 | struct snd_usb_audio { | 33 | struct snd_usb_audio { |
@@ -48,6 +49,10 @@ struct snd_usb_audio { | |||
48 | struct list_head midi_list; /* list of midi interfaces */ | 49 | struct list_head midi_list; /* list of midi interfaces */ |
49 | 50 | ||
50 | struct list_head mixer_list; /* list of mixer interfaces */ | 51 | struct list_head mixer_list; /* list of mixer interfaces */ |
52 | |||
53 | int setup; /* from the 'device_setup' module param */ | ||
54 | int nrpacks; /* from the 'nrpacks' module param */ | ||
55 | int async_unlink; /* from the 'async_unlink' module param */ | ||
51 | }; | 56 | }; |
52 | 57 | ||
53 | /* | 58 | /* |
@@ -86,45 +91,8 @@ struct snd_usb_audio_quirk { | |||
86 | const void *data; | 91 | const void *data; |
87 | }; | 92 | }; |
88 | 93 | ||
89 | /* | ||
90 | */ | ||
91 | |||
92 | /*E-mu USB samplerate control quirk*/ | ||
93 | enum { | ||
94 | EMU_QUIRK_SR_44100HZ = 0, | ||
95 | EMU_QUIRK_SR_48000HZ, | ||
96 | EMU_QUIRK_SR_88200HZ, | ||
97 | EMU_QUIRK_SR_96000HZ, | ||
98 | EMU_QUIRK_SR_176400HZ, | ||
99 | EMU_QUIRK_SR_192000HZ | ||
100 | }; | ||
101 | |||
102 | #define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8)) | 94 | #define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8)) |
103 | #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16)) | 95 | #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16)) |
104 | #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24)) | 96 | #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24)) |
105 | 97 | ||
106 | unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); | ||
107 | |||
108 | void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); | ||
109 | void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); | ||
110 | |||
111 | int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, | ||
112 | __u8 request, __u8 requesttype, __u16 value, __u16 index, | ||
113 | void *data, __u16 size, int timeout); | ||
114 | |||
115 | /* | ||
116 | * retrieve usb_interface descriptor from the host interface | ||
117 | * (conditional for compatibility with the older API) | ||
118 | */ | ||
119 | #ifndef get_iface_desc | ||
120 | #define get_iface_desc(iface) (&(iface)->desc) | ||
121 | #define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc) | ||
122 | #define get_ep_desc(ep) (&(ep)->desc) | ||
123 | #define get_cfg_desc(cfg) (&(cfg)->desc) | ||
124 | #endif | ||
125 | |||
126 | #ifndef snd_usb_get_speed | ||
127 | #define snd_usb_get_speed(dev) ((dev)->speed) | ||
128 | #endif | ||
129 | |||
130 | #endif /* __USBAUDIO_H */ | 98 | #endif /* __USBAUDIO_H */ |