diff options
Diffstat (limited to 'sound/usb/quirks.c')
-rw-r--r-- | sound/usb/quirks.c | 110 |
1 files changed, 106 insertions, 4 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 007fcecdf5cd..2c971858d6b7 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) | |||
387 | * rules | 387 | * rules |
388 | */ | 388 | */ |
389 | err = usb_driver_set_configuration(dev, 2); | 389 | err = usb_driver_set_configuration(dev, 2); |
390 | if (err < 0) { | 390 | if (err < 0) |
391 | snd_printdd("error usb_driver_set_configuration: %d\n", | 391 | snd_printdd("error usb_driver_set_configuration: %d\n", |
392 | err); | 392 | err); |
393 | return -ENODEV; | 393 | /* Always return an error, so that we stop creating a device |
394 | } | 394 | that will just be destroyed and recreated with a new |
395 | configuration */ | ||
396 | return -ENODEV; | ||
395 | } else | 397 | } else |
396 | snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); | 398 | snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); |
397 | 399 | ||
@@ -497,6 +499,92 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev) | |||
497 | return -EAGAIN; | 499 | return -EAGAIN; |
498 | } | 500 | } |
499 | 501 | ||
502 | static void mbox2_setup_48_24_magic(struct usb_device *dev) | ||
503 | { | ||
504 | u8 srate[3]; | ||
505 | u8 temp[12]; | ||
506 | |||
507 | /* Choose 48000Hz permanently */ | ||
508 | srate[0] = 0x80; | ||
509 | srate[1] = 0xbb; | ||
510 | srate[2] = 0x00; | ||
511 | |||
512 | /* Send the magic! */ | ||
513 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
514 | 0x01, 0x22, 0x0100, 0x0085, &temp, 0x0003); | ||
515 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
516 | 0x81, 0xa2, 0x0100, 0x0085, &srate, 0x0003); | ||
517 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
518 | 0x81, 0xa2, 0x0100, 0x0086, &srate, 0x0003); | ||
519 | snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), | ||
520 | 0x81, 0xa2, 0x0100, 0x0003, &srate, 0x0003); | ||
521 | return; | ||
522 | } | ||
523 | |||
524 | /* Digidesign Mbox 2 needs to load firmware onboard | ||
525 | * and driver must wait a few seconds for initialisation. | ||
526 | */ | ||
527 | |||
528 | #define MBOX2_FIRMWARE_SIZE 646 | ||
529 | #define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ | ||
530 | #define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ | ||
531 | |||
532 | static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) | ||
533 | { | ||
534 | struct usb_host_config *config = dev->actconfig; | ||
535 | int err; | ||
536 | u8 bootresponse[12]; | ||
537 | int fwsize; | ||
538 | int count; | ||
539 | |||
540 | fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); | ||
541 | |||
542 | if (fwsize != MBOX2_FIRMWARE_SIZE) { | ||
543 | snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); | ||
544 | return -ENODEV; | ||
545 | } | ||
546 | |||
547 | snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); | ||
548 | |||
549 | count = 0; | ||
550 | bootresponse[0] = MBOX2_BOOT_LOADING; | ||
551 | while ((bootresponse[0] == MBOX2_BOOT_LOADING) && (count < 10)) { | ||
552 | msleep(500); /* 0.5 second delay */ | ||
553 | snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
554 | /* Control magic - load onboard firmware */ | ||
555 | 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); | ||
556 | if (bootresponse[0] == MBOX2_BOOT_READY) | ||
557 | break; | ||
558 | snd_printd("usb-audio: device not ready, resending boot sequence...\n"); | ||
559 | count++; | ||
560 | } | ||
561 | |||
562 | if (bootresponse[0] != MBOX2_BOOT_READY) { | ||
563 | snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); | ||
564 | return -ENODEV; | ||
565 | } | ||
566 | |||
567 | snd_printdd("usb-audio: device initialised!\n"); | ||
568 | |||
569 | err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, | ||
570 | &dev->descriptor, sizeof(dev->descriptor)); | ||
571 | config = dev->actconfig; | ||
572 | if (err < 0) | ||
573 | snd_printd("error usb_get_descriptor: %d\n", err); | ||
574 | |||
575 | err = usb_reset_configuration(dev); | ||
576 | if (err < 0) | ||
577 | snd_printd("error usb_reset_configuration: %d\n", err); | ||
578 | snd_printdd("mbox2_boot: new boot length = %d\n", | ||
579 | le16_to_cpu(get_cfg_desc(config)->wTotalLength)); | ||
580 | |||
581 | mbox2_setup_48_24_magic(dev); | ||
582 | |||
583 | snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); | ||
584 | |||
585 | return 0; /* Successful boot */ | ||
586 | } | ||
587 | |||
500 | /* | 588 | /* |
501 | * Setup quirks | 589 | * Setup quirks |
502 | */ | 590 | */ |
@@ -573,7 +661,6 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | |||
573 | return 0; /* keep this altsetting */ | 661 | return 0; /* keep this altsetting */ |
574 | } | 662 | } |
575 | 663 | ||
576 | |||
577 | static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, | 664 | static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, |
578 | int iface, int altno) | 665 | int iface, int altno) |
579 | { | 666 | { |
@@ -655,6 +742,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev, | |||
655 | case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ | 742 | case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ |
656 | return snd_usb_cm6206_boot_quirk(dev); | 743 | return snd_usb_cm6206_boot_quirk(dev); |
657 | 744 | ||
745 | case USB_ID(0x0dba, 0x3000): | ||
746 | /* Digidesign Mbox 2 */ | ||
747 | return snd_usb_mbox2_boot_quirk(dev); | ||
748 | |||
658 | case USB_ID(0x133e, 0x0815): | 749 | case USB_ID(0x133e, 0x0815): |
659 | /* Access Music VirusTI Desktop */ | 750 | /* Access Music VirusTI Desktop */ |
660 | return snd_usb_accessmusic_boot_quirk(dev); | 751 | return snd_usb_accessmusic_boot_quirk(dev); |
@@ -770,6 +861,17 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) | |||
770 | if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && | 861 | if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && |
771 | ep->type == SND_USB_ENDPOINT_TYPE_SYNC) | 862 | ep->type == SND_USB_ENDPOINT_TYPE_SYNC) |
772 | ep->skip_packets = 4; | 863 | ep->skip_packets = 4; |
864 | |||
865 | /* | ||
866 | * M-Audio Fast Track C400 - when packets are not skipped, real world | ||
867 | * latency varies by approx. +/- 50 frames (at 96KHz) each time the | ||
868 | * stream is (re)started. When skipping packets 16 at endpoint start | ||
869 | * up, the real world latency is stable within +/- 1 frame (also | ||
870 | * across power cycles). | ||
871 | */ | ||
872 | if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) && | ||
873 | ep->type == SND_USB_ENDPOINT_TYPE_DATA) | ||
874 | ep->skip_packets = 16; | ||
773 | } | 875 | } |
774 | 876 | ||
775 | void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | 877 | void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, |