Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -ur linux-source-4.8-orig/sound/usb/quirks.c linux-source-4.8-vik/sound/usb/quirks.c
- --- linux-source-4.8-orig/sound/usb/quirks.c 2016-12-15 16:50:48.000000000 +0000
- +++ linux-source-4.8-vik/sound/usb/quirks.c 2017-04-26 00:03:37.785950373 +0100
- @@ -766,28 +766,6 @@
- return -EAGAIN;
- }
- -static void mbox2_setup_48_24_magic(struct usb_device *dev)
- -{
- - u8 srate[3];
- - u8 temp[12];
- -
- - /* Choose 48000Hz permanently */
- - srate[0] = 0x80;
- - srate[1] = 0xbb;
- - srate[2] = 0x00;
- -
- - /* Send the magic! */
- - snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
- - 0x01, 0x22, 0x0100, 0x0085, &temp, 0x0003);
- - snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
- - 0x81, 0xa2, 0x0100, 0x0085, &srate, 0x0003);
- - snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
- - 0x81, 0xa2, 0x0100, 0x0086, &srate, 0x0003);
- - snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
- - 0x81, 0xa2, 0x0100, 0x0003, &srate, 0x0003);
- - return;
- -}
- -
- /* Digidesign Mbox 2 needs to load firmware onboard
- * and driver must wait a few seconds for initialisation.
- */
- @@ -845,9 +823,7 @@
- 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);
- -
- - dev_info(&dev->dev, "Digidesign Mbox 2: 24bit 48kHz");
- + dev_info(&dev->dev, "Digidesign Mbox 2 configured");
- return 0; /* Successful boot */
- }
- @@ -1111,6 +1087,30 @@
- subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
- }
- +static void set_format_mbox2_quirk(struct snd_usb_substream *subs,
- + struct audioformat *fmt)
- +{
- + struct usb_device *dev = subs->dev;
- + u8 data[3];
- + u8 temp[12];
- + int err;
- + int rate = subs->cur_rate;
- +
- + dev_info(&subs->dev->dev, "mbox2: set rate to %dHz\n", rate);
- + data[0] = rate;
- + data[1] = rate >> 8;
- + data[2] = rate >> 16;
- +
- + /* Forcibly set the sample rate */
- + while ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
- + USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
- + UAC_EP_CS_ATTR_SAMPLE_RATE << 8, 0x0085, data, sizeof(data))) < 0)
- + dev_err(&dev->dev, "mbox2: set sample rate failed\n");
- +
- + dev_info(&subs->dev->dev, "mbox2: set sample rate to %dHz OK\n", rate);
- + return;
- +}
- +
- void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
- struct audioformat *fmt)
- {
- @@ -1121,6 +1121,9 @@
- case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */
- set_format_emu_quirk(subs, fmt);
- break;
- + case USB_ID(0x0dba, 0x3000): /* Digidesign Mbox 2 */
- + set_format_mbox2_quirk(subs, fmt);
- + break;
- }
- }
- diff -ur linux-source-4.8-orig/sound/usb/quirks-table.h linux-source-4.8-vik/sound/usb/quirks-table.h
- --- linux-source-4.8-orig/sound/usb/quirks-table.h 2016-12-15 16:50:48.000000000 +0000
- +++ linux-source-4.8-vik/sound/usb/quirks-table.h 2017-04-26 00:03:22.260081727 +0100
- @@ -3020,12 +3020,13 @@
- .attributes = 0x00,
- .endpoint = 0x03,
- .ep_attr = USB_ENDPOINT_SYNC_ASYNC,
- - .rates = SNDRV_PCM_RATE_48000,
- - .rate_min = 48000,
- + .rates = SNDRV_PCM_RATE_44100|
- + SNDRV_PCM_RATE_48000,
- + .rate_min = 44100,
- .rate_max = 48000,
- - .nr_rates = 1,
- + .nr_rates = 2,
- .rate_table = (unsigned int[]) {
- - 48000
- + 44100, 48000
- }
- }
- },
- @@ -3045,12 +3046,13 @@
- .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
- .endpoint = 0x85,
- .ep_attr = USB_ENDPOINT_SYNC_SYNC,
- - .rates = SNDRV_PCM_RATE_48000,
- - .rate_min = 48000,
- + .rates = SNDRV_PCM_RATE_44100|
- + SNDRV_PCM_RATE_48000,
- + .rate_min = 44100,
- .rate_max = 48000,
- - .nr_rates = 1,
- + .nr_rates = 2,
- .rate_table = (unsigned int[]) {
- - 48000
- + 44100, 48000
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement