aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-05-31 18:33:08 +0200
committerTakashi Iwai <tiwai@suse.de>2010-05-31 18:33:08 +0200
commitad42dfc20a4bc71221b079598414649a9bcfcad9 (patch)
tree9403638a4cb8997c0567051e5b455d8c5d586ed0
parentcf8c79a8d47d231a2f3b1be510c563d73643eb02 (diff)
downloadalsa-driver-build-unstable-ad42dfc20a4bc71221b079598414649a9bcfcad9.tar.gz
Fix builds with the new USB stack
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--configure.in2
-rw-r--r--include/usb_audio_compat.h96
-rw-r--r--include/usb_audio_v2_compat.h31
-rw-r--r--usb/card.patch35
-rw-r--r--usb/clock.c3
5 files changed, 111 insertions, 56 deletions
diff --git a/configure.in b/configure.in
index 29958191c..d71180118 100644
--- a/configure.in
+++ b/configure.in
@@ -2872,7 +2872,7 @@ if test -n "$CONFIG_USB"; then
#endif
#include <linux/usb/audio-v2.h>
],[
- struct uac2_iso_endpoint_descriptor tmp;
+ struct struct uac_clock_multiplier_descriptor tmp;
tmp.bLength = 0;
],
AC_MSG_RESULT(yes);usb_audio_v2_valid="1",
diff --git a/include/usb_audio_compat.h b/include/usb_audio_compat.h
index c0ef18dc2..c51200c71 100644
--- a/include/usb_audio_compat.h
+++ b/include/usb_audio_compat.h
@@ -47,6 +47,15 @@
#define UAC_FORMAT_TYPE 0x02
#define UAC_FORMAT_SPECIFIC 0x03
+/* A.7 Processing Unit Process Types */
+#define UAC_PROCESS_UNDEFINED 0x00
+#define UAC_PROCESS_UP_DOWNMIX 0x01
+#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
+#define UAC_PROCESS_STEREO_EXTENDER 0x03
+#define UAC_PROCESS_REVERB 0x04
+#define UAC_PROCESS_CHORUS 0x05
+#define UAC_PROCESS_DYN_RANGE_COMP 0x06
+
/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
#define UAC_EP_GENERAL 0x01
@@ -73,6 +82,60 @@
#define UAC_GET_STAT 0xff
+/* A.10 Control Selector Codes */
+
+/* A.10.1 Terminal Control Selectors */
+#define UAC_TERM_COPY_PROTECT 0x01
+
+/* A.10.2 Feature Unit Control Selectors */
+#define UAC_FU_MUTE 0x01
+#define UAC_FU_VOLUME 0x02
+#define UAC_FU_BASS 0x03
+#define UAC_FU_MID 0x04
+#define UAC_FU_TREBLE 0x05
+#define UAC_FU_GRAPHIC_EQUALIZER 0x06
+#define UAC_FU_AUTOMATIC_GAIN 0x07
+#define UAC_FU_DELAY 0x08
+#define UAC_FU_BASS_BOOST 0x09
+#define UAC_FU_LOUDNESS 0x0a
+
+#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
+
+/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
+#define UAC_UD_ENABLE 0x01
+#define UAC_UD_MODE_SELECT 0x02
+
+/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
+#define UAC_DP_ENABLE 0x01
+#define UAC_DP_MODE_SELECT 0x02
+
+/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
+#define UAC_3D_ENABLE 0x01
+#define UAC_3D_SPACE 0x02
+
+/* A.10.3.4 Reverberation Processing Unit Control Selectors */
+#define UAC_REVERB_ENABLE 0x01
+#define UAC_REVERB_LEVEL 0x02
+#define UAC_REVERB_TIME 0x03
+#define UAC_REVERB_FEEDBACK 0x04
+
+/* A.10.3.5 Chorus Processing Unit Control Selectors */
+#define UAC_CHORUS_ENABLE 0x01
+#define UAC_CHORUS_LEVEL 0x02
+#define UAC_CHORUS_RATE 0x03
+#define UAC_CHORUS_DEPTH 0x04
+
+/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
+#define UAC_DCR_ENABLE 0x01
+#define UAC_DCR_RATE 0x02
+#define UAC_DCR_MAXAMPL 0x03
+#define UAC_DCR_THRESHOLD 0x04
+#define UAC_DCR_ATTACK_TIME 0x05
+#define UAC_DCR_RELEASE_TIME 0x06
+
+/* A.10.4 Extension Unit Control Selectors */
+#define UAC_XU_ENABLE 0x01
+
/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
#define UAC_MS_HEADER 0x01
#define UAC_MIDI_IN_JACK 0x02
@@ -101,7 +164,7 @@ struct uac_ac_header_descriptor_v1 {
#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) \
+#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
struct uac_ac_header_descriptor_v1_##n { \
__u8 bLength; \
__u8 bDescriptorType; \
@@ -169,7 +232,7 @@ struct uac_output_terminal_descriptor_v1 {
#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) \
+#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
struct uac_feature_unit_descriptor_##ch { \
__u8 bLength; \
__u8 bDescriptorType; \
@@ -244,7 +307,7 @@ struct uac_selector_unit_descriptor {
static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
{
__u8 *raw = (__u8 *) desc;
- return raw[9 + desc->bLength - 1];
+ return raw[desc->bLength - 1];
}
/* 4.3.2.5 Feature Unit Descriptor */
@@ -378,7 +441,7 @@ struct uac_format_type_i_discrete_descriptor {
__u8 tSamFreq[][3];
} __attribute__ ((packed));
-#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
+#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
struct uac_format_type_i_discrete_descriptor_##n { \
__u8 bLength; \
__u8 bDescriptorType; \
@@ -463,31 +526,6 @@ struct uac_iso_endpoint_descriptor {
#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
#define UAC_EP_CS_ATTR_FILL_MAX 0x80
-/* A.10.2 Feature Unit Control Selectors */
-
-#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))
-
/* status word format (3.7.1.1) */
#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
diff --git a/include/usb_audio_v2_compat.h b/include/usb_audio_v2_compat.h
index 92f1d99f0..383b94ba8 100644
--- a/include/usb_audio_v2_compat.h
+++ b/include/usb_audio_v2_compat.h
@@ -18,6 +18,16 @@
/* v1.0 and v2.0 of this standard have many things in common. For the rest
* of the definitions, please refer to audio.h */
+static inline bool uac2_control_is_readable(u32 bmControls, u8 control)
+{
+ return (bmControls >> (control * 2)) & 0x1;
+}
+
+static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
+{
+ return (bmControls >> (control * 2)) & 0x2;
+}
+
/* 4.7.2.1 Clock Source Descriptor */
struct uac_clock_source_descriptor {
@@ -31,6 +41,13 @@ struct uac_clock_source_descriptor {
__u8 iClockSource;
} __attribute__((packed));
+/* bmAttribute fields */
+#define UAC_CLOCK_SOURCE_TYPE_EXT 0x0
+#define UAC_CLOCK_SOURCE_TYPE_INT_FIXED 0x1
+#define UAC_CLOCK_SOURCE_TYPE_INT_VAR 0x2
+#define UAC_CLOCK_SOURCE_TYPE_INT_PROG 0x3
+#define UAC_CLOCK_SOURCE_SYNCED_TO_SOF (1 << 2)
+
/* 4.7.2.2 Clock Source Descriptor */
struct uac_clock_selector_descriptor {
@@ -39,8 +56,20 @@ struct uac_clock_selector_descriptor {
__u8 bDescriptorSubtype;
__u8 bClockID;
__u8 bNrInPins;
- __u8 bmControls;
__u8 baCSourceID[];
+ /* bmControls, bAssocTerminal and iClockSource omitted */
+} __attribute__((packed));
+
+/* 4.7.2.3 Clock Multiplier Descriptor */
+
+struct uac_clock_multiplier_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+ __u8 bDescriptorSubtype;
+ __u8 bClockID;
+ __u8 bCSourceID;
+ __u8 bmControls;
+ __u8 iClockMultiplier;
} __attribute__((packed));
/* 4.7.2.4 Input terminal descriptor */
diff --git a/usb/card.patch b/usb/card.patch
index 9cfa3a4f9..f611a4697 100644
--- a/usb/card.patch
+++ b/usb/card.patch
@@ -1,5 +1,5 @@
---- ../alsa-kernel/usb/card.c 2010-04-16 10:37:42.000000000 +0200
-+++ card.c 2010-04-16 10:29:29.000000000 +0200
+--- ../alsa-kernel/usb/card.c 2010-05-31 18:18:40.281789895 +0200
++++ card.c 2010-05-31 18:25:11.879373517 +0200
@@ -1,3 +1,4 @@
+#include "card.inc"
/*
@@ -19,9 +19,9 @@
static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
static int ignore_ctl_error;
-@@ -238,13 +244,18 @@
+@@ -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;
@@ -31,22 +31,7 @@
if (!assoc) {
snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n");
- return -EINVAL;
- }
-
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
- /* FIXME: for now, we expect there is at least one clock source
- * descriptor and we always take the first one.
- * We should properly support devices with multiple clock sources,
-@@ -266,6 +277,7 @@
- if (intf != ctrlif)
- snd_usb_create_stream(chip, ctrlif, intf);
- }
-+#endif
-
- break;
- }
-@@ -341,8 +353,13 @@
+@@ -325,8 +335,13 @@
chip->nrpacks = nrpacks;
chip->async_unlink = async_unlink;
@@ -60,7 +45,7 @@
INIT_LIST_HEAD(&chip->pcm_list);
INIT_LIST_HEAD(&chip->midi_list);
INIT_LIST_HEAD(&chip->mixer_list);
-@@ -428,8 +445,12 @@
+@@ -412,8 +427,12 @@
alts = &intf->altsetting[0];
ifnum = get_iface_desc(alts)->bInterfaceNumber;
@@ -73,7 +58,7 @@
if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
goto __err_val;
-@@ -547,6 +568,7 @@
+@@ -533,6 +552,7 @@
}
}
@@ -81,7 +66,7 @@
/*
* new 2.5 USB kernel API
*/
-@@ -610,6 +632,7 @@
+@@ -596,6 +616,7 @@
#define usb_audio_suspend NULL
#define usb_audio_resume NULL
#endif /* CONFIG_PM */
@@ -89,7 +74,7 @@
static struct usb_device_id usb_audio_ids [] = {
#include "quirks-table.h"
-@@ -626,11 +649,19 @@
+@@ -612,11 +633,19 @@
*/
static struct usb_driver usb_audio_driver = {
@@ -109,7 +94,7 @@
.id_table = usb_audio_ids,
};
-@@ -650,3 +681,5 @@
+@@ -636,3 +665,5 @@
module_init(snd_usb_audio_init);
module_exit(snd_usb_audio_cleanup);
diff --git a/usb/clock.c b/usb/clock.c
new file mode 100644
index 000000000..47854f2ff
--- /dev/null
+++ b/usb/clock.c
@@ -0,0 +1,3 @@
+#define __NO_VERSION__
+#include "usbaudio.inc"
+#include "../alsa-kernel/usb/clock.c"