Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199782
b: refs/heads/master
c: dd37f8e
h: refs/heads/master
v: v3
  • Loading branch information
Daniel T Chen authored and Takashi Iwai committed May 31, 2010
1 parent 076e1ce commit 31e8a4f
Show file tree
Hide file tree
Showing 18 changed files with 255 additions and 616 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21896bc010c17e5ac58951e771496ec2fb1051ed
refs/heads/master: dd37f8e8659bc617c3f2a84e007a4824ccdac458
4 changes: 2 additions & 2 deletions trunk/drivers/usb/gadget/f_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static struct uac_feature_unit_descriptor_0 feature_unit_desc = {
static struct usb_audio_control mute_control = {
.list = LIST_HEAD_INIT(mute_control.list),
.name = "Mute Control",
.type = UAC_FU_MUTE,
.type = UAC_MUTE_CONTROL,
/* Todo: add real Mute control code */
.set = generic_set_cmd,
.get = generic_get_cmd,
Expand All @@ -110,7 +110,7 @@ static struct usb_audio_control mute_control = {
static struct usb_audio_control volume_control = {
.list = LIST_HEAD_INIT(volume_control.list),
.name = "Volume Control",
.type = UAC_FU_VOLUME,
.type = UAC_VOLUME_CONTROL,
/* Todo: add real Volume control code */
.set = generic_set_cmd,
.get = generic_get_cmd,
Expand Down
31 changes: 1 addition & 30 deletions trunk/include/linux/usb/audio-v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
/* 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 {
Expand All @@ -41,13 +31,6 @@ 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 {
Expand All @@ -56,20 +39,8 @@ struct uac_clock_selector_descriptor {
__u8 bDescriptorSubtype;
__u8 bClockID;
__u8 bNrInPins;
__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;
__u8 baCSourceID[];
} __attribute__((packed));

/* 4.7.2.4 Input terminal descriptor */
Expand Down
90 changes: 26 additions & 64 deletions trunk/include/linux/usb/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@
#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

Expand All @@ -82,60 +73,6 @@

#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
Expand Down Expand Up @@ -307,7 +244,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[desc->bLength - 1];
return raw[9 + desc->bLength - 1];
}

/* 4.3.2.5 Feature Unit Descriptor */
Expand Down Expand Up @@ -526,6 +463,31 @@ 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
Expand Down
3 changes: 0 additions & 3 deletions trunk/sound/pci/asihpi/asihpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2578,9 +2578,6 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
if (err)
return -err;

memset(&prev_ctl, 0, sizeof(prev_ctl));
prev_ctl.control_type = -1;

for (idx = 0; idx < 2000; idx++) {
err = hpi_mixer_get_control_by_index(
ss, asihpi->h_mixer,
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB),
Expand Down
3 changes: 1 addition & 2 deletions trunk/sound/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ snd-usb-audio-objs := card.o \
endpoint.o \
urb.o \
pcm.o \
helper.o \
clock.o
helper.o

snd-usbmidi-lib-objs := midi.o

Expand Down
18 changes: 16 additions & 2 deletions trunk/sound/usb/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
}

case UAC_VERSION_2: {
struct uac_clock_source_descriptor *cs;
struct usb_interface_assoc_descriptor *assoc =
usb_ifnum_to_if(dev, ctrlif)->intf_assoc;

Expand All @@ -244,6 +245,21 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
return -EINVAL;
}

/* 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,
* clock selectors and sample rate conversion units. */

cs = snd_usb_find_csint_desc(host_iface->extra, host_iface->extralen,
NULL, UAC2_CLOCK_SOURCE);

if (!cs) {
snd_printk(KERN_ERR "CLOCK_SOURCE descriptor not found\n");
return -EINVAL;
}

chip->clock_id = cs->bClockID;

for (i = 0; i < assoc->bInterfaceCount; i++) {
int intf = assoc->bFirstInterface + i;

Expand Down Expand Up @@ -465,8 +481,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
goto __error;
}

chip->ctrl_intf = alts;

if (err > 0) {
/* create normal USB audio interfaces */
if (snd_usb_create_streams(chip, ifnum) < 0 ||
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/usb/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ struct audioformat {
unsigned int rate_min, rate_max; /* min/max rates */
unsigned int nr_rates; /* number of rate table entries */
unsigned int *rate_table; /* rate table */
unsigned char clock; /* associated clock */
};

struct snd_usb_substream;
Expand Down
Loading

0 comments on commit 31e8a4f

Please sign in to comment.