Skip to contentSkip to conversation

ALSA snd-usb-audio: Add Pioneer DDJ-SX3 PCM support

PATCH Applied Ard van Breemen 2 participants 4 messages Aug 2, 2019 – Aug 6, 2019 Sound

lore
Share & tools
lore
#0 lore raw

cover ALSA snd-usb-audio: Add Pioneer DDJ-SX3 PCM support

The Pioneer lacks the UAC descriptors (added to quircks). It also needs a fix in synchronisation handling for those cases that bSynchAddress == 0

Ard van Breemen (2):
Skip bSynchAddress endpoint check if it is invalid. Add Pioneer DDJ-SX3 PCM quirck.

 sound/usb/pcm.c          |  1 +
 sound/usb/quirks-table.h | 57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 ALSA snd-usb-audio: Skip bSynchAddress endpoint check if it is invalid.

The Linux kernel assumes that get_endpoint(alts,0) and get_endpoint(alts,1) are eachothers feedback endpoints.
To reassure that validity it will test bsynchaddress to comply with that assumption. But if the bsyncaddress is 0 (invalid), it will flag that as a wrong assumption and return an error.
Fix: Skip the test if bSynchAddress is 0.
Note: those with a valid bSynchAddress should have a code quirck added.

---
 sound/usb/pcm.c | 1 +
 1 file changed, 1 insertion(+)
sound/usb/pcm.c +1 -0
index 75b96929f76c..51a8faf25ed8 100644
@@ -456,6 +456,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
 	}
 	ep = get_endpoint(alts, 1)->bEndpointAddress;
 	if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
+	    get_endpoint(alts, 0)->bSynchAddress != 0 &&
 	    ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
 	     (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
 		dev_err(&dev->dev,
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 ALSA snd-usb-audio: Add Pioneer DDJ-SX3 PCM quirck.

In reply to Ard van Breemen

The Pioneer DDJ-SX3 is a plain 12 32bit channel out and 10 channel in PCM/midi controller. The PCM part is "vendor specific".
It needs the "ignore invalid bsynchaddress" patch as it uses 0 for that.

---
 sound/usb/quirks-table.h | 57 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
sound/usb/quirks-table.h +57 -0
index 9e049f60e80e..858c6fb17b78 100644
@@ -3534,5 +3534,62 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
 		}
 	}
 },
+{
+	/*
+	 * PIONEER DJ DDJ-SX3
+	 * PCM is 12 channels out, 10 channels in @ 44.1 fixed
+	 * interface 0, vendor class alt setting 1 for endpoints 5 and 0x86
+	 * The feedback for the output is the input.
+	 */
+	USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0023),
+	.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_S32_LE,
+					.channels = 12,
+					.iface = 0,
+					.altsetting = 1,
+					.altset_idx = 1,
+					.endpoint = 0x05,
+					.ep_attr = USB_ENDPOINT_XFER_ISOC|
+						   USB_ENDPOINT_SYNC_ASYNC,
+					.rates = SNDRV_PCM_RATE_44100,
+					.rate_min = 44100,
+					.rate_max = 44100,
+					.nr_rates = 1,
+					.rate_table = (unsigned int[]) { 44100 }
+				}
+			},
+			{
+				.ifnum = 0,
+				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
+				.data = &(const struct audioformat) {
+					.formats = SNDRV_PCM_FMTBIT_S32_LE,
+					.channels = 10,
+					.iface = 0,
+					.altsetting = 1,
+					.altset_idx = 1,
+					.endpoint = 0x86,
+					.ep_attr = USB_ENDPOINT_XFER_ISOC|
+						 USB_ENDPOINT_SYNC_ASYNC|
+						 USB_ENDPOINT_USAGE_IMPLICIT_FB,
+					.rates = SNDRV_PCM_RATE_44100,
+					.rate_min = 44100,
+					.rate_max = 44100,
+					.nr_rates = 1,
+					.rate_table = (unsigned int[]) { 44100 }
+				}
+			},
+			{
+				.ifnum = -1
+			}
+		}
+	}
+},
 
 #undef USB_DEVICE_VENDOR_SPEC
Signature · 1 line
2.17.1
Applied
#3 lore raw
In reply to Ard van Breemen
Quoted 8 lines · Ard van Breemen

The Pioneer lacks the UAC descriptors (added to quircks). It also needs a fix in synchronisation handling for those cases that bSynchAddress == 0

Ard van Breemen (2):
Skip bSynchAddress endpoint check if it is invalid. Add Pioneer DDJ-SX3 PCM quirck.

Applied both patches. Thanks.

Takashi