--- zzzz-none-000/linux-3.10.107/sound/usb/quirks.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/sound/usb/quirks.c 2021-02-04 17:41:59.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -42,12 +43,13 @@ static int create_composite_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, - const struct snd_usb_audio_quirk *quirk) + const struct snd_usb_audio_quirk *quirk_comp) { int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber; + const struct snd_usb_audio_quirk *quirk; int err; - for (quirk = quirk->data; quirk->ifnum >= 0; ++quirk) { + for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) { iface = usb_ifnum_to_if(chip->dev, quirk->ifnum); if (!iface) continue; @@ -57,9 +59,17 @@ err = snd_usb_create_quirk(chip, iface, driver, quirk); if (err < 0) return err; - if (quirk->ifnum != probed_ifnum) + } + + for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) { + iface = usb_ifnum_to_if(chip->dev, quirk->ifnum); + if (!iface) + continue; + if (quirk->ifnum != probed_ifnum && + !usb_interface_claimed(iface)) usb_driver_claim_interface(driver, iface, (void *)-1L); } + return 0; } @@ -105,11 +115,14 @@ struct usb_interface_descriptor *altsd; int err; + if (chip->usb_id == USB_ID(0x1686, 0x00dd)) /* Zoom R16/24 */ + chip->tx_length_quirk = 1; + alts = &iface->altsetting[0]; altsd = get_iface_desc(alts); err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber); if (err < 0) { - snd_printk(KERN_ERR "cannot setup if %d: error %d\n", + usb_audio_err(chip, "cannot setup if %d: error %d\n", altsd->bInterfaceNumber, err); return err; } @@ -128,14 +141,16 @@ { struct audioformat *fp; struct usb_host_interface *alts; + struct usb_interface_descriptor *altsd; int stream, err; unsigned *rate_table = NULL; fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL); if (!fp) { - snd_printk(KERN_ERR "cannot memdup\n"); + usb_audio_err(chip, "cannot memdup\n"); return -ENOMEM; } + INIT_LIST_HEAD(&fp->list); if (fp->nr_rates > MAX_NR_RATES) { kfree(fp); return -EINVAL; @@ -153,18 +168,22 @@ stream = (fp->endpoint & USB_DIR_IN) ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; err = snd_usb_add_audio_stream(chip, stream, fp); - if (err < 0) { - kfree(fp); - kfree(rate_table); - return err; - } + if (err < 0) + goto error; if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber || fp->altset_idx >= iface->num_altsetting) { - kfree(fp); - kfree(rate_table); - return -EINVAL; + err = -EINVAL; + goto error; } alts = &iface->altsetting[fp->altset_idx]; + altsd = get_iface_desc(alts); + if (altsd->bNumEndpoints < 1) { + err = -EINVAL; + goto error; + } + + fp->protocol = altsd->bInterfaceProtocol; + if (fp->datainterval == 0) fp->datainterval = snd_usb_parse_datainterval(chip, alts); if (fp->maxpacksize == 0) @@ -173,6 +192,218 @@ snd_usb_init_pitch(chip, fp->iface, alts, fp); snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max); return 0; + + error: + list_del(&fp->list); /* unlink for avoiding double-free */ + kfree(fp); + kfree(rate_table); + return err; +} + +static int create_auto_pcm_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver) +{ + struct usb_host_interface *alts; + struct usb_interface_descriptor *altsd; + struct usb_endpoint_descriptor *epd; + struct uac1_as_header_descriptor *ashd; + struct uac_format_type_i_discrete_descriptor *fmtd; + + /* + * Most Roland/Yamaha audio streaming interfaces have more or less + * standard descriptors, but older devices might lack descriptors, and + * future ones might change, so ensure that we fail silently if the + * interface doesn't look exactly right. + */ + + /* must have a non-zero altsetting for streaming */ + if (iface->num_altsetting < 2) + return -ENODEV; + alts = &iface->altsetting[1]; + altsd = get_iface_desc(alts); + + /* must have an isochronous endpoint for streaming */ + if (altsd->bNumEndpoints < 1) + return -ENODEV; + epd = get_endpoint(alts, 0); + if (!usb_endpoint_xfer_isoc(epd)) + return -ENODEV; + + /* must have format descriptors */ + ashd = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, + UAC_AS_GENERAL); + fmtd = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, + UAC_FORMAT_TYPE); + if (!ashd || ashd->bLength < 7 || + !fmtd || fmtd->bLength < 8) + return -ENODEV; + + return create_standard_audio_quirk(chip, iface, driver, NULL); +} + +static int create_yamaha_midi_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver, + struct usb_host_interface *alts) +{ + static const struct snd_usb_audio_quirk yamaha_midi_quirk = { + .type = QUIRK_MIDI_YAMAHA + }; + struct usb_midi_in_jack_descriptor *injd; + struct usb_midi_out_jack_descriptor *outjd; + + /* must have some valid jack descriptors */ + injd = snd_usb_find_csint_desc(alts->extra, alts->extralen, + NULL, USB_MS_MIDI_IN_JACK); + outjd = snd_usb_find_csint_desc(alts->extra, alts->extralen, + NULL, USB_MS_MIDI_OUT_JACK); + if (!injd && !outjd) + return -ENODEV; + if (injd && (injd->bLength < 5 || + (injd->bJackType != USB_MS_EMBEDDED && + injd->bJackType != USB_MS_EXTERNAL))) + return -ENODEV; + if (outjd && (outjd->bLength < 6 || + (outjd->bJackType != USB_MS_EMBEDDED && + outjd->bJackType != USB_MS_EXTERNAL))) + return -ENODEV; + return create_any_midi_quirk(chip, iface, driver, &yamaha_midi_quirk); +} + +static int create_roland_midi_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver, + struct usb_host_interface *alts) +{ + static const struct snd_usb_audio_quirk roland_midi_quirk = { + .type = QUIRK_MIDI_ROLAND + }; + u8 *roland_desc = NULL; + + /* might have a vendor-specific descriptor <06 24 F1 02 ...> */ + for (;;) { + roland_desc = snd_usb_find_csint_desc(alts->extra, + alts->extralen, + roland_desc, 0xf1); + if (!roland_desc) + return -ENODEV; + if (roland_desc[0] < 6 || roland_desc[3] != 2) + continue; + return create_any_midi_quirk(chip, iface, driver, + &roland_midi_quirk); + } +} + +static int create_std_midi_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver, + struct usb_host_interface *alts) +{ + struct usb_ms_header_descriptor *mshd; + struct usb_ms_endpoint_descriptor *msepd; + + /* must have the MIDIStreaming interface header descriptor*/ + mshd = (struct usb_ms_header_descriptor *)alts->extra; + if (alts->extralen < 7 || + mshd->bLength < 7 || + mshd->bDescriptorType != USB_DT_CS_INTERFACE || + mshd->bDescriptorSubtype != USB_MS_HEADER) + return -ENODEV; + /* must have the MIDIStreaming endpoint descriptor*/ + msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra; + if (alts->endpoint[0].extralen < 4 || + msepd->bLength < 4 || + msepd->bDescriptorType != USB_DT_CS_ENDPOINT || + msepd->bDescriptorSubtype != UAC_MS_GENERAL || + msepd->bNumEmbMIDIJack < 1 || + msepd->bNumEmbMIDIJack > 16) + return -ENODEV; + + return create_any_midi_quirk(chip, iface, driver, NULL); +} + +static int create_auto_midi_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver) +{ + struct usb_host_interface *alts; + struct usb_interface_descriptor *altsd; + struct usb_endpoint_descriptor *epd; + int err; + + alts = &iface->altsetting[0]; + altsd = get_iface_desc(alts); + + /* must have at least one bulk/interrupt endpoint for streaming */ + if (altsd->bNumEndpoints < 1) + return -ENODEV; + epd = get_endpoint(alts, 0); + if (!usb_endpoint_xfer_bulk(epd) && + !usb_endpoint_xfer_int(epd)) + return -ENODEV; + + switch (USB_ID_VENDOR(chip->usb_id)) { + case 0x0499: /* Yamaha */ + err = create_yamaha_midi_quirk(chip, iface, driver, alts); + if (err != -ENODEV) + return err; + break; + case 0x0582: /* Roland */ + err = create_roland_midi_quirk(chip, iface, driver, alts); + if (err != -ENODEV) + return err; + break; + } + + return create_std_midi_quirk(chip, iface, driver, alts); +} + +static int create_autodetect_quirk(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver) +{ + int err; + + err = create_auto_pcm_quirk(chip, iface, driver); + if (err == -ENODEV) + err = create_auto_midi_quirk(chip, iface, driver); + return err; +} + +static int create_autodetect_quirks(struct snd_usb_audio *chip, + struct usb_interface *iface, + struct usb_driver *driver, + const struct snd_usb_audio_quirk *quirk) +{ + int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber; + int ifcount, ifnum, err; + + err = create_autodetect_quirk(chip, iface, driver); + if (err < 0) + return err; + + /* + * ALSA PCM playback/capture devices cannot be registered in two steps, + * so we have to claim the other corresponding interface here. + */ + ifcount = chip->dev->actconfig->desc.bNumInterfaces; + for (ifnum = 0; ifnum < ifcount; ifnum++) { + if (ifnum == probed_ifnum || quirk->ifnum >= 0) + continue; + iface = usb_ifnum_to_if(chip->dev, ifnum); + if (!iface || + usb_interface_claimed(iface) || + get_iface_desc(iface->altsetting)->bInterfaceClass != + USB_CLASS_VENDOR_SPEC) + continue; + + err = create_autodetect_quirk(chip, iface, driver); + if (err >= 0) + usb_driver_claim_interface(driver, iface, (void *)-1L); + } + + return 0; } /* @@ -239,6 +470,7 @@ fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; fp->datainterval = 0; fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); + INIT_LIST_HEAD(&fp->list); switch (fp->maxpacksize) { case 0x120: @@ -253,7 +485,7 @@ fp->rate_max = fp->rate_min = 96000; break; default: - snd_printk(KERN_ERR "unknown sample rate\n"); + usb_audio_err(chip, "unknown sample rate\n"); kfree(fp); return -ENXIO; } @@ -262,6 +494,7 @@ ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; err = snd_usb_add_audio_stream(chip, stream, fp); if (err < 0) { + list_del(&fp->list); /* unlink for avoiding double-free */ kfree(fp); return err; } @@ -303,9 +536,11 @@ static const quirk_func_t quirk_funcs[] = { [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, [QUIRK_COMPOSITE] = create_composite_quirk, + [QUIRK_AUTODETECT] = create_autodetect_quirks, [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk, [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk, [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, + [QUIRK_MIDI_ROLAND] = create_any_midi_quirk, [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, @@ -324,7 +559,7 @@ if (quirk->type < QUIRK_TYPE_COUNT) { return quirk_funcs[quirk->type](chip, iface, driver, quirk); } else { - snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); + usb_audio_err(chip, "invalid quirk type %d\n", quirk->type); return -ENXIO; } } @@ -343,18 +578,21 @@ if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD || le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) { - snd_printdd("sending Extigy boot sequence...\n"); + dev_dbg(&dev->dev, "sending Extigy boot sequence...\n"); /* Send message to force it to reconnect with full interface. */ err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0), 0x10, 0x43, 0x0001, 0x000a, NULL, 0); - if (err < 0) snd_printdd("error sending boot message: %d\n", err); + if (err < 0) + dev_dbg(&dev->dev, "error sending boot message: %d\n", err); err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor)); config = dev->actconfig; - if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err); + if (err < 0) + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); err = usb_reset_configuration(dev); - if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err); - snd_printdd("extigy_boot: new boot length = %d\n", + if (err < 0) + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); + dev_dbg(&dev->dev, "extigy_boot: new boot length = %d\n", le16_to_cpu(get_cfg_desc(config)->wTotalLength)); return -ENODEV; /* quit this anyway */ } @@ -382,7 +620,7 @@ int err; if (dev->actconfig->desc.bConfigurationValue == 1) { - snd_printk(KERN_INFO "usb-audio: " + dev_info(&dev->dev, "Fast Track Pro 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 @@ -391,14 +629,15 @@ */ err = usb_driver_set_configuration(dev, 2); if (err < 0) - snd_printdd("error usb_driver_set_configuration: %d\n", - err); + dev_dbg(&dev->dev, + "error usb_driver_set_configuration: %d\n", + err); /* Always return an error, so that we stop creating a device that will just be destroyed and recreated with a new configuration */ return -ENODEV; } else - snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); + dev_info(&dev->dev, "Fast Track Pro config OK\n"); return 0; } @@ -448,10 +687,23 @@ return err; } +/* quirk for Plantronics GameCom 780 with CM6302 chip */ +static int snd_usb_gamecon780_boot_quirk(struct usb_device *dev) +{ + /* set the initial volume and don't change; other values are either + * too loud or silent due to firmware bug (bko#65251) + */ + u8 buf[2] = { 0x74, 0xe3 }; + return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, + USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, + UAC_FU_VOLUME << 8, 9 << 8, buf, 2); +} + /* * Novation Twitch DJ controller + * Focusrite Novation Saffire 6 USB audio card */ -static int snd_usb_twitch_boot_quirk(struct usb_device *dev) +static int snd_usb_novation_boot_quirk(struct usb_device *dev) { /* preemptively set up the device because otherwise the * raw MIDI endpoints are not active */ @@ -554,11 +806,11 @@ fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength); if (fwsize != MBOX2_FIRMWARE_SIZE) { - snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize); + dev_err(&dev->dev, "Invalid firmware size=%d.\n", fwsize); return -ENODEV; } - snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); + dev_dbg(&dev->dev, "Sending Digidesign Mbox 2 boot sequence...\n"); count = 0; bootresponse[0] = MBOX2_BOOT_LOADING; @@ -569,32 +821,32 @@ 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); if (bootresponse[0] == MBOX2_BOOT_READY) break; - snd_printd("usb-audio: device not ready, resending boot sequence...\n"); + dev_dbg(&dev->dev, "device not ready, resending boot sequence...\n"); count++; } if (bootresponse[0] != MBOX2_BOOT_READY) { - snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); + dev_err(&dev->dev, "Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); return -ENODEV; } - snd_printdd("usb-audio: device initialised!\n"); + dev_dbg(&dev->dev, "device initialised!\n"); err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor)); config = dev->actconfig; if (err < 0) - snd_printd("error usb_get_descriptor: %d\n", err); + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); err = usb_reset_configuration(dev); if (err < 0) - snd_printd("error usb_reset_configuration: %d\n", err); - snd_printdd("mbox2_boot: new boot length = %d\n", + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); + dev_dbg(&dev->dev, "mbox2_boot: new boot length = %d\n", le16_to_cpu(get_cfg_desc(config)->wTotalLength)); mbox2_setup_48_24_magic(dev); - snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz"); + dev_info(&dev->dev, "Digidesign Mbox 2: 24bit 48kHz"); return 0; /* Successful boot */ } @@ -640,7 +892,7 @@ return 1; /* skip this altsetting */ } } - snd_printdd(KERN_INFO + usb_audio_dbg(chip, "using altsetting %d for interface %d config %d\n", altno, iface, chip->setup); return 0; /* keep this altsetting */ @@ -707,7 +959,7 @@ return 1; } - snd_printdd(KERN_INFO + usb_audio_dbg(chip, "using altsetting %d for interface %d config %d\n", altno, iface, chip->setup); return 0; /* keep this altsetting */ @@ -760,9 +1012,9 @@ /* Digidesign Mbox 2 */ return snd_usb_mbox2_boot_quirk(dev); - case USB_ID(0x1235, 0x0018): - /* Focusrite Novation Twitch */ - return snd_usb_twitch_boot_quirk(dev); + case USB_ID(0x1235, 0x0010): /* Focusrite Novation Saffire 6 USB */ + case USB_ID(0x1235, 0x0018): /* Focusrite Novation Twitch */ + return snd_usb_novation_boot_quirk(dev); case USB_ID(0x133e, 0x0815): /* Access Music VirusTI Desktop */ @@ -774,6 +1026,8 @@ return snd_usb_nativeinstruments_boot_quirk(dev); case USB_ID(0x0763, 0x2012): /* M-Audio Fast Track Pro USB */ return snd_usb_fasttrackpro_boot_quirk(dev); + case USB_ID(0x047f, 0xc010): /* Plantronics Gamecom 780 */ + return snd_usb_gamecon780_boot_quirk(dev); } return 0; @@ -871,6 +1125,79 @@ } } +bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) +{ + /* devices which do not support reading the sample rate. */ + switch (chip->usb_id) { + case USB_ID(0x041E, 0x4080): /* Creative Live Cam VF0610 */ + case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ + case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ + case USB_ID(0x045E, 0x076E): /* MS Lifecam HD-5001 */ + case USB_ID(0x045E, 0x076F): /* MS Lifecam HD-6000 */ + case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ + case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ + case USB_ID(0x047F, 0x02F7): /* Plantronics BT-600 */ + case USB_ID(0x047F, 0x0415): /* Plantronics BT-300 */ + case USB_ID(0x047F, 0xAA05): /* Plantronics DA45 */ + case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ + case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ + case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ + case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ + case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ + case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */ + case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ + case USB_ID(0x1de7, 0x0114): /* Phoenix Audio MT202pcs */ + case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */ + return true; + } + return false; +} + +/* Marantz/Denon USB DACs need a vendor cmd to switch + * between PCM and native DSD mode + */ +static bool is_marantz_denon_dac(unsigned int id) +{ + switch (id) { + case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */ + case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */ + case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */ + return true; + } + return false; +} + +int snd_usb_select_mode_quirk(struct snd_usb_substream *subs, + struct audioformat *fmt) +{ + struct usb_device *dev = subs->dev; + int err; + + if (is_marantz_denon_dac(subs->stream->chip->usb_id)) { + /* First switch to alt set 0, otherwise the mode switch cmd + * will not be accepted by the DAC + */ + err = usb_set_interface(dev, fmt->iface, 0); + if (err < 0) + return err; + + mdelay(20); /* Delay needed after setting the interface */ + + switch (fmt->altsetting) { + case 2: /* DSD mode requested */ + case 1: /* PCM mode requested */ + err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 0, + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, + fmt->altsetting - 1, 1, NULL, 0); + if (err < 0) + return err; + break; + } + mdelay(20); + } + return 0; +} + void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) { /* @@ -931,16 +1258,18 @@ /* Marantz/Denon devices with USB DAC functionality need a delay * after each class compliant request */ - if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { + if (is_marantz_denon_dac(USB_ID(le16_to_cpu(dev->descriptor.idVendor), + le16_to_cpu(dev->descriptor.idProduct))) + && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) + mdelay(20); - switch (le16_to_cpu(dev->descriptor.idProduct)) { - case 0x3005: /* Marantz HD-DAC1 */ - case 0x3006: /* Marantz SA-14S1 */ - mdelay(20); - break; - } - } + /* Zoom R16/24 needs a tiny delay here, otherwise requests like + * get/set frequency return as failed despite actually succeeding. + */ + if ((le16_to_cpu(dev->descriptor.idVendor) == 0x1686) && + (le16_to_cpu(dev->descriptor.idProduct) == 0x00dd) && + (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) + mdelay(1); } /* @@ -969,5 +1298,33 @@ } } + /* XMOS based USB DACs */ + switch (chip->usb_id) { + case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */ + case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ + case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ + case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ + if (fp->altsetting == 2) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + + case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */ + case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */ + case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */ + case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ + case USB_ID(0x2616, 0x0106): /* PS Audio NuWave DAC */ + if (fp->altsetting == 3) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + default: + break; + } + + /* Denon/Marantz devices with USB DAC functionality */ + if (is_marantz_denon_dac(chip->usb_id)) { + if (fp->altsetting == 2) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + } + return 0; }