diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-03-23 13:36:33 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-03-23 13:36:33 +0100 |
commit | dcf76639c349a2258b22b0aa2da024f4c7c299f4 (patch) | |
tree | 83f70a3a278324676b2b21a0f4fdb9009a4566bb | |
parent | dfbb9808da13348df5506a3eef3d539c8c7313b2 (diff) | |
parent | f8fa90f13140d1494def96ff1d6a8e41ec18ae0f (diff) | |
download | alsa-driver-build-unstable-dcf76639c349a2258b22b0aa2da024f4c7c299f4.tar.gz |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/alsa-driver-build
-rw-r--r-- | .gitignore | 11 | ||||
-rw-r--r-- | acore/info.inc | 1 | ||||
-rw-r--r-- | acore/pcm_native.patch | 58 | ||||
-rw-r--r-- | configure.in | 25 | ||||
-rw-r--r-- | include/usb_audio_compat.h | 212 | ||||
-rw-r--r-- | include/usb_audio_v2_compat.h | 366 | ||||
-rw-r--r-- | pci/hda/hda_intel.patch | 21 | ||||
-rw-r--r-- | usb/Makefile | 16 | ||||
-rw-r--r-- | usb/caiaq/input.patch | 67 | ||||
-rw-r--r-- | usb/card.inc | 8 | ||||
-rw-r--r-- | usb/card.inc1 (renamed from usb/usbaudio.inc1) | 0 | ||||
-rw-r--r-- | usb/card.patch | 102 | ||||
-rw-r--r-- | usb/endpoint.patch | 44 | ||||
-rw-r--r-- | usb/format.c | 3 | ||||
-rw-r--r-- | usb/helper.patch | 22 | ||||
-rw-r--r-- | usb/midi.inc (renamed from usb/usbmidi.inc) | 0 | ||||
-rw-r--r-- | usb/midi.inc1 (renamed from usb/usbmidi.inc1) | 0 | ||||
-rw-r--r-- | usb/midi.patch (renamed from usb/usbmidi.patch) | 26 | ||||
-rw-r--r-- | usb/misc/Makefile | 10 | ||||
-rw-r--r-- | usb/misc/ua101.c | 3 | ||||
-rw-r--r-- | usb/mixer.inc (renamed from usb/usbmixer.inc) | 0 | ||||
-rw-r--r-- | usb/mixer.patch (renamed from usb/usbmixer.patch) | 33 | ||||
-rw-r--r-- | usb/mixer_quirks.patch | 20 | ||||
-rw-r--r-- | usb/pcm.c | 3 | ||||
-rw-r--r-- | usb/proc.c | 3 | ||||
-rw-r--r-- | usb/quirks.patch | 77 | ||||
-rw-r--r-- | usb/ua101.c | 3 | ||||
-rw-r--r-- | usb/urb.patch | 72 | ||||
-rw-r--r-- | usb/usbaudio.inc | 7 | ||||
-rw-r--r-- | usb/usbaudio.patch | 302 | ||||
-rw-r--r-- | utils/mod-deps.c | 8 |
31 files changed, 1066 insertions, 457 deletions
diff --git a/.gitignore b/.gitignore index 0db161f59..2ea3ed52c 100644 --- a/.gitignore +++ b/.gitignore @@ -115,9 +115,14 @@ soc/soc-core.c sparc/amd7930.c sparc/cs4231.c sparc/dbri.c -usb/usbaudio.c -usb/usbmidi.c -usb/usbmixer.c +usb/card.c +usb/endpoint.c +usb/helper.c +usb/midi.c +usb/mixer.c +usb/mixer_quirks.c +usb/urb.c +usb/quirks.c usb/caiaq/audio.c usb/caiaq/device.c usb/caiaq/input.c diff --git a/acore/info.inc b/acore/info.inc index f35de9857..17baca6ac 100644 --- a/acore/info.inc +++ b/acore/info.inc @@ -1,3 +1,4 @@ +#include "adriver.h" #include "alsa-autoconf.h" #define __NO_VERSION__ diff --git a/acore/pcm_native.patch b/acore/pcm_native.patch index 99191ee36..acef0c95e 100644 --- a/acore/pcm_native.patch +++ b/acore/pcm_native.patch @@ -1,5 +1,5 @@ ---- ../alsa-kernel/core/pcm_native.c 2009-11-27 11:25:09.000000000 +0100 -+++ pcm_native.c 2009-11-27 11:46:27.000000000 +0100 +--- ../alsa-kernel/core/pcm_native.c 2010-03-10 09:06:46.035772832 +0100 ++++ pcm_native.c 2010-03-10 09:13:01.287272310 +0100 @@ -1,3 +1,5 @@ +#define __NO_VERSION__ +#include "adriver.h" @@ -17,8 +17,8 @@ #include <linux/time.h> #include <linux/pm_qos_params.h> #include <linux/uio.h> -@@ -366,7 +368,10 @@ static int period_to_usecs(struct snd_pc - return usecs; +@@ -399,7 +401,10 @@ + return 0; } -static int snd_pcm_hw_params(struct snd_pcm_substream *substream, @@ -29,7 +29,7 @@ struct snd_pcm_hw_params *params) { struct snd_pcm_runtime *runtime; -@@ -1539,7 +1544,11 @@ static struct file *snd_pcm_file_fd(int +@@ -1577,7 +1582,11 @@ file = fget(fd); if (!file) return NULL; @@ -41,7 +41,7 @@ if (!S_ISCHR(inode->i_mode) || imajor(inode) != snd_major) { fput(file); -@@ -2792,25 +2801,50 @@ static ssize_t snd_pcm_write(struct file +@@ -2830,25 +2839,50 @@ struct snd_pcm_runtime *runtime; snd_pcm_sframes_t result; @@ -99,7 +99,7 @@ { struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; -@@ -2820,7 +2854,11 @@ static ssize_t snd_pcm_aio_read(struct k +@@ -2858,7 +2892,11 @@ void __user **bufs; snd_pcm_uframes_t frames; @@ -111,7 +111,7 @@ substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; -@@ -2844,8 +2882,13 @@ static ssize_t snd_pcm_aio_read(struct k +@@ -2882,8 +2920,13 @@ return result; } @@ -125,7 +125,7 @@ { struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; -@@ -2855,7 +2898,11 @@ static ssize_t snd_pcm_aio_write(struct +@@ -2893,7 +2936,11 @@ void __user **bufs; snd_pcm_uframes_t frames; @@ -137,7 +137,7 @@ substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; -@@ -2877,6 +2924,7 @@ static ssize_t snd_pcm_aio_write(struct +@@ -2915,6 +2962,7 @@ kfree(bufs); return result; } @@ -145,7 +145,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) { -@@ -2964,6 +3012,22 @@ static unsigned int snd_pcm_capture_poll +@@ -3002,6 +3050,22 @@ * mmap support */ @@ -168,7 +168,7 @@ /* * Only on coherent architectures, we can mmap the status and the control records * for effcient data transfer. On others, we have to use HWSYNC ioctl... -@@ -2972,6 +3036,7 @@ static unsigned int snd_pcm_capture_poll +@@ -3010,6 +3074,7 @@ /* * mmap status record */ @@ -176,7 +176,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -2985,10 +3050,49 @@ static int snd_pcm_mmap_status_fault(str +@@ -3023,10 +3088,49 @@ get_page(vmf->page); return 0; } @@ -226,7 +226,7 @@ }; static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, -@@ -3003,7 +3107,11 @@ static int snd_pcm_mmap_status(struct sn +@@ -3041,7 +3145,11 @@ if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status))) return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_status; @@ -238,7 +238,7 @@ area->vm_flags |= VM_RESERVED; return 0; } -@@ -3011,6 +3119,7 @@ static int snd_pcm_mmap_status(struct sn +@@ -3049,6 +3157,7 @@ /* * mmap control record */ @@ -246,7 +246,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -3024,10 +3133,50 @@ static int snd_pcm_mmap_control_fault(st +@@ -3062,10 +3171,50 @@ get_page(vmf->page); return 0; } @@ -297,7 +297,7 @@ }; static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, -@@ -3042,7 +3191,11 @@ static int snd_pcm_mmap_control(struct s +@@ -3080,7 +3229,11 @@ if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control))) return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_control; @@ -309,7 +309,7 @@ area->vm_flags |= VM_RESERVED; return 0; } -@@ -3083,9 +3236,16 @@ snd_pcm_default_page_ops(struct snd_pcm_ +@@ -3121,9 +3274,16 @@ return virt_to_page(vaddr); } @@ -326,7 +326,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -3112,6 +3272,59 @@ static int snd_pcm_mmap_data_fault(struc +@@ -3150,6 +3310,59 @@ vmf->page = page; return 0; } @@ -386,7 +386,7 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data = { .open = snd_pcm_mmap_data_open, -@@ -3121,7 +3334,14 @@ static const struct vm_operations_struct +@@ -3159,7 +3372,14 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = { .open = snd_pcm_mmap_data_open, .close = snd_pcm_mmap_data_close, @@ -401,8 +401,8 @@ }; #ifndef ARCH_HAS_DMA_MMAP_COHERENT -@@ -3167,11 +3387,26 @@ int snd_pcm_lib_mmap_iomem(struct snd_pc - #endif +@@ -3203,11 +3423,26 @@ + area->vm_page_prot = pgprot_noncached(area->vm_page_prot); area->vm_flags |= VM_IO; size = area->vm_end - area->vm_start; - offset = area->vm_pgoff << PAGE_SHIFT; @@ -429,7 +429,7 @@ return 0; } -@@ -3206,7 +3441,7 @@ int snd_pcm_mmap_data(struct snd_pcm_sub +@@ -3251,7 +3486,7 @@ runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; size = area->vm_end - area->vm_start; @@ -438,7 +438,7 @@ dma_bytes = PAGE_ALIGN(runtime->dma_bytes); if ((size_t)size > dma_bytes) return -EINVAL; -@@ -3214,7 +3449,11 @@ int snd_pcm_mmap_data(struct snd_pcm_sub +@@ -3259,7 +3494,11 @@ return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_data; @@ -450,7 +450,7 @@ if (substream->ops->mmap) err = substream->ops->mmap(substream, area); else -@@ -3237,7 +3476,7 @@ static int snd_pcm_mmap(struct file *fil +@@ -3282,7 +3521,7 @@ if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; @@ -459,7 +459,7 @@ switch (offset) { case SNDRV_PCM_MMAP_OFFSET_STATUS: if (pcm_file->no_compat_mmap) -@@ -3275,12 +3514,34 @@ out: +@@ -3320,12 +3559,34 @@ /* * ioctl32 compat */ @@ -495,7 +495,7 @@ /* * To be removed helpers to keep binary compatibility */ -@@ -3405,29 +3666,53 @@ unsigned long dummy_get_unmapped_area(st +@@ -3464,29 +3725,53 @@ const struct file_operations snd_pcm_f_ops[2] = { { @@ -520,7 +520,7 @@ .mmap = snd_pcm_mmap, .fasync = snd_pcm_fasync, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) - .get_unmapped_area = dummy_get_unmapped_area, + .get_unmapped_area = snd_pcm_get_unmapped_area, +#endif }, { @@ -545,7 +545,7 @@ .mmap = snd_pcm_mmap, .fasync = snd_pcm_fasync, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) - .get_unmapped_area = dummy_get_unmapped_area, + .get_unmapped_area = snd_pcm_get_unmapped_area, +#endif } }; diff --git a/configure.in b/configure.in index f43f0efbc..fa85eb4d8 100644 --- a/configure.in +++ b/configure.in @@ -2804,9 +2804,11 @@ fi AC_SUBST(CONFIG_USB) if test -n "$CONFIG_USB"; then + CHECK_KERNEL_HEADER(linux/usb/audio-v2.h, [#include \"usb_audio_v2_compat.h\" + ]) CHECK_KERNEL_HEADER(linux/usb/audio.h, [#include \"usb_audio_compat.h\" ]) - AC_MSG_CHECKING([for valid linux/usb/audio.h]) + AC_MSG_CHECKING([for valid v1 in linux/usb/audio.h]) usb_audio_valid="0" ac_save_CFLAGS="$CFLAGS" ac_save_CC="$CC" @@ -2821,13 +2823,32 @@ if test -n "$CONFIG_USB"; then #endif #include <linux/usb/audio.h> ],[ - struct uac_as_header_descriptor_v2 tmp; + struct uac_as_header_descriptor_v1 tmp; tmp.bLength = 0; ], AC_MSG_RESULT(yes);usb_audio_valid="1", AC_MSG_RESULT(no);usb_audio_valid="0", AC_MSG_RESULT(unknown);usb_audio_valid="0" ) + if test "$usb_audio_valid" = "1"; then + AC_MSG_CHECKING([for invalid v2 in linux/usb/audio.h]) + AC_TRY_COMPILE([ +#define __KERNEL__ +#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H +#include <$INCLUDE_AUTOCONF_H> +#else +#include <linux/config.h> +#endif +#include <linux/usb/audio.h> +],[ + struct uac_as_header_descriptor_v2 tmp; + tmp.bLength = 0; +], + AC_MSG_RESULT(yes);usb_audio_valid="0", + AC_MSG_RESULT(no);usb_audio_valid="1", + AC_MSG_RESULT(unknown);usb_audio_valid="0" +) + fi CFLAGS=$ac_save_CFLAGS CC=$ac_save_CC if test "$usb_audio_valid" != "1"; then diff --git a/include/usb_audio_compat.h b/include/usb_audio_compat.h index 6bb293684..905a87caf 100644 --- a/include/usb_audio_compat.h +++ b/include/usb_audio_compat.h @@ -13,6 +13,9 @@ * Comments below reference relevant sections of that document: * * http://www.usb.org/developers/devclass_docs/audio10.pdf + * + * Types and defines in this file are either specific to version 1.0 of + * this standard or common for newer versions. */ #ifndef __LINUX_USB_AUDIO_H @@ -20,14 +23,15 @@ #include <linux/types.h> +/* bInterfaceProtocol values to denote the version of the standard used */ +#define UAC_VERSION_1 0x00 +#define UAC_VERSION_2 0x20 + /* A.2 Audio Interface Subclass Codes */ #define USB_SUBCLASS_AUDIOCONTROL 0x01 #define USB_SUBCLASS_AUDIOSTREAMING 0x02 #define USB_SUBCLASS_MIDISTREAMING 0x03 -#define UAC_VERSION_1 0x00 -#define UAC_VERSION_2 0x20 - /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ #define UAC_HEADER 0x01 #define UAC_INPUT_TERMINAL 0x02 @@ -38,15 +42,6 @@ #define UAC_PROCESSING_UNIT_V1 0x07 #define UAC_EXTENSION_UNIT_V1 0x08 -/* UAC v2.0 types */ -#define UAC_EFFECT_UNIT 0x07 -#define UAC_PROCESSING_UNIT_V2 0x08 -#define UAC_EXTENSION_UNIT_V2 0x09 -#define UAC_CLOCK_SOURCE 0x0a -#define UAC_CLOCK_SELECTOR 0x0b -#define UAC_CLOCK_MULTIPLIER 0x0c -#define UAC_SAMPLE_RATE_CONVERTER 0x0d - /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ #define UAC_AS_GENERAL 0x01 #define UAC_FORMAT_TYPE 0x02 @@ -78,10 +73,6 @@ #define UAC_GET_STAT 0xff -/* Audio class v2.0 handles all the parameter calls differently */ -#define UAC2_CS_CUR 0x01 -#define UAC2_CS_RANGE 0x02 - /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ #define UAC_MS_HEADER 0x01 #define UAC_MIDI_IN_JACK 0x02 @@ -190,6 +181,156 @@ struct uac_feature_unit_descriptor_##ch { \ __u8 iFeature; \ } __attribute__ ((packed)) +/* 4.3.2.3 Mixer Unit Descriptor */ +struct uac_mixer_unit_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bUnitID; + __u8 bNrInPins; + __u8 baSourceID[]; +} __attribute__ ((packed)); + +static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) +{ + return desc->baSourceID[desc->bNrInPins]; +} + +static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc, + int protocol) +{ + if (protocol == UAC_VERSION_1) + return (desc->baSourceID[desc->bNrInPins + 2] << 8) | + desc->baSourceID[desc->bNrInPins + 1]; + else + return (desc->baSourceID[desc->bNrInPins + 4] << 24) | + (desc->baSourceID[desc->bNrInPins + 3] << 16) | + (desc->baSourceID[desc->bNrInPins + 2] << 8) | + (desc->baSourceID[desc->bNrInPins + 1]); +} + +static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc, + int protocol) +{ + return (protocol == UAC_VERSION_1) ? + desc->baSourceID[desc->bNrInPins + 3] : + desc->baSourceID[desc->bNrInPins + 5]; +} + +static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc, + int protocol) +{ + return (protocol == UAC_VERSION_1) ? + &desc->baSourceID[desc->bNrInPins + 4] : + &desc->baSourceID[desc->bNrInPins + 6]; +} + +static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) +{ + __u8 *raw = (__u8 *) desc; + return raw[desc->bLength - 1]; +} + +/* 4.3.2.4 Selector Unit Descriptor */ +struct uac_selector_unit_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bUintID; + __u8 bNrInPins; + __u8 baSourceID[]; +} __attribute__ ((packed)); + +static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) +{ + __u8 *raw = (__u8 *) desc; + return raw[desc->bLength - 1]; +} + +/* 4.3.2.5 Feature Unit Descriptor */ +struct uac_feature_unit_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bUnitID; + __u8 bSourceID; + __u8 bControlSize; + __u8 bmaControls[0]; /* variable length */ +} __attribute__((packed)); + +static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) +{ + __u8 *raw = (__u8 *) desc; + return raw[desc->bLength - 1]; +} + +/* 4.3.2.6 Processing Unit Descriptors */ +struct uac_processing_unit_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bUnitID; + __u16 wProcessType; + __u8 bNrInPins; + __u8 baSourceID[]; +} __attribute__ ((packed)); + +static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) +{ + return desc->baSourceID[desc->bNrInPins]; +} + +static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + if (protocol == UAC_VERSION_1) + return (desc->baSourceID[desc->bNrInPins + 2] << 8) | + desc->baSourceID[desc->bNrInPins + 1]; + else + return (desc->baSourceID[desc->bNrInPins + 4] << 24) | + (desc->baSourceID[desc->bNrInPins + 3] << 16) | + (desc->baSourceID[desc->bNrInPins + 2] << 8) | + (desc->baSourceID[desc->bNrInPins + 1]); +} + +static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + return (protocol == UAC_VERSION_1) ? + desc->baSourceID[desc->bNrInPins + 3] : + desc->baSourceID[desc->bNrInPins + 5]; +} + +static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + return (protocol == UAC_VERSION_1) ? + desc->baSourceID[desc->bNrInPins + 4] : + desc->baSourceID[desc->bNrInPins + 6]; +} + +static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + return (protocol == UAC_VERSION_1) ? + &desc->baSourceID[desc->bNrInPins + 5] : + &desc->baSourceID[desc->bNrInPins + 7]; +} + +static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); + return desc->baSourceID[desc->bNrInPins + control_size]; +} + +static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, + int protocol) +{ + __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); + return &desc->baSourceID[desc->bNrInPins + control_size + 1]; +} + /* 4.5.2 Class-Specific AS Interface Descriptor */ struct uac_as_header_descriptor_v1 { __u8 bLength; /* in bytes: 7 */ @@ -200,19 +341,6 @@ struct uac_as_header_descriptor_v1 { __le16 wFormatTag; /* The Audio Data Format */ } __attribute__ ((packed)); -struct uac_as_header_descriptor_v2 { - __u8 bLength; - __u8 bDescriptorType; - __u8 bDescriptorSubtype; - __u8 bTerminalLink; - __u8 bmControls; - __u8 bFormatType; - __u32 bmFormats; - __u8 bNrChannels; - __u32 bmChannelConfig; - __u8 iChannelNames; -} __attribute__((packed)); - #define UAC_DT_AS_HEADER_SIZE 7 /* Formats - A.1.1 Audio Data Format Type I Codes */ @@ -269,15 +397,14 @@ struct uac_format_type_i_ext_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; - __u8 bSubslotSize; __u8 bFormatType; + __u8 bSubslotSize; __u8 bBitResolution; __u8 bHeaderLength; __u8 bControlSize; __u8 bSideBandProtocol; } __attribute__((packed)); - /* Formats - Audio Data Format Type I Codes */ #define UAC_FORMAT_TYPE_II_MPEG 0x1001 @@ -336,31 +463,8 @@ struct uac_iso_endpoint_descriptor { #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 #define UAC_EP_CS_ATTR_FILL_MAX 0x80 -/* Audio class v2.0: CLOCK_SOURCE descriptor */ - -struct uac_clock_source_descriptor { - __u8 bLength; - __u8 bDescriptorType; - __u8 bDescriptorSubtype; - __u8 bClockID; - __u8 bmAttributes; - __u8 bmControls; - __u8 bAssocTerminal; - __u8 iClockSource; -} __attribute__((packed)); - /* A.10.2 Feature Unit Control Selectors */ -struct uac_feature_unit_descriptor { - __u8 bLength; - __u8 bDescriptorType; - __u8 bDescriptorSubtype; - __u8 bUnitID; - __u8 bSourceID; - __u8 bControlSize; - __u8 controls[0]; /* variable length */ -} __attribute__((packed)); - #define UAC_FU_CONTROL_UNDEFINED 0x00 #define UAC_MUTE_CONTROL 0x01 #define UAC_VOLUME_CONTROL 0x02 diff --git a/include/usb_audio_v2_compat.h b/include/usb_audio_v2_compat.h new file mode 100644 index 000000000..0952231e6 --- /dev/null +++ b/include/usb_audio_v2_compat.h @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de> + * + * This software is distributed under the terms of the GNU General Public + * License ("GPL") version 2, as published by the Free Software Foundation. + * + * This file holds USB constants and structures defined + * by the USB Device Class Definition for Audio Devices in version 2.0. + * Comments below reference relevant sections of the documents contained + * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip + */ + +#ifndef __LINUX_USB_AUDIO_V2_H +#define __LINUX_USB_AUDIO_V2_H + +#include <linux/types.h> + +/* v1.0 and v2.0 of this standard have many things in common. For the rest + * of the definitions, please refer to audio.h */ + +/* 4.7.2.1 Clock Source Descriptor */ + +struct uac_clock_source_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bClockID; + __u8 bmAttributes; + __u8 bmControls; + __u8 bAssocTerminal; + __u8 iClockSource; +} __attribute__((packed)); + +/* 4.7.2.2 Clock Source Descriptor */ + +struct uac_clock_selector_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bClockID; + __u8 bNrInPins; + __u8 bmControls; + __u8 baCSourceID[]; +} __attribute__((packed)); + +/* 4.7.2.4 Input terminal descriptor */ + +struct uac2_input_terminal_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bTerminalID; + __u16 wTerminalType; + __u8 bAssocTerminal; + __u8 bCSourceID; + __u8 bNrChannels; + __u32 bmChannelConfig; + __u8 iChannelNames; + __u16 bmControls; + __u8 iTerminal; +} __attribute__((packed)); + +/* 4.7.2.5 Output terminal descriptor */ + +struct uac2_output_terminal_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bTerminalID; + __u16 wTerminalType; + __u8 bAssocTerminal; + __u8 bSourceID; + __u8 bCSourceID; + __u16 bmControls; + __u8 iTerminal; +} __attribute__((packed)); + + + +/* 4.7.2.8 Feature Unit Descriptor */ + +struct uac2_feature_unit_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bUnitID; + __u8 bSourceID; + /* bmaControls is actually u32, + * but u8 is needed for the hybrid parser */ + __u8 bmaControls[0]; /* variable length */ +} __attribute__((packed)); + +/* 4.9.2 Class-Specific AS Interface Descriptor */ + +struct uac_as_header_descriptor_v2 { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bTerminalLink; + __u8 bmControls; + __u8 bFormatType; + __u32 bmFormats; + __u8 bNrChannels; + __u32 bmChannelConfig; + __u8 iChannelNames; +} __attribute__((packed)); + + +/* A.7 Audio Function Category Codes */ +#define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00 +#define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01 +#define UAC2_FUNCTION_HOME_THEATER 0x02 +#define UAC2_FUNCTION_MICROPHONE 0x03 +#define UAC2_FUNCTION_HEADSET 0x04 +#define UAC2_FUNCTION_TELEPHONE 0x05 +#define UAC2_FUNCTION_CONVERTER 0x06 +#define UAC2_FUNCTION_SOUND_RECORDER 0x07 +#define UAC2_FUNCTION_IO_BOX 0x08 +#define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09 +#define UAC2_FUNCTION_PRO_AUDIO 0x0a +#define UAC2_FUNCTION_AUDIO_VIDEO 0x0b +#define UAC2_FUNCTION_CONTROL_PANEL 0x0c +#define UAC2_FUNCTION_OTHER 0xff + +/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */ +/* see audio.h for the rest, which is identical to v1 */ +#define UAC2_EFFECT_UNIT 0x07 +#define UAC2_PROCESSING_UNIT_V2 0x08 +#define UAC2_EXTENSION_UNIT_V2 0x09 +#define UAC2_CLOCK_SOURCE 0x0a +#define UAC2_CLOCK_SELECTOR 0x0b +#define UAC2_CLOCK_MULTIPLIER 0x0c +#define UAC2_SAMPLE_RATE_CONVERTER 0x0d + +/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */ +/* see audio.h for the rest, which is identical to v1 */ +#define UAC2_ENCODER 0x03 +#define UAC2_DECODER 0x04 + +/* A.11 Effect Unit Effect Types */ +#define UAC2_EFFECT_UNDEFINED 0x00 +#define UAC2_EFFECT_PARAM_EQ 0x01 +#define UAC2_EFFECT_REVERB 0x02 +#define UAC2_EFFECT_MOD_DELAY 0x03 +#define UAC2_EFFECT_DYN_RANGE_COMP 0x04 + +/* A.12 Processing Unit Process Types */ +#define UAC2_PROCESS_UNDEFINED 0x00 +#define UAC2_PROCESS_UP_DOWNMIX 0x01 +#define UAC2_PROCESS_DOLBY_PROLOCIC 0x02 +#define UAC2_PROCESS_STEREO_EXTENDER 0x03 + +/* A.14 Audio Class-Specific Request Codes */ +#define UAC2_CS_CUR 0x01 +#define UAC2_CS_RANGE 0x02 + +/* A.15 Encoder Type Codes */ +#define UAC2_ENCODER_UNDEFINED 0x00 +#define UAC2_ENCODER_OTHER 0x01 +#define UAC2_ENCODER_MPEG 0x02 +#define UAC2_ENCODER_AC3 0x03 +#define UAC2_ENCODER_WMA 0x04 +#define UAC2_ENCODER_DTS 0x05 + +/* A.16 Decoder Type Codes */ +#define UAC2_DECODER_UNDEFINED 0x00 +#define UAC2_DECODER_OTHER 0x01 +#define UAC2_DECODER_MPEG 0x02 +#define UAC2_DECODER_AC3 0x03 +#define UAC2_DECODER_WMA 0x04 +#define UAC2_DECODER_DTS 0x05 + +/* A.17.1 Clock Source Control Selectors */ +#define UAC2_CS_UNDEFINED 0x00 +#define UAC2_CS_CONTROL_SAM_FREQ 0x01 +#define UAC2_CS_CONTROL_CLOCK_VALID 0x02 + +/* A.17.2 Clock Selector Control Selectors */ +#define UAC2_CX_UNDEFINED 0x00 +#define UAC2_CX_CLOCK_SELECTOR 0x01 + +/* A.17.3 Clock Multiplier Control Selectors */ +#define UAC2_CM_UNDEFINED 0x00 +#define UAC2_CM_NUMERATOR 0x01 +#define UAC2_CM_DENOMINTATOR 0x02 + +/* A.17.4 Terminal Control Selectors */ +#define UAC2_TE_UNDEFINED 0x00 +#define UAC2_TE_COPY_PROTECT 0x01 +#define UAC2_TE_CONNECTOR 0x02 +#define UAC2_TE_OVERLOAD 0x03 +#define UAC2_TE_CLUSTER 0x04 +#define UAC2_TE_UNDERFLOW 0x05 +#define UAC2_TE_OVERFLOW 0x06 +#define UAC2_TE_LATENCY 0x07 + +/* A.17.5 Mixer Control Selectors */ +#define UAC2_MU_UNDEFINED 0x00 +#define UAC2_MU_MIXER 0x01 +#define UAC2_MU_CLUSTER 0x02 +#define UAC2_MU_UNDERFLOW 0x03 +#define UAC2_MU_OVERFLOW 0x04 +#define UAC2_MU_LATENCY 0x05 + +/* A.17.6 Selector Control Selectors */ +#define UAC2_SU_UNDEFINED 0x00 +#define UAC2_SU_SELECTOR 0x01 +#define UAC2_SU_LATENCY 0x02 + +/* A.17.7 Feature Unit Control Selectors */ +/* see audio.h for the rest, which is identical to v1 */ +#define UAC2_FU_INPUT_GAIN 0x0b +#define UAC2_FU_INPUT_GAIN_PAD 0x0c +#define UAC2_FU_PHASE_INVERTER 0x0d +#define UAC2_FU_UNDERFLOW 0x0e +#define UAC2_FU_OVERFLOW 0x0f +#define UAC2_FU_LATENCY 0x10 + +/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */ +#define UAC2_PE_UNDEFINED 0x00 +#define UAC2_PE_ENABLE 0x01 +#define UAC2_PE_CENTERFREQ 0x02 +#define UAC2_PE_QFACTOR 0x03 +#define UAC2_PE_GAIN 0x04 +#define UAC2_PE_UNDERFLOW 0x05 +#define UAC2_PE_OVERFLOW 0x06 +#define UAC2_PE_LATENCY 0x07 + +/* A.17.8.2 Reverberation Effect Unit Control Selectors */ +#define UAC2_RV_UNDEFINED 0x00 +#define UAC2_RV_ENABLE 0x01 +#define UAC2_RV_TYPE 0x02 +#define UAC2_RV_LEVEL 0x03 +#define UAC2_RV_TIME 0x04 +#define UAC2_RV_FEEDBACK 0x05 +#define UAC2_RV_PREDELAY 0x06 +#define UAC2_RV_DENSITY 0x07 +#define UAC2_RV_HIFREQ_ROLLOFF 0x08 +#define UAC2_RV_UNDERFLOW 0x09 +#define UAC2_RV_OVERFLOW 0x0a +#define UAC2_RV_LATENCY 0x0b + +/* A.17.8.3 Modulation Delay Effect Control Selectors */ +#define UAC2_MD_UNDEFINED 0x00 +#define UAC2_MD_ENABLE 0x01 +#define UAC2_MD_BALANCE 0x02 +#define UAC2_MD_RATE 0x03 +#define UAC2_MD_DEPTH 0x04 +#define UAC2_MD_TIME 0x05 +#define UAC2_MD_FEEDBACK 0x06 +#define UAC2_MD_UNDERFLOW 0x07 +#define UAC2_MD_OVERFLOW 0x08 +#define UAC2_MD_LATENCY 0x09 + +/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */ +#define UAC2_DR_UNDEFINED 0x00 +#define UAC2_DR_ENABLE 0x01 +#define UAC2_DR_COMPRESSION_RATE 0x02 +#define UAC2_DR_MAXAMPL 0x03 +#define UAC2_DR_THRESHOLD 0x04 +#define UAC2_DR_ATTACK_TIME 0x05 +#define UAC2_DR_RELEASE_TIME 0x06 +#define UAC2_DR_UNDEFLOW 0x07 +#define UAC2_DR_OVERFLOW 0x08 +#define UAC2_DR_LATENCY 0x09 + +/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */ +#define UAC2_UD_UNDEFINED 0x00 +#define UAC2_UD_ENABLE 0x01 +#define UAC2_UD_MODE_SELECT 0x02 +#define UAC2_UD_CLUSTER 0x03 +#define UAC2_UD_UNDERFLOW 0x04 +#define UAC2_UD_OVERFLOW 0x05 +#define UAC2_UD_LATENCY 0x06 + +/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */ +#define UAC2_DP_UNDEFINED 0x00 +#define UAC2_DP_ENABLE 0x01 +#define UAC2_DP_MODE_SELECT 0x02 +#define UAC2_DP_CLUSTER 0x03 +#define UAC2_DP_UNDERFFLOW 0x04 +#define UAC2_DP_OVERFLOW 0x05 +#define UAC2_DP_LATENCY 0x06 + +/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */ +#define UAC2_ST_EXT_UNDEFINED 0x00 +#define UAC2_ST_EXT_ENABLE 0x01 +#define UAC2_ST_EXT_WIDTH 0x02 +#define UAC2_ST_EXT_UNDEFLOW 0x03 +#define UAC2_ST_EXT_OVERFLOW 0x04 +#define UAC2_ST_EXT_LATENCY 0x05 + +/* A.17.10 Extension Unit Control Selectors */ +#define UAC2_XU_UNDEFINED 0x00 +#define UAC2_XU_ENABLE 0x01 +#define UAC2_XU_CLUSTER 0x02 +#define UAC2_XU_UNDERFLOW 0x03 +#define UAC2_XU_OVERFLOW 0x04 +#define UAC2_XU_LATENCY 0x05 + +/* A.17.11 AudioStreaming Interface Control Selectors */ +#define UAC2_AS_UNDEFINED 0x00 +#define UAC2_AS_ACT_ALT_SETTING 0x01 +#define UAC2_AS_VAL_ALT_SETTINGS 0x02 +#define UAC2_AS_AUDIO_DATA_FORMAT 0x03 + +/* A.17.12 Encoder Control Selectors */ +#define UAC2_EN_UNDEFINED 0x00 +#define UAC2_EN_BIT_RATE 0x01 +#define UAC2_EN_QUALITY 0x02 +#define UAC2_EN_VBR 0x03 +#define UAC2_EN_TYPE 0x04 +#define UAC2_EN_UNDERFLOW 0x05 +#define UAC2_EN_OVERFLOW 0x06 +#define UAC2_EN_ENCODER_ERROR 0x07 +#define UAC2_EN_PARAM1 0x08 +#define UAC2_EN_PARAM2 0x09 +#define UAC2_EN_PARAM3 0x0a +#define UAC2_EN_PARAM4 0x0b +#define UAC2_EN_PARAM5 0x0c +#define UAC2_EN_PARAM6 0x0d +#define UAC2_EN_PARAM7 0x0e +#define UAC2_EN_PARAM8 0x0f + +/* A.17.13.1 MPEG Decoder Control Selectors */ +#define UAC2_MPEG_UNDEFINED 0x00 +#define UAC2_MPEG_DUAL_CHANNEL 0x01 +#define UAC2_MPEG_SECOND_STEREO 0x02 +#define UAC2_MPEG_MULTILINGUAL 0x03 +#define UAC2_MPEG_DYN_RANGE 0x04 +#define UAC2_MPEG_SCALING 0x05 +#define UAC2_MPEG_HILO_SCALING 0x06 +#define UAC2_MPEG_UNDERFLOW 0x07 +#define UAC2_MPEG_OVERFLOW 0x08 +#define UAC2_MPEG_DECODER_ERROR 0x09 + +/* A17.13.2 AC3 Decoder Control Selectors */ +#define UAC2_AC3_UNDEFINED 0x00 +#define UAC2_AC3_MODE 0x01 +#define UAC2_AC3_DYN_RANGE 0x02 +#define UAC2_AC3_SCALING 0x03 +#define UAC2_AC3_HILO_SCALING 0x04 +#define UAC2_AC3_UNDERFLOW 0x05 +#define UAC2_AC3_OVERFLOW 0x06 +#define UAC2_AC3_DECODER_ERROR 0x07 + +/* A17.13.3 WMA Decoder Control Selectors */ +#define UAC2_WMA_UNDEFINED 0x00 +#define UAC2_WMA_UNDERFLOW 0x01 +#define UAC2_WMA_OVERFLOW 0x02 +#define UAC2_WMA_DECODER_ERROR 0x03 + +/* A17.13.4 DTS Decoder Control Selectors */ +#define UAC2_DTS_UNDEFINED 0x00 +#define UAC2_DTS_UNDERFLOW 0x01 +#define UAC2_DTS_OVERFLOW 0x02 +#define UAC2_DTS_DECODER_ERROR 0x03 + +/* A17.14 Endpoint Control Selectors */ +#define UAC2_EP_CS_UNDEFINED 0x00 +#define UAC2_EP_CS_PITCH 0x01 +#define UAC2_EP_CS_DATA_OVERRUN 0x02 +#define UAC2_EP_CS_DATA_UNDERRUN 0x03 + +#endif /* __LINUX_USB_AUDIO_V2_H */ + diff --git a/pci/hda/hda_intel.patch b/pci/hda/hda_intel.patch index 693bade6f..58502c3e4 100644 --- a/pci/hda/hda_intel.patch +++ b/pci/hda/hda_intel.patch @@ -1,11 +1,11 @@ ---- ../../alsa-kernel/pci/hda/hda_intel.c 2009-12-22 08:18:18.547773851 +0100 -+++ hda_intel.c 2009-12-22 08:36:21.275945095 +0100 +--- ../../alsa-kernel/pci/hda/hda_intel.c 2010-03-15 15:54:10.943774798 +0100 ++++ hda_intel.c 2010-03-16 07:42:31.311522259 +0100 @@ -1,3 +1,4 @@ +#include "adriver.h" /* * * hda_intel.c - Implementation of primary alsa driver code base -@@ -2318,6 +2319,10 @@ +@@ -2352,6 +2353,10 @@ } } @@ -16,7 +16,7 @@ /* * white/black-list for enable_msi */ -@@ -2326,6 +2331,14 @@ +@@ -2363,6 +2368,14 @@ {} }; @@ -31,7 +31,7 @@ static void __devinit check_msi(struct azx *chip) { const struct snd_pci_quirk *q; -@@ -2334,14 +2347,29 @@ +@@ -2371,7 +2384,11 @@ chip->msi = !!enable_msi; return; } @@ -43,10 +43,9 @@ q = snd_pci_quirk_lookup(chip->pci, msi_black_list); if (q) { printk(KERN_INFO - "hda_intel: msi for device %04x:%04x set to %d\n", - q->subvendor, q->subdevice, q->value); +@@ -2380,6 +2397,16 @@ chip->msi = q->value; -+ return; + return; } +#ifndef AZX_ENABLE_MSI_DEFAULT + q = snd_pci_quirk_lookup(chip->pci, msi_white_list); @@ -58,10 +57,10 @@ + return; + } +#endif - } - -@@ -2446,7 +2474,7 @@ + /* NVidia chipsets seem to cause troubles with MSI */ + if (chip->driver_type == AZX_DRIVER_NVIDIA) { +@@ -2491,7 +2518,7 @@ PCI_DEVICE_ID_ATI_SBX00_SMBUS, NULL); if (p_smbus) { diff --git a/usb/Makefile b/usb/Makefile index 1f206a112..d35199740 100644 --- a/usb/Makefile +++ b/usb/Makefile @@ -5,11 +5,12 @@ endif include $(SND_TOPDIR)/toplevel.config include $(SND_TOPDIR)/Makefile.conf -clean-files := usbaudio.c usbmidi.c usbmixer.c +clean-files := card.c endpoint.c helper.c quirks.c urb.c midi.c \ + mixer.c mixer_quirks.c # for compatibility extra-snd-usb-lib-objs := usbcompat.o -export-objs := usbmidi.o usbcompat.o +export-objs := midi.o usbcompat.o include $(SND_TOPDIR)/alsa-kernel/usb/Makefile @@ -17,6 +18,11 @@ EXTRA_CFLAGS += -I$(SND_TOPDIR)/alsa-kernel/usb include $(SND_TOPDIR)/Rules.make -usbaudio.c: usbaudio.patch usbaudio.inc usbaudio.inc1 $(SND_TOPDIR)/alsa-kernel/usb/usbaudio.c -usbmidi.c: usbmidi.patch usbmidi.inc usbmidi.inc1 $(SND_TOPDIR)/alsa-kernel/usb/usbmidi.c -usbmixer.c: usbmixer.patch $(SND_TOPDIR)/alsa-kernel/usb/usbmixer.c +card.c: card.patch card.inc card.inc1 usbaudio.inc $(SND_TOPDIR)/alsa-kernel/usb/card.c +endpoint.c: endpoint.patch usbaudio.inc $(SND_TOPDIR)/alsa-kernel/usb/endpoint.c +helper.c: helper.patch usbaudio.inc $(SND_TOPDIR)/alsa-kernel/usb/helper.c +quirks.c: quirks.patch usbaudio.inc $(SND_TOPDIR)/alsa-kernel/usb/quirks.c +urb.c: urb.patch usbaudio.inc $(SND_TOPDIR)/alsa-kernel/usb/urb.c +midi.c: midi.patch midi.inc midi.inc1 $(SND_TOPDIR)/alsa-kernel/usb/midi.c +mixer.c: mixer.patch $(SND_TOPDIR)/alsa-kernel/usb/mixer.c +mixer_quirks.c: mixer_quirks.patch $(SND_TOPDIR)/alsa-kernel/usb/mixer_quirks.c diff --git a/usb/caiaq/input.patch b/usb/caiaq/input.patch index e54ee0a35..60cd7fc76 100644 --- a/usb/caiaq/input.patch +++ b/usb/caiaq/input.patch @@ -1,12 +1,12 @@ ---- ../../alsa-kernel/usb/caiaq/input.c 2009-04-14 13:38:05.000000000 +0200 -+++ input.c 2009-04-14 13:41:51.000000000 +0200 +--- ../../alsa-kernel/usb/caiaq/input.c 2010-03-22 16:10:59.103773419 +0100 ++++ input.c 2010-03-22 18:06:20.773262057 +0100 @@ -1,3 +1,5 @@ +#include "adriver.h" +#include "../usbcompat.h" /* * Copyright (c) 2006,2007 Daniel Mack, Tim Ruetz * -@@ -18,12 +20,29 @@ +@@ -18,13 +20,30 @@ #include <linux/init.h> #include <linux/usb.h> @@ -15,6 +15,7 @@ +#else +#include <linux/usb_input.h> +#endif + #include <sound/core.h> #include <sound/pcm.h> #include "device.h" @@ -36,7 +37,43 @@ static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7 }; -@@ -263,7 +282,11 @@ +@@ -281,7 +300,11 @@ + + static int snd_usb_caiaq_input_open(struct input_dev *idev) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) ++ struct snd_usb_caiaqdev *dev = idev->private; ++#else + struct snd_usb_caiaqdev *dev = input_get_drvdata(idev); ++#endif + + if (!dev) + return -EINVAL; +@@ -298,7 +321,11 @@ + + static void snd_usb_caiaq_input_close(struct input_dev *idev) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) ++ struct snd_usb_caiaqdev *dev = idev->private; ++#else + struct snd_usb_caiaqdev *dev = input_get_drvdata(idev); ++#endif + + if (!dev) + return; +@@ -336,7 +363,11 @@ + struct input_dev *input; + int i, ret = 0; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) + input = input_allocate_device(); ++#else ++ input = kzalloc(sizeof(*input), GFP_KERNEL); ++#endif + if (!input) + return -ENOMEM; + +@@ -346,9 +377,17 @@ input->name = dev->product_name; input->phys = dev->phys; usb_to_input_id(usb_dev, &input->id); @@ -46,5 +83,25 @@ + input->cdev.dev = &usb_dev->dev; +#endif - switch (dev->chip.usb_id) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) + input_set_drvdata(input, dev); ++#else ++ input->private = dev; ++#endif + + switch (dev->chip.usb_id) { case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): +@@ -467,9 +506,13 @@ + for (i = 0; i < input->keycodemax; i++) + __set_bit(dev->keycode[i], input->keybit); + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15) + ret = input_register_device(input); + if (ret < 0) + goto exit_free_idev; ++#else ++ input_register_device(input); ++#endif + + dev->input_dev = input; + return 0; diff --git a/usb/card.inc b/usb/card.inc new file mode 100644 index 000000000..4b9f7849d --- /dev/null +++ b/usb/card.inc @@ -0,0 +1,8 @@ +#include "usbaudio.inc" +#ifdef OLD_USB +static void * usb_audio_probe(struct usb_device *dev, unsigned int ifnum, + const struct usb_device_id *id); +static void usb_audio_disconnect(struct usb_device *dev, void *ptr); +static int usb_reset_configuration(struct usb_device *dev); +#endif + diff --git a/usb/usbaudio.inc1 b/usb/card.inc1 index 56649e589..56649e589 100644 --- a/usb/usbaudio.inc1 +++ b/usb/card.inc1 diff --git a/usb/card.patch b/usb/card.patch new file mode 100644 index 000000000..14ee3f6ab --- /dev/null +++ b/usb/card.patch @@ -0,0 +1,102 @@ +--- ../alsa-kernel/usb/card.c 2010-03-10 09:22:24.488022926 +0100 ++++ card.c 2010-03-10 09:58:02.287522401 +0100 +@@ -1,3 +1,4 @@ ++#include "card.inc" + /* + * (Tentative) USB Audio Driver for ALSA + * +@@ -78,7 +79,12 @@ + static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; + static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; + static int nrpacks = 8; /* max. number of packets per urb */ +-static int async_unlink = 1; ++static int async_unlink = ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) ++1; ++#else ++0; /* disabled as default for buggy async-unlink handling */ ++#endif + static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ + static int ignore_ctl_error; + +@@ -237,7 +243,11 @@ + case UAC_VERSION_2: { + struct uac_clock_source_descriptor *cs; + struct usb_interface_assoc_descriptor *assoc = ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) + usb_ifnum_to_if(dev, ctrlif)->intf_assoc; ++#else ++ NULL; ++#endif + + if (!assoc) { + snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); +@@ -340,8 +350,13 @@ + chip->nrpacks = nrpacks; + chip->async_unlink = async_unlink; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct)); ++#else ++ chip->usb_id = USB_ID(dev->descriptor.idVendor, ++ dev->descriptor.idProduct); ++#endif + INIT_LIST_HEAD(&chip->pcm_list); + INIT_LIST_HEAD(&chip->midi_list); + INIT_LIST_HEAD(&chip->mixer_list); +@@ -427,8 +442,12 @@ + + alts = &intf->altsetting[0]; + ifnum = get_iface_desc(alts)->bInterfaceNumber; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct)); ++#else ++ id = USB_ID(dev->descriptor.idVendor, dev->descriptor.idProduct); ++#endif + if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) + goto __err_val; + +@@ -546,6 +565,7 @@ + } + } + ++#ifndef OLD_USB + /* + * new 2.5 USB kernel API + */ +@@ -606,6 +626,7 @@ + return 0; + } + #endif /* CONFIG_PM */ ++#endif /* OLD_USB */ + + static struct usb_device_id usb_audio_ids [] = { + #include "quirks-table.h" +@@ -622,11 +643,19 @@ + */ + + static struct usb_driver usb_audio_driver = { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) /* FIXME: find right number */ ++ .owner = THIS_MODULE, ++#endif + .name = "snd-usb-audio", + .probe = usb_audio_probe, + .disconnect = usb_audio_disconnect, ++#ifndef OLD_USB + .suspend = usb_audio_suspend, + .resume = usb_audio_resume, ++#endif ++#ifdef OLD_USB ++ .driver_list = LIST_HEAD_INIT(usb_audio_driver.driver_list), ++#endif + .id_table = usb_audio_ids, + }; + +@@ -646,3 +675,5 @@ + + module_init(snd_usb_audio_init); + module_exit(snd_usb_audio_cleanup); ++ ++#include "card.inc1" diff --git a/usb/endpoint.patch b/usb/endpoint.patch new file mode 100644 index 000000000..7b124c061 --- /dev/null +++ b/usb/endpoint.patch @@ -0,0 +1,44 @@ +--- ../alsa-kernel/usb/endpoint.c 2010-03-10 09:22:24.488022926 +0100 ++++ endpoint.c 2010-03-10 10:07:52.316022217 +0100 +@@ -1,3 +1,5 @@ ++#define __NO_VERSION__ ++#include "usbaudio.inc" + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -183,7 +185,11 @@ + (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING && + altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) || + altsd->bNumEndpoints < 1 || ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0) ++#else ++ get_endpoint(alts, 0)->wMaxPacketSize == 0) ++#endif + continue; + /* must be isochronous */ + if ((get_endpoint(alts, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != +@@ -270,7 +276,11 @@ + fp && fp->altsetting == 1 && fp->channels == 1 && + fp->formats == SNDRV_PCM_FMTBIT_S16_LE && + protocol == UAC_VERSION_1 && ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == ++#else ++ get_endpoint(alts, 0)->wMaxPacketSize == ++#endif + fp->maxpacksize * 2) + continue; + +@@ -297,7 +307,11 @@ + fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; + fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = snd_usb_parse_datainterval(chip, alts); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); ++#else ++ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; ++#endif + /* num_channels is only set for v2 interfaces */ + fp->channels = num_channels; + if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) diff --git a/usb/format.c b/usb/format.c new file mode 100644 index 000000000..739dc1181 --- /dev/null +++ b/usb/format.c @@ -0,0 +1,3 @@ +#define __NO_VERSION__ +#include "usbaudio.inc" +#include "../alsa-kernel/usb/format.c" diff --git a/usb/helper.patch b/usb/helper.patch new file mode 100644 index 000000000..941624fdc --- /dev/null +++ b/usb/helper.patch @@ -0,0 +1,22 @@ +--- ../alsa-kernel/usb/helper.c 2010-03-10 09:22:24.488022926 +0100 ++++ helper.c 2010-03-10 09:52:23.975522071 +0100 +@@ -1,3 +1,5 @@ ++#define __NO_VERSION__ ++#include "usbaudio.inc" + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -90,8 +92,13 @@ + if (!buf) + return -ENOMEM; + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) + err = usb_control_msg(dev, pipe, request, requesttype, + value, index, buf, size, timeout); ++#else ++ err = usb_control_msg(dev, pipe, request, requesttype, ++ value, index, buf, size, timeout * HZ / 1000); ++#endif + if (size > 0) { + memcpy(data, buf, size); + kfree(buf); diff --git a/usb/usbmidi.inc b/usb/midi.inc index be3a8b2be..be3a8b2be 100644 --- a/usb/usbmidi.inc +++ b/usb/midi.inc diff --git a/usb/usbmidi.inc1 b/usb/midi.inc1 index fa9296dd8..fa9296dd8 100644 --- a/usb/usbmidi.inc1 +++ b/usb/midi.inc1 diff --git a/usb/usbmidi.patch b/usb/midi.patch index 612dfa76b..68887907d 100644 --- a/usb/usbmidi.patch +++ b/usb/midi.patch @@ -1,12 +1,12 @@ ---- ../alsa-kernel/usb/usbmidi.c 2009-11-23 08:30:55.000000000 +0100 -+++ usbmidi.c 2009-12-16 19:56:07.000000000 +0100 +--- ../alsa-kernel/usb/midi.c 2010-03-10 09:22:24.488022926 +0100 ++++ midi.c 2010-03-10 09:26:34.028022239 +0100 @@ -1,3 +1,5 @@ -+#include "usbmidi.inc" ++#include "midi.inc" + /* * usbmidi.c - ALSA USB MIDI driver * -@@ -243,7 +245,11 @@ +@@ -246,7 +248,11 @@ /* * Processes the data read from the device. */ @@ -18,7 +18,7 @@ { struct snd_usb_midi_in_endpoint* ep = urb->context; -@@ -267,7 +273,11 @@ +@@ -270,7 +276,11 @@ snd_usbmidi_submit_urb(urb, GFP_ATOMIC); } @@ -30,7 +30,7 @@ { struct out_urb_context *context = urb->context; struct snd_usb_midi_out_endpoint* ep = context->ep; -@@ -377,8 +387,13 @@ +@@ -380,8 +390,13 @@ return -ENOMEM; dump_urb("sending", buf, len); if (ep->urbs[0].urb) @@ -44,7 +44,7 @@ kfree(buf); return err; } -@@ -894,7 +909,12 @@ +@@ -897,7 +912,12 @@ int is_light_load; intf = umidi->iface; @@ -57,7 +57,7 @@ if (umidi->roland_load_ctl->private_value == is_light_load) return; hostif = &intf->altsetting[umidi->roland_load_ctl->private_value]; -@@ -981,7 +1001,11 @@ +@@ -984,7 +1004,11 @@ struct usbmidi_out_port* port = substream->runtime->private_data; struct snd_usb_midi_out_endpoint *ep = port->ep; unsigned int drain_urbs; @@ -69,7 +69,7 @@ long timeout = msecs_to_jiffies(50); /* -@@ -992,6 +1016,7 @@ +@@ -995,6 +1019,7 @@ drain_urbs = ep->active_urbs; if (drain_urbs) { ep->drain_urbs |= drain_urbs; @@ -77,7 +77,7 @@ do { prepare_to_wait(&ep->drain_wait, &wait, TASK_UNINTERRUPTIBLE); -@@ -1001,6 +1026,18 @@ +@@ -1004,6 +1029,18 @@ drain_urbs &= ep->drain_urbs; } while (drain_urbs && timeout); finish_wait(&ep->drain_wait, &wait); @@ -96,7 +96,7 @@ } spin_unlock_irq(&ep->buffer_lock); } -@@ -1679,7 +1716,11 @@ +@@ -1700,7 +1737,11 @@ intf = umidi->iface; if (!intf || intf->num_altsetting < 1) return -ENOENT; @@ -108,9 +108,9 @@ intfd = get_iface_desc(hostif); for (i = 0; i < intfd->bNumEndpoints; ++i) { -@@ -2046,3 +2087,5 @@ +@@ -2067,3 +2108,5 @@ EXPORT_SYMBOL(snd_usbmidi_input_stop); EXPORT_SYMBOL(snd_usbmidi_input_start); EXPORT_SYMBOL(snd_usbmidi_disconnect); + -+#include "usbmidi.inc1" ++#include "midi.inc1" diff --git a/usb/misc/Makefile b/usb/misc/Makefile new file mode 100644 index 000000000..a18f311cf --- /dev/null +++ b/usb/misc/Makefile @@ -0,0 +1,10 @@ +ifndef SND_TOPDIR +SND_TOPDIR=../.. +endif + +include $(SND_TOPDIR)/toplevel.config +include $(SND_TOPDIR)/Makefile.conf + +include $(SND_TOPDIR)/alsa-kernel/usb/misc/Makefile + +include $(SND_TOPDIR)/Rules.make diff --git a/usb/misc/ua101.c b/usb/misc/ua101.c new file mode 100644 index 000000000..c89482d3b --- /dev/null +++ b/usb/misc/ua101.c @@ -0,0 +1,3 @@ +#include "adriver.h" +#include "../../alsa-kernel/usb/misc/ua101.c" +EXPORT_NO_SYMBOLS; diff --git a/usb/usbmixer.inc b/usb/mixer.inc index 52670dfa3..52670dfa3 100644 --- a/usb/usbmixer.inc +++ b/usb/mixer.inc diff --git a/usb/usbmixer.patch b/usb/mixer.patch index c25f7e0a8..b3322cbf2 100644 --- a/usb/usbmixer.patch +++ b/usb/mixer.patch @@ -1,14 +1,14 @@ ---- ../alsa-kernel/usb/usbmixer.c 2010-02-23 17:02:35.031036779 +0100 -+++ usbmixer.c 2010-02-23 17:31:28.919536350 +0100 +--- ../alsa-kernel/usb/mixer.c 2010-03-12 12:21:47.911524364 +0100 ++++ mixer.c 2010-03-12 12:26:11.336022654 +0100 @@ -1,3 +1,5 @@ -+#include "usbmixer.inc" ++#include "mixer.inc" + /* * (Tentative) USB Audio Driver for ALSA * -@@ -42,6 +44,14 @@ - - #include "usbaudio.h" +@@ -128,6 +130,14 @@ + USB_XU_SOFT_LIMIT_SELECTOR = 0x03 /* soft limiter */ + }; +#ifndef USB_DT_CS_DEVICE +#define USB_DT_CS_DEVICE 0x21 @@ -19,9 +19,9 @@ +#endif + /* - */ - -@@ -1899,7 +1909,11 @@ + * manual mapping of mixer names + * if the mixer topology is too complicated and the parsed names are +@@ -1967,7 +1977,11 @@ } } @@ -33,7 +33,7 @@ { struct usb_mixer_interface *mixer = urb->context; -@@ -1943,7 +1957,11 @@ +@@ -2011,7 +2025,11 @@ return 0; epnum = usb_endpoint_num(ep); @@ -45,16 +45,3 @@ transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); if (!transfer_buffer) return -ENOMEM; -@@ -1960,7 +1978,12 @@ - return 0; - } - -+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) -+static void snd_usb_soundblaster_remote_complete(struct urb *urb, -+ struct pt_regs *regs) -+#else - static void snd_usb_soundblaster_remote_complete(struct urb *urb) -+#endif - { - struct usb_mixer_interface *mixer = urb->context; - const struct rc_config *rc = mixer->rc_cfg; diff --git a/usb/mixer_quirks.patch b/usb/mixer_quirks.patch new file mode 100644 index 000000000..9baa116e2 --- /dev/null +++ b/usb/mixer_quirks.patch @@ -0,0 +1,20 @@ +--- ../alsa-kernel/usb/mixer_quirks.c 2010-03-12 12:21:47.911524364 +0100 ++++ mixer_quirks.c 2010-03-12 12:35:31.835272055 +0100 +@@ -1,3 +1,4 @@ ++#include "mixer.inc" + /* + * USB Audio Driver for ALSA + * +@@ -62,7 +63,12 @@ + { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ + }; + ++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) ++static void snd_usb_soundblaster_remote_complete(struct urb *urb, ++ struct pt_regs *regs) ++#else + static void snd_usb_soundblaster_remote_complete(struct urb *urb) ++#endif + { + struct usb_mixer_interface *mixer = urb->context; + const struct rc_config *rc = mixer->rc_cfg; diff --git a/usb/pcm.c b/usb/pcm.c new file mode 100644 index 000000000..e1c20e241 --- /dev/null +++ b/usb/pcm.c @@ -0,0 +1,3 @@ +#define __NO_VERSION__ +#include "usbaudio.inc" +#include "../alsa-kernel/usb/pcm.c" diff --git a/usb/proc.c b/usb/proc.c new file mode 100644 index 000000000..4de98bd93 --- /dev/null +++ b/usb/proc.c @@ -0,0 +1,3 @@ +#define __NO_VERSION__ +#include "usbaudio.inc" +#include "../alsa-kernel/usb/proc.c" diff --git a/usb/quirks.patch b/usb/quirks.patch new file mode 100644 index 000000000..051d45016 --- /dev/null +++ b/usb/quirks.patch @@ -0,0 +1,77 @@ +--- ../alsa-kernel/usb/quirks.c 2010-03-10 09:22:24.488022926 +0100 ++++ quirks.c 2010-03-10 09:59:44.787522189 +0100 +@@ -1,3 +1,5 @@ ++#define __NO_VERSION__ ++#include "usbaudio.inc" + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -157,7 +159,11 @@ + } + alts = &iface->altsetting[fp->altset_idx]; + fp->datainterval = snd_usb_parse_datainterval(chip, alts); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); ++#else ++ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; ++#endif + usb_set_interface(chip->dev, fp->iface, 0); + snd_usb_init_pitch(chip, fp->iface, alts, fp); + snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max); +@@ -228,7 +234,11 @@ + fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; + fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; + fp->datainterval = 0; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); ++#else ++ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; ++#endif + + switch (fp->maxpacksize) { + case 0x120: +@@ -313,8 +323,13 @@ + struct usb_host_config *config = dev->actconfig; + int err; + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || + le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { ++#else ++ if (get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_OLD || ++ get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_NEW) { ++#endif + snd_printdd("sending Extigy boot sequence...\n"); + /* Send message to force it to reconnect with full interface. */ + err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), +@@ -326,8 +341,13 @@ + if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); + err = usb_reset_configuration(dev); + if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + snd_printdd("extigy_boot: new boot length = %d\n", + le16_to_cpu(get_cfg_desc(config)->wTotalLength)); ++#else ++ snd_printdd("extigy_boot: new boot length = %d\n", ++ get_cfg_desc(config)->wTotalLength); ++#endif + return -ENODEV; /* quit this anyway */ + } + return 0; +@@ -335,6 +355,8 @@ + + static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) + { ++/* The pre-2.6.13 EHCI driver blows up when doing high speed iso transfers */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) + u8 buf = 1; + + snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, +@@ -346,6 +368,7 @@ + 1, 2000, NULL, 0, 1000); + return -ENODEV; + } ++#endif + return 0; + } + diff --git a/usb/ua101.c b/usb/ua101.c deleted file mode 100644 index 131b9776c..000000000 --- a/usb/ua101.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "adriver.h" -#include "../alsa-kernel/usb/ua101.c" -EXPORT_NO_SYMBOLS; diff --git a/usb/urb.patch b/usb/urb.patch new file mode 100644 index 000000000..6637745ec --- /dev/null +++ b/usb/urb.patch @@ -0,0 +1,72 @@ +--- ../alsa-kernel/usb/urb.c 2010-03-10 09:22:24.488022926 +0100 ++++ urb.c 2010-03-10 09:53:00.839522084 +0100 +@@ -1,3 +1,5 @@ ++#define __NO_VERSION__ ++#include "usbaudio.inc" + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -69,9 +71,12 @@ + if (test_bit(i, &subs->active_mask)) { + if (!test_and_set_bit(i, &subs->unlink_mask)) { + struct urb *u = subs->dataurb[i].urb; +- if (async) ++ if (async) { ++#ifdef URB_ASYNC_UNLINK ++ u->transfer_flags |= URB_ASYNC_UNLINK; ++#endif + usb_unlink_urb(u); +- else ++ } else + usb_kill_urb(u); + } + } +@@ -81,9 +86,12 @@ + if (test_bit(i+16, &subs->active_mask)) { + if (!test_and_set_bit(i+16, &subs->unlink_mask)) { + struct urb *u = subs->syncurb[i].urb; +- if (async) ++ if (async) { ++#ifdef URB_ASYNC_UNLINK ++ u->transfer_flags |= URB_ASYNC_UNLINK; ++#endif + usb_unlink_urb(u); +- else ++ } else + usb_kill_urb(u); + } + } +@@ -162,7 +170,11 @@ + /* + * complete callback from data urb + */ ++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) ++static void snd_complete_urb(struct urb *urb, struct pt_regs *regs) ++#else + static void snd_complete_urb(struct urb *urb) ++#endif + { + struct snd_urb_ctx *ctx = urb->context; + struct snd_usb_substream *subs = ctx->subs; +@@ -185,7 +197,11 @@ + /* + * complete callback from sync urb + */ ++#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) ++static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) ++#else + static void snd_complete_sync_urb(struct urb *urb) ++#endif + { + struct snd_urb_ctx *ctx = urb->context; + struct snd_usb_substream *subs = ctx->subs; +@@ -333,7 +349,9 @@ + if (!u->urb) + goto out_of_memory; + u->urb->transfer_buffer = subs->syncbuf + i * 4; ++#ifdef HAVE_USB_BUFFERS + u->urb->transfer_dma = subs->sync_dma + i * 4; ++#endif + u->urb->transfer_buffer_length = 4; + u->urb->pipe = subs->syncpipe; + u->urb->transfer_flags = URB_ISO_ASAP | diff --git a/usb/usbaudio.inc b/usb/usbaudio.inc index 30d231c04..f883782b6 100644 --- a/usb/usbaudio.inc +++ b/usb/usbaudio.inc @@ -19,13 +19,6 @@ #define USB_DT_CS_ENDPOINT 0x25 #endif -#ifdef OLD_USB -static void * usb_audio_probe(struct usb_device *dev, unsigned int ifnum, - const struct usb_device_id *id); -static void usb_audio_disconnect(struct usb_device *dev, void *ptr); -static int usb_reset_configuration(struct usb_device *dev); -#endif - #ifndef USB_ENDPOINT_SYNCTYPE #define USB_ENDPOINT_SYNCTYPE 0x0c #define USB_ENDPOINT_SYNC_NONE (0 << 2) diff --git a/usb/usbaudio.patch b/usb/usbaudio.patch deleted file mode 100644 index 44fa82cbf..000000000 --- a/usb/usbaudio.patch +++ /dev/null @@ -1,302 +0,0 @@ ---- ../alsa-kernel/usb/usbaudio.c 2010-03-02 11:29:15.000000000 +0100 -+++ usbaudio.c 2010-03-02 11:32:39.000000000 +0100 -@@ -1,3 +1,4 @@ -+#include "usbaudio.inc" - /* - * (Tentative) USB Audio Driver for ALSA - * -@@ -71,7 +72,12 @@ - static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; - static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; - static int nrpacks = 8; /* max. number of packets per urb */ --static int async_unlink = 1; -+static int async_unlink = -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) -+1; -+#else -+0; /* disabled as default for buggy async-unlink handling */ -+#endif - static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/ - static int ignore_ctl_error; - -@@ -704,7 +710,11 @@ - /* - * complete callback from data urb - */ -+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) -+static void snd_complete_urb(struct urb *urb, struct pt_regs *regs) -+#else - static void snd_complete_urb(struct urb *urb) -+#endif - { - struct snd_urb_ctx *ctx = urb->context; - struct snd_usb_substream *subs = ctx->subs; -@@ -727,7 +737,11 @@ - /* - * complete callback from sync urb - */ -+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER) -+static void snd_complete_sync_urb(struct urb *urb, struct pt_regs *regs) -+#else - static void snd_complete_sync_urb(struct urb *urb) -+#endif - { - struct snd_urb_ctx *ctx = urb->context; - struct snd_usb_substream *subs = ctx->subs; -@@ -769,9 +783,12 @@ - if (test_bit(i, &subs->active_mask)) { - if (!test_and_set_bit(i, &subs->unlink_mask)) { - struct urb *u = subs->dataurb[i].urb; -- if (async) -+ if (async) { -+#ifdef URB_ASYNC_UNLINK -+ u->transfer_flags |= URB_ASYNC_UNLINK; -+#endif - usb_unlink_urb(u); -- else -+ } else - usb_kill_urb(u); - } - } -@@ -781,9 +798,12 @@ - if (test_bit(i+16, &subs->active_mask)) { - if (!test_and_set_bit(i+16, &subs->unlink_mask)) { - struct urb *u = subs->syncurb[i].urb; -- if (async) -+ if (async) { -+#ifdef URB_ASYNC_UNLINK -+ u->transfer_flags |= URB_ASYNC_UNLINK; -+#endif - usb_unlink_urb(u); -- else -+ } else - usb_kill_urb(u); - } - } -@@ -1139,7 +1159,9 @@ - if (!u->urb) - goto out_of_memory; - u->urb->transfer_buffer = subs->syncbuf + i * 4; -+#ifdef HAVE_USB_BUFFERS - u->urb->transfer_dma = subs->sync_dma + i * 4; -+#endif - u->urb->transfer_buffer_length = 4; - u->urb->pipe = subs->syncpipe; - u->urb->transfer_flags = URB_ISO_ASAP | -@@ -2091,8 +2113,13 @@ - if (!buf) - return -ENOMEM; - } -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12) - err = usb_control_msg(dev, pipe, request, requesttype, - value, index, buf, size, timeout); -+#else -+ err = usb_control_msg(dev, pipe, request, requesttype, -+ value, index, buf, size, timeout * HZ / 1000); -+#endif - if (size > 0) { - memcpy(data, buf, size); - kfree(buf); -@@ -2105,6 +2132,7 @@ - * entry point for linux usb interface - */ - -+#ifndef OLD_USB - static int usb_audio_probe(struct usb_interface *intf, - const struct usb_device_id *id); - static void usb_audio_disconnect(struct usb_interface *intf); -@@ -2116,6 +2144,7 @@ - #define usb_audio_suspend NULL - #define usb_audio_resume NULL - #endif -+#endif - - static struct usb_device_id usb_audio_ids [] = { - #include "usbquirks.h" -@@ -2128,11 +2157,19 @@ - MODULE_DEVICE_TABLE (usb, usb_audio_ids); - - static struct usb_driver usb_audio_driver = { -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) /* FIXME: find right number */ -+ .owner = THIS_MODULE, -+#endif - .name = "snd-usb-audio", - .probe = usb_audio_probe, - .disconnect = usb_audio_disconnect, -+#ifndef OLD_USB - .suspend = usb_audio_suspend, - .resume = usb_audio_resume, -+#endif -+#ifdef OLD_USB -+ .driver_list = LIST_HEAD_INIT(usb_audio_driver.driver_list), -+#endif - .id_table = usb_audio_ids, - }; - -@@ -2875,7 +2912,11 @@ - (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING && - altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) || - altsd->bNumEndpoints < 1 || -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0) -+#else -+ get_endpoint(alts, 0)->wMaxPacketSize == 0) -+#endif - continue; - /* must be isochronous */ - if ((get_endpoint(alts, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != -@@ -2965,7 +3006,11 @@ - fp && fp->altsetting == 1 && fp->channels == 1 && - fp->format == SNDRV_PCM_FORMAT_S16_LE && - protocol == UAC_VERSION_1 && -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == -+#else -+ get_endpoint(alts, 0)->wMaxPacketSize == -+#endif - fp->maxpacksize * 2) - continue; - -@@ -2992,7 +3037,11 @@ - fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; - fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; - fp->datainterval = parse_datainterval(chip, alts); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); -+#else -+ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; -+#endif - /* num_channels is only set for v2 interfaces */ - fp->channels = num_channels; - if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) -@@ -3178,8 +3227,11 @@ - case UAC_VERSION_2: { - struct uac_clock_source_descriptor *cs; - struct usb_interface_assoc_descriptor *assoc = -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) - usb_ifnum_to_if(dev, ctrlif)->intf_assoc; -- -+#else -+ NULL; -+#endif - if (!assoc) { - snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); - return -EINVAL; -@@ -3261,7 +3313,11 @@ - } - alts = &iface->altsetting[fp->altset_idx]; - fp->datainterval = parse_datainterval(chip, alts); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); -+#else -+ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; -+#endif - usb_set_interface(chip->dev, fp->iface, 0); - init_usb_pitch(chip->dev, fp->iface, alts, fp); - init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); -@@ -3355,7 +3411,11 @@ - fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; - fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; - fp->datainterval = 0; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); -+#else -+ fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize; -+#endif - - switch (fp->maxpacksize) { - case 0x120: -@@ -3448,8 +3508,13 @@ - struct usb_host_config *config = dev->actconfig; - int err; - -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || - le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { -+#else -+ if (get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_OLD || -+ get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_NEW) { -+#endif - snd_printdd("sending Extigy boot sequence...\n"); - /* Send message to force it to reconnect with full interface. */ - err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), -@@ -3461,8 +3526,13 @@ - if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); - err = usb_reset_configuration(dev); - if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - snd_printdd("extigy_boot: new boot length = %d\n", - le16_to_cpu(get_cfg_desc(config)->wTotalLength)); -+#else -+ snd_printdd("extigy_boot: new boot length = %d\n", -+ get_cfg_desc(config)->wTotalLength); -+#endif - return -ENODEV; /* quit this anyway */ - } - return 0; -@@ -3470,6 +3540,8 @@ - - static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) - { -+/* The pre-2.6.13 EHCI driver blows up when doing high speed iso transfers */ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) - u8 buf = 1; - - snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, -@@ -3481,6 +3553,7 @@ - 1, 2000, NULL, 0, 1000); - return -ENODEV; - } -+#endif - return 0; - } - -@@ -3734,8 +3807,13 @@ - chip->index = idx; - chip->dev = dev; - chip->card = card; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), - le16_to_cpu(dev->descriptor.idProduct)); -+#else -+ chip->usb_id = USB_ID(dev->descriptor.idVendor, -+ dev->descriptor.idProduct); -+#endif - INIT_LIST_HEAD(&chip->pcm_list); - INIT_LIST_HEAD(&chip->midi_list); - INIT_LIST_HEAD(&chip->mixer_list); -@@ -3822,8 +3900,12 @@ - - alts = &intf->altsetting[0]; - ifnum = get_iface_desc(alts)->bInterfaceNumber; -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) - id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), - le16_to_cpu(dev->descriptor.idProduct)); -+#else -+ id = USB_ID(dev->descriptor.idVendor, dev->descriptor.idProduct); -+#endif - if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) - goto __err_val; - -@@ -3968,6 +4050,7 @@ - } - } - -+#ifndef OLD_USB - /* - * new 2.5 USB kernel API - */ -@@ -4028,6 +4111,7 @@ - return 0; - } - #endif /* CONFIG_PM */ -+#endif /* OLD_USB */ - - static int __init snd_usb_audio_init(void) - { -@@ -4046,3 +4130,5 @@ - - module_init(snd_usb_audio_init); - module_exit(snd_usb_audio_cleanup); -+ -+#include "usbaudio.inc1" diff --git a/utils/mod-deps.c b/utils/mod-deps.c index 5f312cfc2..e30a9f1cc 100644 --- a/utils/mod-deps.c +++ b/utils/mod-deps.c @@ -221,6 +221,7 @@ static char *no_cards[] = { #define READ_STATE_CONFIG 1 #define READ_STATE_MENU 2 #define READ_STATE_COMMENT 3 +#define READ_STATE_CHOICE 4 static void nomem(void) { @@ -395,6 +396,13 @@ static int read_file_1(const char *filename, struct cond **template) } else if (!strncmp(buffer, "comment", 7)) { state = READ_STATE_COMMENT; continue; + } else if (!strncmp(buffer, "choice", 6)) { + state = READ_STATE_CHOICE; + /* FXIME: what to do? */ + continue; + } else if (!strncmp(buffer, "endchoice", 9)) { + state = READ_STATE_NONE; + continue; } switch (state) { case READ_STATE_CONFIG: |