Skip to contentSkip to conversation

ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-750

PATCH Superseded Olivia Mackintosh 1 participant 1 message Jan 24, 2021 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-750

Re-add the sample-rate quirk originally implemented by Dmitry Panchenko for the DJM-900NXS2 but for the DJM-750. This commit only adds it for the DJM-750 since I can only verify that it is absolutely required for this device. Other models may need this patch but I'm hesitant to add them as I cannot test.

The 'wIndex' is taken from fmt->sync_ep as different devices have a different sync endpoint which is specified in 'quirks-table.h'. Adding other devices should only require adding an additional case.

---
 sound/usb/quirks.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/usb/quirks.c +19 -0
index e196e364cef1..517346054fb7 100644
@@ -1470,6 +1470,22 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs,
 	subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
 }
 
+static int pioneer_djm_set_format_quirk(struct snd_usb_substream *subs,
+					const struct audioformat *fmt)
+{
+	unsigned int cur_rate = subs->data_endpoint->cur_rate;
+	u8 sr[3];
+	// Convert to little endian
+	sr[0] = cur_rate&0xff;
+	sr[1] = (cur_rate>>8)&0xff;
+	sr[2] = (cur_rate>>16)&0xff;
+	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, fmt->sync_ep, &sr, 0x0003);
+	return 0;
+}
+
 void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 			      const struct audioformat *fmt)
 {
@@ -1483,6 +1499,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 	case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
 		subs->stream_offset_adj = 2;
 		break;
+	case USB_ID(0x08e4, 0x017f): /* Pioneer DJM-750 */
+		pioneer_djm_set_format_quirk(subs, fmt);
+		break;
 	}
 }
 
Signature · 1 line
2.30.0