Commit 3b85f5fc authored by Olivia Mackintosh's avatar Olivia Mackintosh Committed by Takashi Iwai

ALSA: usb-audio: Add DJM450 to Pioneer format quirk

Like the DJM-750, ensure that the format control message is passed to
the device when opening a stream. It seems as though fmt->sync_ep is not
always set when this function is called hence the passing of the value
at the call site. If this can be fixed, fmt->sync_up should be used as
the wvalue.

There doesn't seem to be a "cpu_to_le24" type function defined hence for
the open code but I did see a similar thing done in Bluez lib. Perhaps
we can get these definitions defined in byteorder.h. See hci_cpu_to_le24
in include/net/bluetooth/hci.h:2543 for similar usage.
Signed-off-by: default avatarOlivia Mackintosh <livvy@base.nu>
Link: https://lore.kernel.org/r/20210202134225.3217-2-livvy@base.nuSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2d670ea2
...@@ -1470,6 +1470,23 @@ static void set_format_emu_quirk(struct snd_usb_substream *subs, ...@@ -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; 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, void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
const struct audioformat *fmt) const struct audioformat *fmt)
{ {
...@@ -1483,6 +1500,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, ...@@ -1483,6 +1500,9 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
subs->stream_offset_adj = 2; subs->stream_offset_adj = 2;
break; break;
case USB_ID(0x2b73, 0x0013): /* Pioneer DJM-450 */
pioneer_djm_set_format_quirk(subs, 0x0082);
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment