[alsa-devel] [PATCH 0/3] 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(-)
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.
Signed-off-by: Eldad Zack eldad@fogrefinery.com --- sound/usb/quirks-table.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 78e845e..64d25a7 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -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 */
Attain constant real-world latency by skipping 16 data packets. The number of packets to be skipped was found by trial and error.
Signed-off-by: Eldad Zack eldad@fogrefinery.com --- sound/usb/quirks.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index acc12f0..ace0210 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -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,
Add names of the clock sources for the M-Audio Fast Track C400.
Signed-off-by: Eldad Zack eldad@fogrefinery.com --- sound/usb/mixer_maps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index e71fe55..0e2ed3d 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c @@ -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,
At Sun, 13 Jan 2013 23:02:01 +0100, Eldad Zack wrote:
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.
Thanks, applied all three patches now.
Takashi
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(-)
-- 1.7.12.4
participants (2)
-
Eldad Zack
-
Takashi Iwai