]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ALSA: usb-audio: Add Pioneer DJ DJM-900NXS2 support
authorDmitry Panchenko <dmitry@d-systems.ee>
Mon, 1 Jun 2020 10:22:24 +0000 (13:22 +0300)
committerTakashi Iwai <tiwai@suse.de>
Mon, 1 Jun 2020 18:35:50 +0000 (20:35 +0200)
Pioneer DJ DJM-900NXS2 is a widely used DJ mixer with 2 audio USB
interfaces. Both have a MIDI controller, 10 playback and 12 capture
channels. Audio endpoints are vendor-specific and 3 files need to be
patched. All playback and capture channels work fine with all supported
sample rates (44.1k, 48k, 96k). Patches are attached.

Signed-off-by: Dmitry Panchenko <dmitry@d-systems.ee>
Link: https://lore.kernel.org/r/48ab19ff-3303-9bf8-ed0e-bcb31d8537eb@d-systems.ee
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/pcm.c
sound/usb/quirks-table.h
sound/usb/quirks.c

index d61c2f1095b5c96f0474fbf5c92f442d5b4405c5..8a05dcb1344fda32698c5ecac9d76580c53b327e 100644 (file)
@@ -370,6 +370,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
                ep = 0x81;
                ifnum = 2;
                goto add_sync_ep_from_ifnum;
+       case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
+               ep = 0x82;
+               ifnum = 0;
+               goto add_sync_ep_from_ifnum;
        case USB_ID(0x0582, 0x01d8): /* BOSS Katana */
                /* BOSS Katana amplifiers do not need quirks */
                return 0;
index 5236f4d015c4867f1057fad1e4fd99a51166c5bc..6d6492195bdc7e7a110295f204649c4b9355f64f 100644 (file)
@@ -3557,5 +3557,68 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
        QUIRK_DEVICE_PROFILE("Gigabyte", "Aorus Master Main Audio",
                             "Gigabyte-Aorus-Master-Main-Audio")
 },
+{
+       /*
+        * Pioneer DJ DJM-900NXS2
+        * 10 channels playback & 12 channels capture @ 44.1/48/96kHz S24LE
+        */
+       USB_DEVICE_VENDOR_SPEC(0x2b73, 0x000a),
+       .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
+               .ifnum = QUIRK_ANY_INTERFACE,
+               .type = QUIRK_COMPOSITE,
+               .data = (const struct snd_usb_audio_quirk[]) {
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
+                               .data = &(const struct audioformat) {
+                                       .formats = SNDRV_PCM_FMTBIT_S24_3LE,
+                                       .channels = 10,
+                                       .iface = 0,
+                                       .altsetting = 1,
+                                       .altset_idx = 1,
+                                       .endpoint = 0x01,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC|
+                                           USB_ENDPOINT_SYNC_ASYNC,
+                                       .rates = SNDRV_PCM_RATE_44100|
+                                           SNDRV_PCM_RATE_48000|
+                                           SNDRV_PCM_RATE_96000,
+                                       .rate_min = 44100,
+                                       .rate_max = 96000,
+                                       .nr_rates = 3,
+                                       .rate_table = (unsigned int[]) {
+                                               44100, 48000, 96000
+                                       }
+                               }
+                       },
+                       {
+                               .ifnum = 0,
+                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
+                               .data = &(const struct audioformat) {
+                                       .formats = SNDRV_PCM_FMTBIT_S24_3LE,
+                                       .channels = 12,
+                                       .iface = 0,
+                                       .altsetting = 1,
+                                       .altset_idx = 1,
+                                       .endpoint = 0x82,
+                                       .ep_attr = USB_ENDPOINT_XFER_ISOC|
+                                           USB_ENDPOINT_SYNC_ASYNC|
+                                           USB_ENDPOINT_USAGE_IMPLICIT_FB,
+                                       .rates = SNDRV_PCM_RATE_44100|
+                                           SNDRV_PCM_RATE_48000|
+                                           SNDRV_PCM_RATE_96000,
+                                       .rate_min = 44100,
+                                       .rate_max = 96000,
+                                       .nr_rates = 3,
+                                       .rate_table = (unsigned int[]) {
+                                               44100, 48000, 96000
+                                       }
+                               }
+                       },
+                       {
+                               .ifnum = -1
+                       }
+               }
+       }
+},
 
 #undef USB_DEVICE_VENDOR_SPEC
index c0e3bc4afec6a0defbaf2953f6e3f74ee6ef54f6..bca0179a0ef8670cbc3bf2255ef9347dec8a013d 100644 (file)
@@ -1458,6 +1458,30 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
        subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
 }
 
+
+/*
+ * Pioneer DJ DJM-900NXS2
+ * Device needs to know the sample rate each time substream is started
+ */
+static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs)
+{
+
+       /* Convert sample rate value to little endian */
+       u8 sr[3];
+
+       sr[0] = subs->cur_rate & 0xff;
+       sr[1] = (subs->cur_rate >> 8) & 0xff;
+       sr[2] = (subs->cur_rate >> 16) & 0xff;
+
+       /* Configure device */
+       usb_set_interface(subs->dev, 0, 1);
+       snd_usb_ctl_msg(subs->stream->chip->dev,
+               usb_rcvctrlpipe(subs->stream->chip->dev, 0),
+               0x01, 0x22, 0x0100, 0x0082, &sr, 0x0003);
+
+       return 0;
+}
+
 void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
                              struct audioformat *fmt)
 {
@@ -1468,6 +1492,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
        case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */
                set_format_emu_quirk(subs, fmt);
                break;
+       case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
+               pioneer_djm_set_format_quirk(subs);
+               break;
        }
 }