diff -urN alsa-driver-1.0.12rc3/alsa-kernel/usb/usbaudio.c alsa-driver-1.0.12rc3_patch/alsa-kernel/usb/usbaudio.c --- alsa-driver-1.0.12rc3/alsa-kernel/usb/usbaudio.c 2006-08-14 12:55:28.000000000 +0200 +++ alsa-driver-1.0.12rc3_patch/alsa-kernel/usb/usbaudio.c 2006-08-20 12:46:30.000000000 +0200 @@ -2306,7 +2306,15 @@ break; case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */ return 1; - } + + case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro */ + /* it depends on altsetting wether the device is big-endian or not */ + if(fp->altsetting==2 || fp->altsetting==3 || + fp->altsetting==5 || fp->altsetting==6) + return 1; + break; + + } return 0; } @@ -2551,6 +2559,8 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, int iface, int altno); +static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, + int iface, int altno); static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) { struct usb_device *dev; @@ -2592,6 +2602,11 @@ audiophile_skip_setting_quirk(chip, iface_no, altno)) continue; + /* M-Audio Fast Track Pro: skip alsets incompatible with device_setup */ + if (chip->usb_id == USB_ID(0x0763, 0x2012) && + fasttrackpro_skip_setting_quirk(chip, iface_no, altno)) + continue; + /* get audio formats */ fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, AS_GENERAL); if (!fmt) { @@ -3118,6 +3133,28 @@ return snd_usb_cm106_write_int_reg(dev, 2, 0x8004); } +static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev, int ifnum) +{ + int err; + + if(dev->actconfig->desc.bConfigurationValue==1) { + if(ifnum==0) { + snd_printk(KERN_INFO "Switching to config #2\n"); + /* This function has to be available by the usb core module. + if it is not avialable the boot quirk has to be left out and the + configuration has to be set by udev or hotplug rules */ + err=usb_driver_set_configuration(dev,2); + if(err < 0) { + snd_printdd("error usb_driver_set_configuration: %d\n", err); + return -ENODEV; + } + } + } else { + snd_printk(KERN_INFO "Fast Track Pro config OK\n"); + } + + return 0; +} /* * Setup quirks @@ -3159,6 +3196,39 @@ return 0; /* keep this altsetting */ } +static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, + int iface, int altno) +{ + + /* possible configuration where both inputs and only one output is + used is not supported by the current setup */ + + if (device_setup[chip->index] & (AUDIOPHILE_SET | AUDIOPHILE_SET_24B)) { + if(device_setup[chip->index] & AUDIOPHILE_SET_96K){ + if((altno != 3) && (altno != 6)) + return 1; + }else if(device_setup[chip->index] & AUDIOPHILE_SET_DI){ + if(iface == 4) + return 1; /* no analog input */ + + if((altno != 2) && (altno != 5)) + return 1; /* enable only altsets 2 and 5 */ + }else{ + if(iface == 5) + return 1; /* disable digialt input */ + + if((altno != 2) && (altno != 5)) + return 1; /* enalbe only altsets 2 and 5 */ + } + }else{ + /* keep only 16-Bit mode */ + if(altno !=1) + return 1; + } + + return 0; /* keep this altsetting */ +} + /* * audio-interface quirks * @@ -3394,6 +3464,12 @@ if (snd_usb_cm106_boot_quirk(dev) < 0) goto __err_val; } + + /* M-Audio Fast Track Pro */ + if (id == USB_ID(0x0763, 0x2012)) { + if (snd_usb_fasttrackpro_boot_quirk(dev, ifnum) < 0) + goto __err_val; + } /* * found a config. now register to ALSA