All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivia Mackintosh <livvy@base.nu>
To: alsa-devel@alsa-project.org
Cc: dmitry@d-systems.ee, franta-linux@frantovo.cz
Subject: [PATCH v2] ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-750
Date: Sun, 24 Jan 2021 18:42:09 +0000	[thread overview]
Message-ID: <20210124184209.x2bf42wtild4v6fb@base.nu> (raw)

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 again 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 passed literally in the function call as we cannot
derive this from 'fmt->sync_ep' due to it not being set.  We can change
this if and when we revisit implicit FB.

Signed-off-by: Olivia Mackintosh <livvy@base.nu>
---
 sound/usb/quirks.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index e196e364cef1..b49a66f863f3 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1470,6 +1470,23 @@ 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,
+					u16 windex)
+{
+	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);
+	// we should derive windex from fmt-sync_ep but it's not set
+	snd_usb_ctl_msg(subs->stream->chip->dev,
+		usb_rcvctrlpipe(subs->stream->chip->dev, 0),
+		0x01, 0x22, 0x0100, windex, &sr, 0x0003);
+	return 0;
+}
+
 void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
 			      const struct audioformat *fmt)
 {
@@ -1483,6 +1500,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, 0x0086);
+		break;
 	}
 }
 
-- 
2.30.0


             reply	other threads:[~2021-01-24 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 18:42 Olivia Mackintosh [this message]
2021-01-24 20:50 ` [PATCH v2] ALSA: usb-audio: Re-add sample rate quirk for Pioneer DJM-750 Olivia Mackintosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210124184209.x2bf42wtild4v6fb@base.nu \
    --to=livvy@base.nu \
    --cc=alsa-devel@alsa-project.org \
    --cc=dmitry@d-systems.ee \
    --cc=franta-linux@frantovo.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.