Skip to contentSkip to conversation

Assorted usb-audio patches

PATCH New Daniel Mack 2 participants 10 messages May 18, 2011 Sound

lore
Share & tools
lore
#0 lore raw

Hi,

here are some patches I collected for the usb-audio driver. Most of them have been discussed on this list already, and all are rather small and shouldn't cause any problems.

FWIW, they can also be pulled from

git://github.com/zonque/linux-2.6.git usb-audio

Daniel

Daniel Mack (8):
MAINTAINERS: Add entry for Native Instruments sound driver
ALSA: usb-audio: make hwc_debug a noop in case HW_CONST_DEBUG is not set
ALSA: usb-audio: include format.h in format.c
ALSA: usb-audio: remove invalid extra mixers for Komplete Audio 6
ALSA: usb-audio: Add quirk for KORG PANDORA PX5D MIDI interface
ALSA: usb-audio: add quirks for Roland GR-55
ALSA: usb-audio: assume valid clock
ALSA: usb-audio: handle "Fast Track Ultra" with USB_DEVICE_VENDOR_SPEC()

 MAINTAINERS              |    7 +++++++
 sound/usb/clock.c        |   11 ++++++++++-
 sound/usb/debug.h        |    2 +-
 sound/usb/format.c       |    1 +
 sound/usb/mixer_quirks.c |   17 -----------------
 sound/usb/quirks-table.h |   43 ++++++++++++++++++++++++++++++++++++++++---
 sound/usb/quirks.c       |    2 +-
 7 files changed, 60 insertions(+), 23 deletions(-)
#1 lore raw

PATCH 1/8 MAINTAINERS: Add entry for Native Instruments sound driver

---
 MAINTAINERS |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
MAINTAINERS +7 -0
index 69f19f1..07d064d 100644
@@ -4271,6 +4271,13 @@ M:	Tim Hockin <[email protected]>
 S:	Maintained
 F:	drivers/net/natsemi.c
 
+NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER
+M:	Daniel Mack <[email protected]>
+S:	Maintained
+L:	[email protected]
+W:	http://www.native-instruments.com
+F:	sound/usb/caiaq/
+
 NCP FILESYSTEM
 M:	Petr Vandrovec <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.5.1
#2 lore raw

PATCH 2/8 ALSA: usb-audio: make hwc_debug a noop in case HW_CONST_DEBUG is not set

In reply to Daniel Mack

Just defining it to nothing is dangerous as it can alter the code execution flow, for example when used in as only function in a conditional code block.

---
 sound/usb/debug.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/usb/debug.h +1 -1
index 343ec2d..5803017 100644
@@ -8,7 +8,7 @@
 #ifdef HW_CONST_DEBUG
 #define hwc_debug(fmt, args...) printk(KERN_DEBUG fmt, ##args)
 #else
-#define hwc_debug(fmt, args...) /**/
+#define hwc_debug(fmt, args...) do { } while(0)
 #endif
 
 #endif /* __USBAUDIO_DEBUG_H */
Signature · 1 line
1.7.5.1
#3 lore raw

PATCH 3/8 ALSA: usb-audio: include format.h in format.c

In reply to Daniel Mack

Just in case a prototype changes, we'll be warned. This also fixes a sparse warning.

---
 sound/usb/format.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/usb/format.c +1 -0
index f079b5e..8d042dc 100644
@@ -30,6 +30,7 @@
 #include "helper.h"
 #include "debug.h"
 #include "clock.h"
+#include "format.h"
 
 /*
  * parse the audio format type I descriptor
Signature · 1 line
1.7.5.1
#4 lore raw

PATCH 4/8 ALSA: usb-audio: remove invalid extra mixers for Komplete Audio 6

In reply to Daniel Mack

This was a flaw in the reading of the spec tables - Native Instrument's "Komplete Audio 6" device has no such extra controls.

This patch also fixes the device name in two comments.

---
 sound/usb/mixer_quirks.c |   17 -----------------
 sound/usb/quirks-table.h |    2 +-
 sound/usb/quirks.c       |    2 +-
 3 files changed, 2 insertions(+), 19 deletions(-)
sound/usb/mixer_quirks.c +0 -17
index 4a7ad7e..73dcc82 100644
@@ -398,17 +398,6 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-static struct snd_kcontrol_new snd_nativeinstruments_ak6_mixers[] = {
-	{
-		.name = "Direct Monitor Channel 1+2",
-		.private_value = _MAKE_NI_CONTROL(0x03, 0x03),
-	},
-	{
-		.name = "Direct Monitor Channel 3+4",
-		.private_value = _MAKE_NI_CONTROL(0x03, 0x05),
-	},
-};
-
 static struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers[] = {
 	{
 		.name = "Direct Thru Channel A",
@@ -537,12 +526,6 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 		err = snd_xonar_u1_controls_create(mixer);
 		break;
 
-	case USB_ID(0x17cc, 0x1001): /* Audio Kontrol 6 */
-		err = snd_nativeinstruments_create_mixer(mixer,
-				snd_nativeinstruments_ak6_mixers,
-				ARRAY_SIZE(snd_nativeinstruments_ak6_mixers));
-		break;
-
 	case USB_ID(0x17cc, 0x1011): /* Traktor Audio 6 */
 		err = snd_nativeinstruments_create_mixer(mixer,
 				snd_nativeinstruments_ta6_mixers,
sound/usb/quirks-table.h +1 -1
index 54e18c1..5c1a176 100644
@@ -2332,7 +2332,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 
 /* Native Instruments MK2 series */
 {
-	/* Audio Kontrol 6 */
+	/* Komplete Audio 6 */
 	.match_flags = USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor = 0x17cc,
 	.idProduct = 0x1000,
sound/usb/quirks.c +1 -1
index de50eea..bd13d72 100644
@@ -540,7 +540,7 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,
 		/* Access Music VirusTI Desktop */
 		return snd_usb_accessmusic_boot_quirk(dev);
 
-	case USB_ID(0x17cc, 0x1000): /* Audio Kontrol 6 */
+	case USB_ID(0x17cc, 0x1000): /* Komplete Audio 6 */
 	case USB_ID(0x17cc, 0x1010): /* Traktor Audio 6 */
 	case USB_ID(0x17cc, 0x1020): /* Traktor Audio 10 */
 		return snd_usb_nativeinstruments_boot_quirk(dev);
Signature · 1 line
1.7.5.1
#5 lore raw

PATCH 5/8 ALSA: usb-audio: Add quirk for KORG PANDORA PX5D MIDI interface

In reply to Daniel Mack
---
 sound/usb/quirks-table.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
sound/usb/quirks-table.h +11 -0
index 5c1a176..78c3e8d 100644
@@ -2179,6 +2179,17 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 	}
 },
 
+/* KORG devices */
+{
+	USB_DEVICE_VENDOR_SPEC(0x0944, 0x0200),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		.vendor_name = "KORG, Inc.",
+		/* .product_name = "PANDORA PX5D", */
+		.ifnum = 3,
+		.type = QUIRK_MIDI_STANDARD_INTERFACE,
+	}
+},
+
 /* AKAI devices */
 {
 	USB_DEVICE(0x09e8, 0x0062),
Signature · 6 lines
1.7.5.1

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#6 lore raw

PATCH 6/8 ALSA: usb-audio: add quirks for Roland GR-55

In reply to Daniel Mack
---
 sound/usb/quirks-table.h |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
sound/usb/quirks-table.h +26 -0
index 78c3e8d..690767c 100644
@@ -1651,6 +1651,32 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 		}
 	}
 },
+{
+	USB_DEVICE(0x0582, 0x0127),
+	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
+		/* .vendor_name = "Roland", */
+		/* .product_name = "GR-55", */
+		.ifnum = QUIRK_ANY_INTERFACE,
+		.type = QUIRK_COMPOSITE,
+		.data = (const struct snd_usb_audio_quirk[]) {
+			{
+				.ifnum = 0,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 1,
+				.type = QUIRK_AUDIO_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = 2,
+				.type = QUIRK_MIDI_STANDARD_INTERFACE
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
 
 /* Guillemot devices */
 {
Signature · 1 line
1.7.5.1
#7 lore raw

PATCH 7/8 ALSA: usb-audio: assume valid clock

In reply to Daniel Mack

If the interface can't report a clock's validity, assume that it's valid.

---
 sound/usb/clock.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
sound/usb/clock.c +10 -1
index 7754a10..075195e 100644
@@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
 	int err;
 	unsigned char data;
 	struct usb_device *dev = chip->dev;
+	struct uac_clock_source_descriptor *cs_desc =
+		snd_usb_find_clock_source(chip->ctrl_intf, source_id);
+
+	if (!cs_desc)
+		return 0;
+
+	/* If a clock source can't tell us whether it's valid, we assume it is */
+	if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
+		return 1;
 
 	err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
 			      USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
@@ -114,7 +123,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
 	if (err < 0) {
 		snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n",
 			   __func__, source_id);
-		return err;
+		return 0;
 	}
 
 	return !!data;
Signature · 1 line
1.7.5.1
#8 lore raw

PATCH 8/8 ALSA: usb-audio: handle "Fast Track Ultra" with USB_DEVICE_VENDOR_SPEC()

In reply to Daniel Mack

That way, the class compliant MIDI interface is also handled.

---
 sound/usb/quirks-table.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/quirks-table.h +2 -2
index 690767c..78792a8 100644
@@ -1979,7 +1979,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 	}
 },
 {
-	USB_DEVICE(0x0763, 0x2080),
+	USB_DEVICE_VENDOR_SPEC(0x0763, 0x2080),
 	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
 		/* .vendor_name = "M-Audio", */
 		/* .product_name = "Fast Track Ultra", */
@@ -2046,7 +2046,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 	}
 },
 {
-	USB_DEVICE(0x0763, 0x2081),
+	USB_DEVICE_VENDOR_SPEC(0x0763, 0x2081),
 	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
 		/* .vendor_name = "M-Audio", */
 		/* .product_name = "Fast Track Ultra 8R", */
Signature · 1 line
1.7.5.1
#9 lore raw
In reply to Daniel Mack

At Wed, 18 May 2011 11:28:37 +0200,

Quoted 6 lines · Daniel Mack

Hi,

here are some patches I collected for the usb-audio driver. Most of them have been discussed on this list already, and all are rather small and shouldn't cause any problems.

Thanks! I applied all patches now.

Takashi

Quoted 28 lines

FWIW, they can also be pulled from

git://github.com/zonque/linux-2.6.git usb-audio

Daniel

Daniel Mack (8):
MAINTAINERS: Add entry for Native Instruments sound driver
ALSA: usb-audio: make hwc_debug a noop in case HW_CONST_DEBUG is not set
ALSA: usb-audio: include format.h in format.c
ALSA: usb-audio: remove invalid extra mixers for Komplete Audio 6
ALSA: usb-audio: Add quirk for KORG PANDORA PX5D MIDI interface
ALSA: usb-audio: add quirks for Roland GR-55
ALSA: usb-audio: assume valid clock
ALSA: usb-audio: handle "Fast Track Ultra" with USB_DEVICE_VENDOR_SPEC()

 MAINTAINERS              |    7 +++++++
 sound/usb/clock.c        |   11 ++++++++++-
 sound/usb/debug.h        |    2 +-
 sound/usb/format.c       |    1 +
 sound/usb/mixer_quirks.c |   17 -----------------
 sound/usb/quirks-table.h |   43 ++++++++++++++++++++++++++++++++++++++++---
 sound/usb/quirks.c       |    2 +-
 7 files changed, 60 insertions(+), 23 deletions(-)