Skip to content

Commit 7fccfec

Browse files
DmitryPantiwai
authored andcommitted
ALSA: usb-audio: Add Pioneer DJ DJM-900NXS2 support
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 7318234 commit 7fccfec

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

sound/usb/pcm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
370370
ep = 0x81;
371371
ifnum = 2;
372372
goto add_sync_ep_from_ifnum;
373+
case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
374+
ep = 0x82;
375+
ifnum = 0;
376+
goto add_sync_ep_from_ifnum;
373377
case USB_ID(0x0582, 0x01d8): /* BOSS Katana */
374378
/* BOSS Katana amplifiers do not need quirks */
375379
return 0;

sound/usb/quirks-table.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3557,5 +3557,68 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
35573557
QUIRK_DEVICE_PROFILE("Gigabyte", "Aorus Master Main Audio",
35583558
"Gigabyte-Aorus-Master-Main-Audio")
35593559
},
3560+
{
3561+
/*
3562+
* Pioneer DJ DJM-900NXS2
3563+
* 10 channels playback & 12 channels capture @ 44.1/48/96kHz S24LE
3564+
*/
3565+
USB_DEVICE_VENDOR_SPEC(0x2b73, 0x000a),
3566+
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
3567+
.ifnum = QUIRK_ANY_INTERFACE,
3568+
.type = QUIRK_COMPOSITE,
3569+
.data = (const struct snd_usb_audio_quirk[]) {
3570+
{
3571+
.ifnum = 0,
3572+
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
3573+
.data = &(const struct audioformat) {
3574+
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
3575+
.channels = 10,
3576+
.iface = 0,
3577+
.altsetting = 1,
3578+
.altset_idx = 1,
3579+
.endpoint = 0x01,
3580+
.ep_attr = USB_ENDPOINT_XFER_ISOC|
3581+
USB_ENDPOINT_SYNC_ASYNC,
3582+
.rates = SNDRV_PCM_RATE_44100|
3583+
SNDRV_PCM_RATE_48000|
3584+
SNDRV_PCM_RATE_96000,
3585+
.rate_min = 44100,
3586+
.rate_max = 96000,
3587+
.nr_rates = 3,
3588+
.rate_table = (unsigned int[]) {
3589+
44100, 48000, 96000
3590+
}
3591+
}
3592+
},
3593+
{
3594+
.ifnum = 0,
3595+
.type = QUIRK_AUDIO_FIXED_ENDPOINT,
3596+
.data = &(const struct audioformat) {
3597+
.formats = SNDRV_PCM_FMTBIT_S24_3LE,
3598+
.channels = 12,
3599+
.iface = 0,
3600+
.altsetting = 1,
3601+
.altset_idx = 1,
3602+
.endpoint = 0x82,
3603+
.ep_attr = USB_ENDPOINT_XFER_ISOC|
3604+
USB_ENDPOINT_SYNC_ASYNC|
3605+
USB_ENDPOINT_USAGE_IMPLICIT_FB,
3606+
.rates = SNDRV_PCM_RATE_44100|
3607+
SNDRV_PCM_RATE_48000|
3608+
SNDRV_PCM_RATE_96000,
3609+
.rate_min = 44100,
3610+
.rate_max = 96000,
3611+
.nr_rates = 3,
3612+
.rate_table = (unsigned int[]) {
3613+
44100, 48000, 96000
3614+
}
3615+
}
3616+
},
3617+
{
3618+
.ifnum = -1
3619+
}
3620+
}
3621+
}
3622+
},
35603623

35613624
#undef USB_DEVICE_VENDOR_SPEC

sound/usb/quirks.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,30 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
14581458
subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
14591459
}
14601460

1461+
1462+
/*
1463+
* Pioneer DJ DJM-900NXS2
1464+
* Device needs to know the sample rate each time substream is started
1465+
*/
1466+
static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs)
1467+
{
1468+
1469+
/* Convert sample rate value to little endian */
1470+
u8 sr[3];
1471+
1472+
sr[0] = subs->cur_rate & 0xff;
1473+
sr[1] = (subs->cur_rate >> 8) & 0xff;
1474+
sr[2] = (subs->cur_rate >> 16) & 0xff;
1475+
1476+
/* Configure device */
1477+
usb_set_interface(subs->dev, 0, 1);
1478+
snd_usb_ctl_msg(subs->stream->chip->dev,
1479+
usb_rcvctrlpipe(subs->stream->chip->dev, 0),
1480+
0x01, 0x22, 0x0100, 0x0082, &sr, 0x0003);
1481+
1482+
return 0;
1483+
}
1484+
14611485
void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
14621486
struct audioformat *fmt)
14631487
{
@@ -1468,6 +1492,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
14681492
case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */
14691493
set_format_emu_quirk(subs, fmt);
14701494
break;
1495+
case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
1496+
pioneer_djm_set_format_quirk(subs);
1497+
break;
14711498
}
14721499
}
14731500

0 commit comments

Comments
 (0)