Skip to contentSkip to conversation

M-Audio C400 corrections

PATCH Applied Eldad Zack 2 participants 5 messages Jan 13, 2013 – Jan 14, 2013 Sound

lore
Share & tools
lore

Eldad Zack

author
#0 lore raw

cover M-Audio C400 corrections

Hi Takashi,

The following are specific fixes for the M-Audio FT C400.

* Use the clock selector instead of the internal clock and add names for the clocks instead of Unit 129 and Unit 130.

* Fix an issue where the latency would change every time the stream is started. Uses skip_packets.

I think they could go in current mainline, since it is only for this device, but I also checked that they apply cleanly against for-next.

Cheers,
Eldad

Eldad Zack (3):
ALSA: usb-audio: correct M-Audio C400 clock source quirk
ALSA: usb-audio: M-Audio FT C400 skip packet quirk
ALSA: usb-audio: selector map for M-Audio FT C400

 sound/usb/mixer_maps.c   | 13 +++++++++++++
 sound/usb/quirks-table.h |  4 ++--
 sound/usb/quirks.c       | 11 +++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.12.4
author
#1 lore raw

PATCH 1/3 ALSA: usb-audio: correct M-Audio C400 clock source quirk

Taking another look at the C400 descriptors, I see now that there is a clock selector (0x80) for this device.
Right now, the clock source points to the internal clock (0x81), which is also valid. When the external clock source (0x82) is selected in the mixer, and the rates mismatch (if it's free-running it is fixed to 48KHz), xruns will occur.

Set the clock ID to the clock selector unit (0x81), which then allows the validation code to function correctly.

---
 sound/usb/quirks-table.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/quirks-table.h +2 -2
index 78e845e..64d25a7 100644
@@ -2289,7 +2289,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 					.rate_table = (unsigned int[]) {
 							44100, 48000, 88200, 96000
 					},
-					.clock = 0x81,
+					.clock = 0x80,
 				}
 			},
 			/* Capture */
@@ -2315,7 +2315,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
 					.rate_table = (unsigned int[]) {
 						44100, 48000, 88200, 96000
 					},
-					.clock = 0x81,
+					.clock = 0x80,
 				}
 			},
 			/* MIDI */
Signature · 1 line
1.7.12.4
author
#2 lore raw

PATCH 2/3 ALSA: usb-audio: M-Audio FT C400 skip packet quirk

In reply to Eldad Zack

Attain constant real-world latency by skipping 16 data packets. The number of packets to be skipped was found by trial and error.

---
 sound/usb/quirks.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
sound/usb/quirks.c +11 -0
index acc12f0..ace0210 100644
@@ -859,6 +859,17 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
 	if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
 	    ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
 		ep->skip_packets = 4;
+
+	/*
+	 * M-Audio Fast Track C400 - when packets are not skipped, real world
+	 * latency varies by approx. +/- 50 frames (at 96KHz) each time the
+	 * stream is (re)started. When skipping packets 16 at endpoint start
+	 * up, the real world latency is stable within +/- 1 frame (also
+	 * across power cycles).
+	 */
+	if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) &&
+	    ep->type == SND_USB_ENDPOINT_TYPE_DATA)
+		ep->skip_packets = 16;
 }
 
 void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
Signature · 1 line
1.7.12.4
author
#3 lore raw

PATCH 3/3 ALSA: usb-audio: selector map for M-Audio FT C400

In reply to Eldad Zack

Add names of the clock sources for the M-Audio Fast Track C400.

---
 sound/usb/mixer_maps.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
sound/usb/mixer_maps.c +13 -0
index e71fe55..0e2ed3d 100644
@@ -179,6 +179,15 @@ static struct usbmix_name_map audigy2nx_map[] = {
 	{ 0 } /* terminator */
 };
 
+static struct usbmix_selector_map c400_selectors[] = {
+	{
+		.id = 0x80,
+		.count = 2,
+		.names = (const char*[]) {"Internal", "SPDIF"}
+	},
+	{ 0 } /* terminator */
+};
+
 static struct usbmix_selector_map audigy2nx_selectors[] = {
 	{
 		.id = 14, /* Capture Source */
@@ -367,6 +376,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
 		.map = hercules_usb51_map,
 	},
 	{
+		.id = USB_ID(0x0763, 0x2030),
+		.selector_map = c400_selectors,
+	},
+	{
 		.id = USB_ID(0x08bb, 0x2702),
 		.map = linex_map,
 		.ignore_ctl_error = 1,
Signature · 1 line
1.7.12.4
Applied
#4 lore raw
In reply to Eldad Zack

At Sun, 13 Jan 2013 23:02:01 +0100,

Quoted 9 lines · Eldad Zack

Hi Takashi,

The following are specific fixes for the M-Audio FT C400.

* Use the clock selector instead of the internal clock and add names for the clocks instead of Unit 129 and Unit 130.

Quoted 6 lines

* Fix an issue where the latency would change every time the stream is started. Uses skip_packets.

I think they could go in current mainline, since it is only for this device, but I also checked that they apply cleanly against for-next.

Thanks, applied all three patches now.

Takashi

Quoted 18 lines

Cheers,
Eldad

Eldad Zack (3):
ALSA: usb-audio: correct M-Audio C400 clock source quirk
ALSA: usb-audio: M-Audio FT C400 skip packet quirk
ALSA: usb-audio: selector map for M-Audio FT C400

 sound/usb/mixer_maps.c   | 13 +++++++++++++
 sound/usb/quirks-table.h |  4 ++--
 sound/usb/quirks.c       | 11 +++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.12.4