diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-03-02 11:43:35 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-03-02 11:43:35 +0100 |
commit | ad56f75ef87b86dff8c3982dcd62e1d96ec997bf (patch) | |
tree | e0fbedb895621df8079e4328bd7fc317eb34385d | |
parent | 0764d90109a3997c94bc13f1d92876d77987ad74 (diff) | |
parent | b11797541e4948c0023b648a81d39aba3c756e10 (diff) | |
download | alsa-driver-build-unstable-ad56f75ef87b86dff8c3982dcd62e1d96ec997bf.tar.gz |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/alsa-driver-build
-rw-r--r-- | configure.in | 44 | ||||
-rw-r--r-- | include/adriver.h | 4 | ||||
-rw-r--r-- | include/usb_audio_compat.h | 409 | ||||
-rw-r--r-- | usb/usbaudio.inc | 13 | ||||
-rw-r--r-- | usb/usbaudio.patch | 87 | ||||
-rw-r--r-- | usb/usbmixer.patch | 12 |
6 files changed, 516 insertions, 53 deletions
diff --git a/configure.in b/configure.in index 81e174dde..edb3fe904 100644 --- a/configure.in +++ b/configure.in @@ -432,15 +432,13 @@ AC_DEFUN([CHECK_KERNEL_HEADER], [ else AC_MSG_RESULT(no) if test ! -f include/$1; then + mkdir -p include/linux include/asm include/media + mkdir -p include/linux/regulator include/linux/usb if test -z "$2" ; then echo "Creating a dummy <$1>..." - mkdir -p include/linux include/asm include/media - mkdir -p include/linux/regulator touch include/$1 else echo "Creating <$1>..." - mkdir -p include/linux include/asm include/media - mkdir -p include/linux/regulator echo "$2" > include/$1 fi fi @@ -675,6 +673,8 @@ AC_SUBST(CONFIG_EXPERIMENTAL) dnl Remove header hacks rm -f include/linux/*.h +rm -rf include/linux/usb +rm -rf include/linux/regulator rm -f include/asm/*.h @@ -2778,6 +2778,42 @@ if test "$CONFIG_USB" != "y"; then fi AC_SUBST(CONFIG_USB) +if test -n "$CONFIG_USB"; then + CHECK_KERNEL_HEADER(linux/usb/audio.h, [#include \"usb_audio_compat.h\" + ]) + AC_MSG_CHECKING([for valid linux/usb/audio.h]) + usb_audio_valid="0" + ac_save_CFLAGS="$CFLAGS" + ac_save_CC="$CC" + CFLAGS="$KERNEL_CHECK_CFLAGS" + CC=$KCC + 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="1", + AC_MSG_RESULT(no);usb_audio_valid="0", + AC_MSG_RESULT(unknown);usb_audio_valid="0" +) + CFLAGS=$ac_save_CFLAGS + CC=$ac_save_CC + if test "$usb_audio_valid" != "1"; then + mkdir -p include/linux/usb + echo "Creating <linux/usb/audio.h>..." + echo "#include \"usb_audio_compat.h\"" > include/linux/usb/audio.h + fi + + CHECK_KERNEL_HEADER(linux/usb/ch9.h) +fi + dnl class_simple for old 2.6 kernels if test "$kversion.$kpatchlevel" = "2.6"; then AC_MSG_CHECKING(for class_simple) diff --git a/include/adriver.h b/include/adriver.h index 02d9c461f..185c1aa31 100644 --- a/include/adriver.h +++ b/include/adriver.h @@ -645,6 +645,10 @@ struct usb_ctrlrequest { } __attribute__ ((packed)); #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) +#define usb_interrupt_msg usb_bulk_msg +#endif + #endif /* SND_NEED_USB_WRAPPER && CONFIG_USB */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 24) \ diff --git a/include/usb_audio_compat.h b/include/usb_audio_compat.h new file mode 100644 index 000000000..6bb293684 --- /dev/null +++ b/include/usb_audio_compat.h @@ -0,0 +1,409 @@ +/* + * <linux/usb/audio.h> -- USB Audio definitions. + * + * Copyright (C) 2006 Thumtronics Pty Ltd. + * Developed for Thumtronics by Grey Innovation + * Ben Williamson <ben.williamson@greyinnovation.com> + * + * 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. + * Comments below reference relevant sections of that document: + * + * http://www.usb.org/developers/devclass_docs/audio10.pdf + */ + +#ifndef __LINUX_USB_AUDIO_H +#define __LINUX_USB_AUDIO_H + +#include <linux/types.h> + +/* 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 +#define UAC_OUTPUT_TERMINAL 0x03 +#define UAC_MIXER_UNIT 0x04 +#define UAC_SELECTOR_UNIT 0x05 +#define UAC_FEATURE_UNIT 0x06 +#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 +#define UAC_FORMAT_SPECIFIC 0x03 + +/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ +#define UAC_EP_GENERAL 0x01 + +/* A.9 Audio Class-Specific Request Codes */ +#define UAC_SET_ 0x00 +#define UAC_GET_ 0x80 + +#define UAC__CUR 0x1 +#define UAC__MIN 0x2 +#define UAC__MAX 0x3 +#define UAC__RES 0x4 +#define UAC__MEM 0x5 + +#define UAC_SET_CUR (UAC_SET_ | UAC__CUR) +#define UAC_GET_CUR (UAC_GET_ | UAC__CUR) +#define UAC_SET_MIN (UAC_SET_ | UAC__MIN) +#define UAC_GET_MIN (UAC_GET_ | UAC__MIN) +#define UAC_SET_MAX (UAC_SET_ | UAC__MAX) +#define UAC_GET_MAX (UAC_GET_ | UAC__MAX) +#define UAC_SET_RES (UAC_SET_ | UAC__RES) +#define UAC_GET_RES (UAC_GET_ | UAC__RES) +#define UAC_SET_MEM (UAC_SET_ | UAC__MEM) +#define UAC_GET_MEM (UAC_GET_ | UAC__MEM) + +#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 +#define UAC_MIDI_OUT_JACK 0x03 + +/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ +#define UAC_MS_GENERAL 0x01 + +/* Terminals - 2.1 USB Terminal Types */ +#define UAC_TERMINAL_UNDEFINED 0x100 +#define UAC_TERMINAL_STREAMING 0x101 +#define UAC_TERMINAL_VENDOR_SPEC 0x1FF + +/* Terminal Control Selectors */ +/* 4.3.2 Class-Specific AC Interface Descriptor */ +struct uac_ac_header_descriptor_v1 { + __u8 bLength; /* 8 + n */ + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ + __le16 bcdADC; /* 0x0100 */ + __le16 wTotalLength; /* includes Unit and Terminal desc. */ + __u8 bInCollection; /* n */ + __u8 baInterfaceNr[]; /* [n] */ +} __attribute__ ((packed)); + +#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ +struct uac_ac_header_descriptor_v1_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __le16 bcdADC; \ + __le16 wTotalLength; \ + __u8 bInCollection; \ + __u8 baInterfaceNr[n]; \ +} __attribute__ ((packed)) + +/* 4.3.2.1 Input Terminal Descriptor */ +struct uac_input_terminal_descriptor { + __u8 bLength; /* in bytes: 12 */ + __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ + __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ + __u8 bTerminalID; /* Constant uniquely terminal ID */ + __le16 wTerminalType; /* USB Audio Terminal Types */ + __u8 bAssocTerminal; /* ID of the Output Terminal associated */ + __u8 bNrChannels; /* Number of logical output channels */ + __le16 wChannelConfig; + __u8 iChannelNames; + __u8 iTerminal; +} __attribute__ ((packed)); + +#define UAC_DT_INPUT_TERMINAL_SIZE 12 + +/* Terminals - 2.2 Input Terminal Types */ +#define UAC_INPUT_TERMINAL_UNDEFINED 0x200 +#define UAC_INPUT_TERMINAL_MICROPHONE 0x201 +#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 +#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 +#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 +#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 +#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 + +/* Terminals - control selectors */ + +#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 + +/* 4.3.2.2 Output Terminal Descriptor */ +struct uac_output_terminal_descriptor_v1 { + __u8 bLength; /* in bytes: 9 */ + __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ + __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ + __u8 bTerminalID; /* Constant uniquely terminal ID */ + __le16 wTerminalType; /* USB Audio Terminal Types */ + __u8 bAssocTerminal; /* ID of the Input Terminal associated */ + __u8 bSourceID; /* ID of the connected Unit or Terminal*/ + __u8 iTerminal; +} __attribute__ ((packed)); + +#define UAC_DT_OUTPUT_TERMINAL_SIZE 9 + +/* Terminals - 2.3 Output Terminal Types */ +#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300 +#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301 +#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302 +#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 +#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 +#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 +#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 +#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 + +/* Set bControlSize = 2 as default setting */ +#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) + +/* As above, but more useful for defining your own descriptors: */ +#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ +struct uac_feature_unit_descriptor_##ch { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __u8 bUnitID; \ + __u8 bSourceID; \ + __u8 bControlSize; \ + __le16 bmaControls[ch + 1]; \ + __u8 iFeature; \ +} __attribute__ ((packed)) + +/* 4.5.2 Class-Specific AS Interface Descriptor */ +struct uac_as_header_descriptor_v1 { + __u8 bLength; /* in bytes: 7 */ + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* AS_GENERAL */ + __u8 bTerminalLink; /* Terminal ID of connected Terminal */ + __u8 bDelay; /* Delay introduced by the data path */ + __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 */ +#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0 +#define UAC_FORMAT_TYPE_I_PCM 0x1 +#define UAC_FORMAT_TYPE_I_PCM8 0x2 +#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3 +#define UAC_FORMAT_TYPE_I_ALAW 0x4 +#define UAC_FORMAT_TYPE_I_MULAW 0x5 + +struct uac_format_type_i_continuous_descriptor { + __u8 bLength; /* in bytes: 8 + (ns * 3) */ + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* FORMAT_TYPE */ + __u8 bFormatType; /* FORMAT_TYPE_1 */ + __u8 bNrChannels; /* physical channels in the stream */ + __u8 bSubframeSize; /* */ + __u8 bBitResolution; + __u8 bSamFreqType; + __u8 tLowerSamFreq[3]; + __u8 tUpperSamFreq[3]; +} __attribute__ ((packed)); + +#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 + +struct uac_format_type_i_discrete_descriptor { + __u8 bLength; /* in bytes: 8 + (ns * 3) */ + __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ + __u8 bDescriptorSubtype; /* FORMAT_TYPE */ + __u8 bFormatType; /* FORMAT_TYPE_1 */ + __u8 bNrChannels; /* physical channels in the stream */ + __u8 bSubframeSize; /* */ + __u8 bBitResolution; + __u8 bSamFreqType; + __u8 tSamFreq[][3]; +} __attribute__ ((packed)); + +#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ +struct uac_format_type_i_discrete_descriptor_##n { \ + __u8 bLength; \ + __u8 bDescriptorType; \ + __u8 bDescriptorSubtype; \ + __u8 bFormatType; \ + __u8 bNrChannels; \ + __u8 bSubframeSize; \ + __u8 bBitResolution; \ + __u8 bSamFreqType; \ + __u8 tSamFreq[n][3]; \ +} __attribute__ ((packed)) + +#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) + +struct uac_format_type_i_ext_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bSubslotSize; + __u8 bFormatType; + __u8 bBitResolution; + __u8 bHeaderLength; + __u8 bControlSize; + __u8 bSideBandProtocol; +} __attribute__((packed)); + + +/* Formats - Audio Data Format Type I Codes */ + +#define UAC_FORMAT_TYPE_II_MPEG 0x1001 +#define UAC_FORMAT_TYPE_II_AC3 0x1002 + +struct uac_format_type_ii_discrete_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bFormatType; + __le16 wMaxBitRate; + __le16 wSamplesPerFrame; + __u8 bSamFreqType; + __u8 tSamFreq[][3]; +} __attribute__((packed)); + +struct uac_format_type_ii_ext_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u8 bFormatType; + __u16 wMaxBitRate; + __u16 wSamplesPerFrame; + __u8 bHeaderLength; + __u8 bSideBandProtocol; +} __attribute__((packed)); + +/* type III */ +#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006 + +/* Formats - A.2 Format Type Codes */ +#define UAC_FORMAT_TYPE_UNDEFINED 0x0 +#define UAC_FORMAT_TYPE_I 0x1 +#define UAC_FORMAT_TYPE_II 0x2 +#define UAC_FORMAT_TYPE_III 0x3 +#define UAC_EXT_FORMAT_TYPE_I 0x81 +#define UAC_EXT_FORMAT_TYPE_II 0x82 +#define UAC_EXT_FORMAT_TYPE_III 0x83 + +struct uac_iso_endpoint_descriptor { + __u8 bLength; /* in bytes: 7 */ + __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ + __u8 bDescriptorSubtype; /* EP_GENERAL */ + __u8 bmAttributes; + __u8 bLockDelayUnits; + __le16 wLockDelay; +}; +#define UAC_ISO_ENDPOINT_DESC_SIZE 7 + +#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 +#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 +#define UAC_BASS_CONTROL 0x03 +#define UAC_MID_CONTROL 0x04 +#define UAC_TREBLE_CONTROL 0x05 +#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06 +#define UAC_AUTOMATIC_GAIN_CONTROL 0x07 +#define UAC_DELAY_CONTROL 0x08 +#define UAC_BASS_BOOST_CONTROL 0x09 +#define UAC_LOUDNESS_CONTROL 0x0a + +#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1)) +#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1)) +#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1)) +#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1)) +#define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1)) +#define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1)) +#define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1)) +#define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1)) +#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) +#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) + +#ifdef __KERNEL__ + +struct usb_audio_control { + struct list_head list; + const char *name; + u8 type; + int data[5]; + int (*set)(struct usb_audio_control *con, u8 cmd, int value); + int (*get)(struct usb_audio_control *con, u8 cmd); +}; + +struct usb_audio_control_selector { + struct list_head list; + struct list_head control; + u8 id; + const char *name; + u8 type; + struct usb_descriptor_header *desc; +}; + +#endif /* __KERNEL__ */ + +#endif /* __LINUX_USB_AUDIO_H */ diff --git a/usb/usbaudio.inc b/usb/usbaudio.inc index 89eb98c2d..68d5c2258 100644 --- a/usb/usbaudio.inc +++ b/usb/usbaudio.inc @@ -19,6 +19,7 @@ #include "adriver.h" #include "usbcompat.h" #include <linux/usb.h> +#include <linux/usb/ch9.h> #ifndef USB_DT_CS_DEVICE #define USB_DT_CS_DEVICE 0x21 @@ -35,4 +36,16 @@ 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) +#define USB_ENDPOINT_SYNC_ASYNC (1 << 2) +#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2) +#define USB_ENDPOINT_SYNC_SYNC (3 << 2) +#endif + +#ifndef USB_SUBCLASS_VENDOR_SPEC +#define USB_SUBCLASS_VENDOR_SPEC 0xff +#endif + // vim: ft=c diff --git a/usb/usbaudio.patch b/usb/usbaudio.patch index 9e655c3df..44fa82cbf 100644 --- a/usb/usbaudio.patch +++ b/usb/usbaudio.patch @@ -1,11 +1,11 @@ ---- ../alsa-kernel/usb/usbaudio.c 2009-12-14 15:40:14.000000000 +0100 -+++ usbaudio.c 2009-12-16 19:25:04.000000000 +0100 +--- ../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 * -@@ -69,7 +70,12 @@ +@@ -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 */ @@ -19,7 +19,7 @@ static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/ static int ignore_ctl_error; -@@ -692,7 +698,11 @@ +@@ -704,7 +710,11 @@ /* * complete callback from data urb */ @@ -31,7 +31,7 @@ { struct snd_urb_ctx *ctx = urb->context; struct snd_usb_substream *subs = ctx->subs; -@@ -715,7 +725,11 @@ +@@ -727,7 +737,11 @@ /* * complete callback from sync urb */ @@ -43,7 +43,7 @@ { struct snd_urb_ctx *ctx = urb->context; struct snd_usb_substream *subs = ctx->subs; -@@ -792,9 +806,12 @@ +@@ -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; @@ -58,7 +58,7 @@ usb_kill_urb(u); } } -@@ -804,9 +821,12 @@ +@@ -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; @@ -73,7 +73,7 @@ usb_kill_urb(u); } } -@@ -1162,7 +1182,9 @@ +@@ -1139,7 +1159,9 @@ if (!u->urb) goto out_of_memory; u->urb->transfer_buffer = subs->syncbuf + i * 4; @@ -83,7 +83,7 @@ u->urb->transfer_buffer_length = 4; u->urb->pipe = subs->syncpipe; u->urb->transfer_flags = URB_ISO_ASAP | -@@ -2063,8 +2085,13 @@ +@@ -2091,8 +2113,13 @@ if (!buf) return -ENOMEM; } @@ -97,7 +97,7 @@ if (size > 0) { memcpy(data, buf, size); kfree(buf); -@@ -2077,6 +2104,7 @@ +@@ -2105,6 +2132,7 @@ * entry point for linux usb interface */ @@ -105,7 +105,7 @@ static int usb_audio_probe(struct usb_interface *intf, const struct usb_device_id *id); static void usb_audio_disconnect(struct usb_interface *intf); -@@ -2088,6 +2116,7 @@ +@@ -2116,6 +2144,7 @@ #define usb_audio_suspend NULL #define usb_audio_resume NULL #endif @@ -113,7 +113,7 @@ static struct usb_device_id usb_audio_ids [] = { #include "usbquirks.h" -@@ -2100,11 +2129,19 @@ +@@ -2128,11 +2157,19 @@ MODULE_DEVICE_TABLE (usb, usb_audio_ids); static struct usb_driver usb_audio_driver = { @@ -133,8 +133,8 @@ .id_table = usb_audio_ids, }; -@@ -2690,7 +2727,11 @@ - (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIO_STREAMING && +@@ -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) @@ -145,10 +145,10 @@ continue; /* must be isochronous */ if ((get_endpoint(alts, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != -@@ -2744,7 +2785,11 @@ - if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && +@@ -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 @@ -157,7 +157,7 @@ fp->maxpacksize * 2) continue; -@@ -2771,7 +2816,11 @@ +@@ -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); @@ -166,10 +166,23 @@ +#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) - fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) - * (fp->maxpacksize & 0x7ff); -@@ -2965,7 +3014,11 @@ +@@ -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); @@ -181,7 +194,7 @@ 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); -@@ -3059,7 +3112,11 @@ +@@ -3355,7 +3411,11 @@ fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; fp->datainterval = 0; @@ -193,19 +206,7 @@ switch (fp->maxpacksize) { case 0x120: -@@ -3127,7 +3184,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 - fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); - - stream = (fp->endpoint & USB_DIR_IN) -@@ -3192,8 +3253,13 @@ +@@ -3448,8 +3508,13 @@ struct usb_host_config *config = dev->actconfig; int err; @@ -219,7 +220,7 @@ 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), -@@ -3205,8 +3271,13 @@ +@@ -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); @@ -233,7 +234,7 @@ return -ENODEV; /* quit this anyway */ } return 0; -@@ -3214,6 +3285,8 @@ +@@ -3470,6 +3540,8 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) { @@ -242,7 +243,7 @@ u8 buf = 1; snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 0x2a, -@@ -3225,6 +3298,7 @@ +@@ -3481,6 +3553,7 @@ 1, 2000, NULL, 0, 1000); return -ENODEV; } @@ -250,7 +251,7 @@ return 0; } -@@ -3452,8 +3526,13 @@ +@@ -3734,8 +3807,13 @@ chip->index = idx; chip->dev = dev; chip->card = card; @@ -264,7 +265,7 @@ INIT_LIST_HEAD(&chip->pcm_list); INIT_LIST_HEAD(&chip->midi_list); INIT_LIST_HEAD(&chip->mixer_list); -@@ -3540,8 +3619,12 @@ +@@ -3822,8 +3900,12 @@ alts = &intf->altsetting[0]; ifnum = get_iface_desc(alts)->bInterfaceNumber; @@ -274,10 +275,10 @@ +#else + id = USB_ID(dev->descriptor.idVendor, dev->descriptor.idProduct); +#endif - if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) goto __err_val; -@@ -3680,6 +3763,7 @@ + +@@ -3968,6 +4050,7 @@ } } @@ -285,7 +286,7 @@ /* * new 2.5 USB kernel API */ -@@ -3740,6 +3824,7 @@ +@@ -4028,6 +4111,7 @@ return 0; } #endif /* CONFIG_PM */ @@ -293,7 +294,7 @@ static int __init snd_usb_audio_init(void) { -@@ -3758,3 +3843,5 @@ +@@ -4046,3 +4130,5 @@ module_init(snd_usb_audio_init); module_exit(snd_usb_audio_cleanup); diff --git a/usb/usbmixer.patch b/usb/usbmixer.patch index ab2c9544b..c25f7e0a8 100644 --- a/usb/usbmixer.patch +++ b/usb/usbmixer.patch @@ -1,12 +1,12 @@ ---- ../alsa-kernel/usb/usbmixer.c 2010-01-18 16:39:16.000000000 +0100 -+++ usbmixer.c 2010-01-20 10:52:15.000000000 +0100 +--- ../alsa-kernel/usb/usbmixer.c 2010-02-23 17:02:35.031036779 +0100 ++++ usbmixer.c 2010-02-23 17:31:28.919536350 +0100 @@ -1,3 +1,5 @@ +#include "usbmixer.inc" + /* * (Tentative) USB Audio Driver for ALSA * -@@ -40,6 +42,14 @@ +@@ -42,6 +44,14 @@ #include "usbaudio.h" @@ -21,7 +21,7 @@ /* */ -@@ -1826,7 +1836,11 @@ static void snd_usb_mixer_memory_change( +@@ -1899,7 +1909,11 @@ } } @@ -33,7 +33,7 @@ { struct usb_mixer_interface *mixer = urb->context; -@@ -1870,7 +1884,11 @@ static int snd_usb_mixer_status_create(s +@@ -1943,7 +1957,11 @@ return 0; epnum = usb_endpoint_num(ep); @@ -45,7 +45,7 @@ transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); if (!transfer_buffer) return -ENOMEM; -@@ -1887,7 +1905,12 @@ static int snd_usb_mixer_status_create(s +@@ -1960,7 +1978,12 @@ return 0; } |