From e5779998bf8b70e48a6cc208c8b61b33bd6117ea Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 4 Mar 2010 19:46:13 +0100 Subject: 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 Cc: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/usbaudio.h | 42 +++++------------------------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'sound/usb/usbaudio.h') 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 @@ #define USB_ID_PRODUCT(id) ((u16)(id)) /* + * */ struct snd_usb_audio { @@ -48,6 +49,10 @@ struct snd_usb_audio { struct list_head midi_list; /* list of midi interfaces */ struct list_head mixer_list; /* list of mixer interfaces */ + + int setup; /* from the 'device_setup' module param */ + int nrpacks; /* from the 'nrpacks' module param */ + int async_unlink; /* from the 'async_unlink' module param */ }; /* @@ -86,45 +91,8 @@ struct snd_usb_audio_quirk { const void *data; }; -/* - */ - -/*E-mu USB samplerate control quirk*/ -enum { - EMU_QUIRK_SR_44100HZ = 0, - EMU_QUIRK_SR_48000HZ, - EMU_QUIRK_SR_88200HZ, - EMU_QUIRK_SR_96000HZ, - EMU_QUIRK_SR_176400HZ, - EMU_QUIRK_SR_192000HZ -}; - #define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8)) #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16)) #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24)) -unsigned int snd_usb_combine_bytes(unsigned char *bytes, int size); - -void *snd_usb_find_desc(void *descstart, int desclen, void *after, u8 dtype); -void *snd_usb_find_csint_desc(void *descstart, int desclen, void *after, u8 dsubtype); - -int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, - __u8 request, __u8 requesttype, __u16 value, __u16 index, - void *data, __u16 size, int timeout); - -/* - * retrieve usb_interface descriptor from the host interface - * (conditional for compatibility with the older API) - */ -#ifndef get_iface_desc -#define get_iface_desc(iface) (&(iface)->desc) -#define get_endpoint(alt,ep) (&(alt)->endpoint[ep].desc) -#define get_ep_desc(ep) (&(ep)->desc) -#define get_cfg_desc(cfg) (&(cfg)->desc) -#endif - -#ifndef snd_usb_get_speed -#define snd_usb_get_speed(dev) ((dev)->speed) -#endif - #endif /* __USBAUDIO_H */ -- cgit v1.2.3