alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
@ 2020-09-21 19:09 František Kučera
  2020-09-22 10:02 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: František Kučera @ 2020-09-21 19:09 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai, František Kučera

From: František Kučera <franta-linux@frantovo.cz>

This patch extends support for DJM-250MK2 and allows mapping
playback and capture channels to available sources.
Configures the card through USB commands.
---
 sound/usb/mixer_quirks.c | 216 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 216 insertions(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 199cdbfdc761..8d705d5f60f2 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2602,6 +2602,219 @@ static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer)
 	return 0;
 }
 
+/*
+ * Pioneer DJ DJM-250MK2 and maybe other DJM models
+ *
+ * For playback, no duplicate mapping should be set.
+ * There are three mixer stereo channels (CH1, CH2, AUX)
+ * and three stereo sources (Playback 1-2, Playback 3-4, Playback 5-6).
+ * Each channel should be mapped just once to one source.
+ * If mapped multiple times, only one source will play on given channel
+ * (sources are not mixed together).
+ *
+ * For recording, duplicate mapping is OK. We will get the same signal multiple times.
+ *
+ * Channels 7-8 are in both directions fixed to FX SEND / FX RETURN.
+ *
+ * See also notes in the quirks-table.h file.
+ */
+
+struct snd_pioneer_djm_option {
+	const u16 wIndex;
+	const u16 wValue;
+	const char *name;
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_LEVEL[] = {
+	{ .name =  "-5 dB",                  .wValue = 0x0300, .wIndex = 0x8003 },
+	{ .name = "-10 dB",                  .wValue = 0x0200, .wIndex = 0x8003 },
+	{ .name = "-15 dB",                  .wValue = 0x0100, .wIndex = 0x8003 },
+	{ .name = "-19 dB",                  .wValue = 0x0000, .wIndex = 0x8003 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH12[] = {
+	{ .name =  "CH1 Control Tone PHONO", .wValue = 0x0103, .wIndex = 0x8002 },
+	{ .name =  "CH1 Control Tone LINE",  .wValue = 0x0100, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0106, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0107, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0108, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0109, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x010d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x010a, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH34[] = {
+	{ .name =  "CH2 Control Tone PHONO", .wValue = 0x0203, .wIndex = 0x8002 },
+	{ .name =  "CH2 Control Tone LINE",  .wValue = 0x0200, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0206, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0207, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0208, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0209, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x020d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x020a, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH56[] = {
+	{ .name =  "REC OUT",                .wValue = 0x030a, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0311, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0312, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0307, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0308, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0309, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x030d, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_12[] = {
+	{ .name =  "CH1",                    .wValue = 0x0100, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0101, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0104, .wIndex = 0x8016 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_34[] = {
+	{ .name =  "CH1",                    .wValue = 0x0200, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0201, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0204, .wIndex = 0x8016 }
+};
+
+static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_56[] = {
+	{ .name =  "CH1",                    .wValue = 0x0300, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0301, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0304, .wIndex = 0x8016 }
+};
+
+struct snd_pioneer_djm_option_group {
+	const char *name;
+	const struct snd_pioneer_djm_option *options;
+	const size_t count;
+	const u16 default_value;
+} snd_pioneer_djm_option_group;
+
+#define SND_PIONEER_DJM_OPTION_GROUP_ITEM(_name, suffix, _default_value) { \
+	.name = _name, \
+	.options = SND_PIONEER_DJM_OPTIONS_##suffix, \
+	.count = ARRAY_SIZE(SND_PIONEER_DJM_OPTIONS_##suffix), \
+	.default_value = _default_value }
+
+static const struct snd_pioneer_djm_option_group SND_PIONEER_DJM_OPTION_GROUPS[] = {
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Master Capture Level Capture Switch", CAPTURE_LEVEL, 0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 1-2 Capture Switch",          CAPTURE_CH12,  2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 3-4 Capture Switch",          CAPTURE_CH34,  2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 5-6 Capture Switch",          CAPTURE_CH56,  0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 1-2 Playback Switch",        PLAYBACK_12,   0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 3-4 Playback Switch",        PLAYBACK_34,   1),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 5-6 Playback Switch",        PLAYBACK_56,   2)
+};
+
+// layout of the kcontrol->private_value:
+#define SND_PIONEER_DJM_VALUE_MASK 0x0000ffff
+#define SND_PIONEER_DJM_GROUP_MASK 0xffff0000
+#define SND_PIONEER_DJM_GROUP_SHIFT 16
+
+static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *info)
+{
+	u16 group_index = kctl->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
+	size_t count;
+	const char *name;
+	const struct snd_pioneer_djm_option_group *group;
+
+	if (group_index < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)) {
+		group = &SND_PIONEER_DJM_OPTION_GROUPS[group_index];
+		count = group->count;
+		if (info->value.enumerated.item >= count)
+			info->value.enumerated.item = count - 1;
+		name = group->options[info->value.enumerated.item].name;
+		strlcpy(info->value.enumerated.name, name, sizeof(info->value.enumerated.name));
+		info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+		info->count = 1;
+		info->value.enumerated.items = count;
+		return 0;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_update(struct usb_mixer_interface *mixer, u16 group, u16 value)
+{
+	int err;
+
+	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)
+			&& value < SND_PIONEER_DJM_OPTION_GROUPS[group].count) {
+		err = snd_usb_lock_shutdown(mixer->chip);
+		if (err)
+			return err;
+
+		err = snd_usb_ctl_msg(
+			mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
+			USB_REQ_SET_FEATURE,
+			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wValue,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wIndex,
+			NULL, 0);
+
+		snd_usb_unlock_shutdown(mixer->chip);
+		return err;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	elem->value.enumerated.item[0] = kctl->private_value & SND_PIONEER_DJM_VALUE_MASK;
+	return 0;
+}
+
+static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
+	struct usb_mixer_interface *mixer = list->mixer;
+	unsigned long private_value = kctl->private_value;
+
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = elem->value.enumerated.item[0];
+
+	kctl->private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | value;
+
+	return snd_pioneer_djm_controls_update(mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_resume(struct usb_mixer_elem_list *list)
+{
+	unsigned long private_value = list->kctl->private_value;
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = (private_value & SND_PIONEER_DJM_VALUE_MASK);
+
+	return snd_pioneer_djm_controls_update(list->mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_create(struct usb_mixer_interface *mixer)
+{
+	int err, i;
+	const struct snd_pioneer_djm_option_group *group;
+	struct snd_kcontrol_new knew = {
+		.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+		.index = 0,
+		.info = snd_pioneer_djm_controls_info,
+		.get  = snd_pioneer_djm_controls_get,
+		.put  = snd_pioneer_djm_controls_put
+	};
+
+	for (i = 0; i < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS); i++) {
+		group = &SND_PIONEER_DJM_OPTION_GROUPS[i];
+		knew.name = group->name;
+		knew.private_value = i << SND_PIONEER_DJM_GROUP_SHIFT | group->default_value;
+		err = snd_pioneer_djm_controls_update(mixer, i, group->default_value);
+		if (err)
+			return err;
+		err = add_single_ctl_with_resume(mixer, 0, snd_pioneer_djm_controls_resume,
+						 &knew, NULL);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -2706,6 +2919,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
 		err = snd_bbfpro_controls_create(mixer);
 		break;
+	case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
+		err = snd_pioneer_djm_controls_create(mixer);
+		break;
 	}
 
 	return err;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
  2020-09-21 19:09 [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2 František Kučera
@ 2020-09-22 10:02 ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-09-22 10:02 UTC (permalink / raw)
  To: František Kučera; +Cc: alsa-devel, František Kučera

On Mon, 21 Sep 2020 21:09:36 +0200,
František Kučera wrote:
> 
> From: František Kučera <franta-linux@frantovo.cz>
> 
> This patch extends support for DJM-250MK2 and allows mapping
> playback and capture channels to available sources.
> Configures the card through USB commands.

First off, your Signed-off-by line is missing.  This should have been
pointed by checkpatch.pl.

About the code changes:

> +static const struct snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_LEVEL[] = {

Avoid using the capital letters unless macros.
Ditto for other snd_pioneer_djm_option items.

> +struct snd_pioneer_djm_option_group {
> +	const char *name;
> +	const struct snd_pioneer_djm_option *options;
> +	const size_t count;
> +	const u16 default_value;
> +} snd_pioneer_djm_option_group;

Why you define an object here (snd_pioneer_djm_option_group), not only
struct?  I guess it was forgotten to remove when dropping typedef?

> +static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *info)
> +{
> +	u16 group_index = kctl->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
> +	size_t count;
> +	const char *name;
> +	const struct snd_pioneer_djm_option_group *group;
> +
> +	if (group_index < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)) {
> +		group = &SND_PIONEER_DJM_OPTION_GROUPS[group_index];
> +		count = group->count;
> +		if (info->value.enumerated.item >= count)
> +			info->value.enumerated.item = count - 1;
> +		name = group->options[info->value.enumerated.item].name;
> +		strlcpy(info->value.enumerated.name, name, sizeof(info->value.enumerated.name));
> +		info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
> +		info->count = 1;
> +		info->value.enumerated.items = count;
> +		return 0;
> +	} else {
> +		return -EINVAL;
> +	}

This can be a bit simpler if you write like:

	if (group_index >= ARRAY_SIZE(....))
		return -EINVAL;

	group = &SND_PIONEER_DJM_OPTION_GROUPS[group_index];
	count = group->count;
	.....
	
The same applied to other functions.

> +static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
> +{
> +	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
> +	struct usb_mixer_interface *mixer = list->mixer;
> +	unsigned long private_value = kctl->private_value;
> +
> +	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;

Avoid the unnecessary blank line in the above.


> +	u16 value = elem->value.enumerated.item[0];
> +
> +	kctl->private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | value;

Better to wrap write parentheses around the bit operation for avoiding
confusions.  (Also a similar expression is found in another place).


thanks,

Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
  2020-09-22 14:42 František Kučera
@ 2020-09-23 12:44 ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-09-23 12:44 UTC (permalink / raw)
  To: František Kučera; +Cc: alsa-devel, František Kučera

On Tue, 22 Sep 2020 16:42:06 +0200,
František Kučera wrote:
> 
> From: František Kučera <franta-linux@frantovo.cz>
> 
> This patch extends support for DJM-250MK2 and allows mapping
> playback and capture channels to available sources.
> Configures the card through USB commands.
> 
> Signed-off-by: František Kučera <franta-linux@frantovo.cz>

Applied now.  Thanks.

BTW, at the next time when you resubmit a patch, please put "v2" or
such prefix in the subject, e.g.
  [PATCH v2] ALSA: usb-audio: ....

Also, putting the changed points from the previous revision in the
patch description (or after the line "---") would be helpful, too.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
@ 2020-09-22 14:42 František Kučera
  2020-09-23 12:44 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: František Kučera @ 2020-09-22 14:42 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai, František Kučera

From: František Kučera <franta-linux@frantovo.cz>

This patch extends support for DJM-250MK2 and allows mapping
playback and capture channels to available sources.
Configures the card through USB commands.

Signed-off-by: František Kučera <franta-linux@frantovo.cz>
---
 sound/usb/mixer_quirks.c | 213 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 213 insertions(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 199cdbfdc761..df036a359f2f 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2602,6 +2602,216 @@ static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer)
 	return 0;
 }
 
+/*
+ * Pioneer DJ DJM-250MK2 and maybe other DJM models
+ *
+ * For playback, no duplicate mapping should be set.
+ * There are three mixer stereo channels (CH1, CH2, AUX)
+ * and three stereo sources (Playback 1-2, Playback 3-4, Playback 5-6).
+ * Each channel should be mapped just once to one source.
+ * If mapped multiple times, only one source will play on given channel
+ * (sources are not mixed together).
+ *
+ * For recording, duplicate mapping is OK. We will get the same signal multiple times.
+ *
+ * Channels 7-8 are in both directions fixed to FX SEND / FX RETURN.
+ *
+ * See also notes in the quirks-table.h file.
+ */
+
+struct snd_pioneer_djm_option {
+	const u16 wIndex;
+	const u16 wValue;
+	const char *name;
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_capture_level[] = {
+	{ .name =  "-5 dB",                  .wValue = 0x0300, .wIndex = 0x8003 },
+	{ .name = "-10 dB",                  .wValue = 0x0200, .wIndex = 0x8003 },
+	{ .name = "-15 dB",                  .wValue = 0x0100, .wIndex = 0x8003 },
+	{ .name = "-19 dB",                  .wValue = 0x0000, .wIndex = 0x8003 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_capture_ch12[] = {
+	{ .name =  "CH1 Control Tone PHONO", .wValue = 0x0103, .wIndex = 0x8002 },
+	{ .name =  "CH1 Control Tone LINE",  .wValue = 0x0100, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0106, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0107, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0108, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0109, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x010d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x010a, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_capture_ch34[] = {
+	{ .name =  "CH2 Control Tone PHONO", .wValue = 0x0203, .wIndex = 0x8002 },
+	{ .name =  "CH2 Control Tone LINE",  .wValue = 0x0200, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0206, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0207, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0208, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0209, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x020d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x020a, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_capture_ch56[] = {
+	{ .name =  "REC OUT",                .wValue = 0x030a, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0311, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0312, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0307, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0308, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0309, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x030d, .wIndex = 0x8002 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_playback_12[] = {
+	{ .name =  "CH1",                    .wValue = 0x0100, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0101, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0104, .wIndex = 0x8016 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_playback_34[] = {
+	{ .name =  "CH1",                    .wValue = 0x0200, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0201, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0204, .wIndex = 0x8016 }
+};
+
+static const struct snd_pioneer_djm_option snd_pioneer_djm_options_playback_56[] = {
+	{ .name =  "CH1",                    .wValue = 0x0300, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0301, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0304, .wIndex = 0x8016 }
+};
+
+struct snd_pioneer_djm_option_group {
+	const char *name;
+	const struct snd_pioneer_djm_option *options;
+	const size_t count;
+	const u16 default_value;
+};
+
+#define snd_pioneer_djm_option_group_item(_name, suffix, _default_value) { \
+	.name = _name, \
+	.options = snd_pioneer_djm_options_##suffix, \
+	.count = ARRAY_SIZE(snd_pioneer_djm_options_##suffix), \
+	.default_value = _default_value }
+
+static const struct snd_pioneer_djm_option_group snd_pioneer_djm_option_groups[] = {
+	snd_pioneer_djm_option_group_item("Master Capture Level Capture Switch", capture_level, 0),
+	snd_pioneer_djm_option_group_item("Capture 1-2 Capture Switch",          capture_ch12,  2),
+	snd_pioneer_djm_option_group_item("Capture 3-4 Capture Switch",          capture_ch34,  2),
+	snd_pioneer_djm_option_group_item("Capture 5-6 Capture Switch",          capture_ch56,  0),
+	snd_pioneer_djm_option_group_item("Playback 1-2 Playback Switch",        playback_12,   0),
+	snd_pioneer_djm_option_group_item("Playback 3-4 Playback Switch",        playback_34,   1),
+	snd_pioneer_djm_option_group_item("Playback 5-6 Playback Switch",        playback_56,   2)
+};
+
+// layout of the kcontrol->private_value:
+#define SND_PIONEER_DJM_VALUE_MASK 0x0000ffff
+#define SND_PIONEER_DJM_GROUP_MASK 0xffff0000
+#define SND_PIONEER_DJM_GROUP_SHIFT 16
+
+static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *info)
+{
+	u16 group_index = kctl->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
+	size_t count;
+	const char *name;
+	const struct snd_pioneer_djm_option_group *group;
+
+	if (group_index >= ARRAY_SIZE(snd_pioneer_djm_option_groups))
+		return -EINVAL;
+
+	group = &snd_pioneer_djm_option_groups[group_index];
+	count = group->count;
+	if (info->value.enumerated.item >= count)
+		info->value.enumerated.item = count - 1;
+	name = group->options[info->value.enumerated.item].name;
+	strlcpy(info->value.enumerated.name, name, sizeof(info->value.enumerated.name));
+	info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	info->count = 1;
+	info->value.enumerated.items = count;
+	return 0;
+}
+
+static int snd_pioneer_djm_controls_update(struct usb_mixer_interface *mixer, u16 group, u16 value)
+{
+	int err;
+
+	if (group >= ARRAY_SIZE(snd_pioneer_djm_option_groups)
+			|| value >= snd_pioneer_djm_option_groups[group].count)
+		return -EINVAL;
+
+	err = snd_usb_lock_shutdown(mixer->chip);
+	if (err)
+		return err;
+
+	err = snd_usb_ctl_msg(
+		mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
+		USB_REQ_SET_FEATURE,
+		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+		snd_pioneer_djm_option_groups[group].options[value].wValue,
+		snd_pioneer_djm_option_groups[group].options[value].wIndex,
+		NULL, 0);
+
+	snd_usb_unlock_shutdown(mixer->chip);
+	return err;
+}
+
+static int snd_pioneer_djm_controls_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	elem->value.enumerated.item[0] = kctl->private_value & SND_PIONEER_DJM_VALUE_MASK;
+	return 0;
+}
+
+static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
+	struct usb_mixer_interface *mixer = list->mixer;
+	unsigned long private_value = kctl->private_value;
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = elem->value.enumerated.item[0];
+
+	kctl->private_value = (group << SND_PIONEER_DJM_GROUP_SHIFT) | value;
+
+	return snd_pioneer_djm_controls_update(mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_resume(struct usb_mixer_elem_list *list)
+{
+	unsigned long private_value = list->kctl->private_value;
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = (private_value & SND_PIONEER_DJM_VALUE_MASK);
+
+	return snd_pioneer_djm_controls_update(list->mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_create(struct usb_mixer_interface *mixer)
+{
+	int err, i;
+	const struct snd_pioneer_djm_option_group *group;
+	struct snd_kcontrol_new knew = {
+		.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+		.index = 0,
+		.info = snd_pioneer_djm_controls_info,
+		.get  = snd_pioneer_djm_controls_get,
+		.put  = snd_pioneer_djm_controls_put
+	};
+
+	for (i = 0; i < ARRAY_SIZE(snd_pioneer_djm_option_groups); i++) {
+		group = &snd_pioneer_djm_option_groups[i];
+		knew.name = group->name;
+		knew.private_value = (i << SND_PIONEER_DJM_GROUP_SHIFT) | group->default_value;
+		err = snd_pioneer_djm_controls_update(mixer, i, group->default_value);
+		if (err)
+			return err;
+		err = add_single_ctl_with_resume(mixer, 0, snd_pioneer_djm_controls_resume,
+						 &knew, NULL);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -2706,6 +2916,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
 		err = snd_bbfpro_controls_create(mixer);
 		break;
+	case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
+		err = snd_pioneer_djm_controls_create(mixer);
+		break;
 	}
 
 	return err;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
@ 2020-09-21 18:20 František Kučera
  0 siblings, 0 replies; 7+ messages in thread
From: František Kučera @ 2020-09-21 18:20 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai, František Kučera

From: František Kučera <franta-linux@frantovo.cz>

This patch extends support for DJM-250MK2 and allows mapping
playback and capture channels to available sources.
Configures the card through USB commands.
---
 sound/usb/mixer_quirks.c | 216 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 216 insertions(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 199cdbfdc761..b7816a71c42d 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2602,6 +2602,219 @@ static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer)
 	return 0;
 }
 
+/*
+ * Pioneer DJ DJM-250MK2 and maybe other DJM models
+ *
+ * For playback, no duplicate mapping should be set.
+ * There are three mixer stereo channels (CH1, CH2, AUX)
+ * and three stereo sources (Playback 1-2, Playback 3-4, Playback 5-6).
+ * Each channel should be mapped just once to one source.
+ * If mapped multiple times, only one source will play on given channel
+ * (sources are not mixed together).
+ *
+ * For recording, duplicate mapping is OK. We will get the same signal multiple times.
+ *
+ * Channels 7-8 are in both directions fixed to FX SEND / FX RETURN.
+ *
+ * See also notes in the quirks-table.h file.
+ */
+
+typedef struct {
+	const u16 wIndex;
+	const u16 wValue;
+	const char *name;
+} snd_pioneer_djm_option;
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_LEVEL[] = {
+	{ .name =  "-5 dB",                  .wValue = 0x0300, .wIndex = 0x8003 },
+	{ .name = "-10 dB",                  .wValue = 0x0200, .wIndex = 0x8003 },
+	{ .name = "-15 dB",                  .wValue = 0x0100, .wIndex = 0x8003 },
+	{ .name = "-19 dB",                  .wValue = 0x0000, .wIndex = 0x8003 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH12[] = {
+	{ .name =  "CH1 Control Tone PHONO", .wValue = 0x0103, .wIndex = 0x8002 },
+	{ .name =  "CH1 Control Tone LINE",  .wValue = 0x0100, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0106, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0107, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0108, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0109, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x010d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x010a, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH34[] = {
+	{ .name =  "CH2 Control Tone PHONO", .wValue = 0x0203, .wIndex = 0x8002 },
+	{ .name =  "CH2 Control Tone LINE",  .wValue = 0x0200, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0206, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0207, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0208, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0209, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x020d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x020a, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH56[] = {
+	{ .name =  "REC OUT",                .wValue = 0x030a, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0311, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0312, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0307, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0308, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0309, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x030d, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_12[] = {
+	{ .name =  "CH1",                    .wValue = 0x0100, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0101, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0104, .wIndex = 0x8016 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_34[] = {
+	{ .name =  "CH1",                    .wValue = 0x0200, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0201, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0204, .wIndex = 0x8016 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_56[] = {
+	{ .name =  "CH1",                    .wValue = 0x0300, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0301, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0304, .wIndex = 0x8016 }
+};
+
+typedef struct {
+	const char *name;
+	const snd_pioneer_djm_option *options;
+	const size_t count;
+	const u16 default_value;
+} snd_pioneer_djm_option_group;
+
+#define SND_PIONEER_DJM_OPTION_GROUP_ITEM(_name, suffix, _default_value) { \
+	.name = _name, \
+	.options = SND_PIONEER_DJM_OPTIONS_##suffix, \
+	.count = ARRAY_SIZE(SND_PIONEER_DJM_OPTIONS_##suffix), \
+	.default_value = _default_value }
+
+static const snd_pioneer_djm_option_group SND_PIONEER_DJM_OPTION_GROUPS[] = {
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Master Capture Level Capture Switch", CAPTURE_LEVEL, 0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 1-2 Capture Switch",          CAPTURE_CH12,  2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 3-4 Capture Switch",          CAPTURE_CH34,  2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 5-6 Capture Switch",          CAPTURE_CH56,  0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 1-2 Playback Switch",        PLAYBACK_12,   0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 3-4 Playback Switch",        PLAYBACK_34,   1),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 5-6 Playback Switch",        PLAYBACK_56,   2)
+};
+
+// layout of the kcontrol->private_value:
+#define SND_PIONEER_DJM_VALUE_MASK 0x0000ffff
+#define SND_PIONEER_DJM_GROUP_MASK 0xffff0000
+#define SND_PIONEER_DJM_GROUP_SHIFT 16
+
+static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *info)
+{
+	u16 group_index = kctl->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
+	size_t count;
+	const char *name;
+	const snd_pioneer_djm_option_group *group;
+
+	if (group_index < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)) {
+		group = &SND_PIONEER_DJM_OPTION_GROUPS[group_index];
+		count = group->count;
+		if (info->value.enumerated.item >= count)
+			info->value.enumerated.item = count - 1;
+		name = group->options[info->value.enumerated.item].name;
+		strlcpy(info->value.enumerated.name, name, sizeof(info->value.enumerated.name));
+		info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+		info->count = 1;
+		info->value.enumerated.items = count;
+		return 0;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_update(struct usb_mixer_interface *mixer, u16 group, u16 value)
+{
+	int err;
+
+	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)
+			&& value < SND_PIONEER_DJM_OPTION_GROUPS[group].count) {
+		err = snd_usb_lock_shutdown(mixer->chip);
+		if (err)
+			return err;
+
+		err = snd_usb_ctl_msg(
+			mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
+			USB_REQ_SET_FEATURE,
+			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wValue,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wIndex,
+			NULL, 0);
+
+		snd_usb_unlock_shutdown(mixer->chip);
+		return err;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	elem->value.enumerated.item[0] = kctl->private_value & SND_PIONEER_DJM_VALUE_MASK;
+	return 0;
+}
+
+static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *elem)
+{
+	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl);
+	struct usb_mixer_interface *mixer = list->mixer;
+	unsigned long private_value = kctl->private_value;
+
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = elem->value.enumerated.item[0];
+
+	kctl->private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | value;
+
+	return snd_pioneer_djm_controls_update(mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_resume(struct usb_mixer_elem_list *list)
+{
+	unsigned long private_value = list->kctl->private_value;
+	u16 group = (private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = (private_value & SND_PIONEER_DJM_VALUE_MASK);
+
+	return snd_pioneer_djm_controls_update(list->mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_create(struct usb_mixer_interface *mixer)
+{
+	int err, i;
+	const snd_pioneer_djm_option_group *group;
+	struct snd_kcontrol_new knew = {
+		.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+		.index = 0,
+		.info = snd_pioneer_djm_controls_info,
+		.get  = snd_pioneer_djm_controls_get,
+		.put  = snd_pioneer_djm_controls_put
+	};
+
+	for (i = 0; i < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS); i++) {
+		group = &SND_PIONEER_DJM_OPTION_GROUPS[i];
+		knew.name = group->name;
+		knew.private_value = i << SND_PIONEER_DJM_GROUP_SHIFT | group->default_value;
+		err = snd_pioneer_djm_controls_update(mixer, i, group->default_value);
+		if (err)
+			return err;
+		err = add_single_ctl_with_resume(mixer, 0, snd_pioneer_djm_controls_resume,
+						 &knew, NULL);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -2706,6 +2919,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
 		err = snd_bbfpro_controls_create(mixer);
 		break;
+	case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
+		err = snd_pioneer_djm_controls_create(mixer);
+		break;
 	}
 
 	return err;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
  2020-09-21 16:16 František Kučera
@ 2020-09-21 16:36 ` Takashi Iwai
  0 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2020-09-21 16:36 UTC (permalink / raw)
  To: František Kučera
  Cc: alsa-devel, Dmitry Panchenko, František Kučera, Fabian Lesniak

On Mon, 21 Sep 2020 18:16:12 +0200,
František Kučera wrote:
> 
> From: František Kučera <franta-linux@frantovo.cz>
> 
> This patch extends support for DJM-250MK2 and allows mapping
> playback and capture channels to available sources.
> Configures the card through USB commands.

Could you run scripts/checkpatch.pl, fix the suggested items and
resubmit?


thanks,

Takashi


> ---
>  sound/usb/mixer_quirks.c | 194 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 194 insertions(+)
> 
> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index 199cdbfdc761..f2aeb5ac3611 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -2602,6 +2602,197 @@ static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer)
>  	return 0;
>  }
>  
> +/*
> + * Pioneer DJ DJM-250MK2 and maybe other DJM models
> + * 
> + * For playback, no duplicate mapping should be set.
> + * There are three mixer stereo channels (CH1, CH2, AUX) and three stereo sources (PLAYBACK 1-2, PLAYBACK 3-4, PLAYBACK 5-6).
> + * Each channel should be mapped just once to one source.
> + * If mapped multiple times, only one source will play on given channel (sources are not mixed together).
> + * 
> + * For recording, duplicate mapping is OK. We will get the same signal multiple times.
> + * 
> + * Channels 7-8 are in both directions fixed to FX SEND / FX RETURN.
> + * 
> + * See also notes in the quirks-table.h file.
> + */
> +
> +typedef struct {
> +	const u16 wIndex;
> +	const u16 wValue;
> +	const char *name;
> +} snd_pioneer_djm_option;
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_LEVEL[] = {
> +	{ .name =  "-5 dB",                  .wValue = 0x0300, .wIndex = 0x8003 },
> +	{ .name = "-10 dB",                  .wValue = 0x0200, .wIndex = 0x8003 },
> +	{ .name = "-15 dB",                  .wValue = 0x0100, .wIndex = 0x8003 },
> +	{ .name = "-19 dB",                  .wValue = 0x0000, .wIndex = 0x8003 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH12[] = {
> +	{ .name =  "CH1 Control Tone PHONO", .wValue = 0x0103, .wIndex = 0x8002 },
> +	{ .name =  "CH1 Control Tone LINE",  .wValue = 0x0100, .wIndex = 0x8002 },
> +	{ .name =  "Post CH1 Fader",         .wValue = 0x0106, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader A",          .wValue = 0x0107, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader B",          .wValue = 0x0108, .wIndex = 0x8002 },
> +	{ .name =  "MIC",                    .wValue = 0x0109, .wIndex = 0x8002 },
> +	{ .name =  "AUX",                    .wValue = 0x010d, .wIndex = 0x8002 },
> +	{ .name =  "REC OUT",                .wValue = 0x010a, .wIndex = 0x8002 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH34[] = {
> +	{ .name =  "CH2 Control Tone PHONO", .wValue = 0x0203, .wIndex = 0x8002 },
> +	{ .name =  "CH2 Control Tone LINE",  .wValue = 0x0200, .wIndex = 0x8002 },
> +	{ .name =  "Post CH2 Fader",         .wValue = 0x0206, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader A",          .wValue = 0x0207, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader B",          .wValue = 0x0208, .wIndex = 0x8002 },
> +	{ .name =  "MIC",                    .wValue = 0x0209, .wIndex = 0x8002 },
> +	{ .name =  "AUX",                    .wValue = 0x020d, .wIndex = 0x8002 },
> +	{ .name =  "REC OUT",                .wValue = 0x020a, .wIndex = 0x8002 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH56[] = {
> +	{ .name =  "REC OUT",                .wValue = 0x030a, .wIndex = 0x8002 },
> +	{ .name =  "Post CH1 Fader",         .wValue = 0x0311, .wIndex = 0x8002 },
> +	{ .name =  "Post CH2 Fader",         .wValue = 0x0312, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader A",          .wValue = 0x0307, .wIndex = 0x8002 },
> +	{ .name =  "Cross Fader B",          .wValue = 0x0308, .wIndex = 0x8002 },
> +	{ .name =  "MIC",                    .wValue = 0x0309, .wIndex = 0x8002 },
> +	{ .name =  "AUX",                    .wValue = 0x030d, .wIndex = 0x8002 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_12[] = {
> +	{ .name =  "CH1",                    .wValue = 0x0100, .wIndex = 0x8016 },
> +	{ .name =  "CH2",                    .wValue = 0x0101, .wIndex = 0x8016 },
> +	{ .name =  "AUX",                    .wValue = 0x0104, .wIndex = 0x8016 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_34[] = {
> +	{ .name =  "CH1",                    .wValue = 0x0200, .wIndex = 0x8016 },
> +	{ .name =  "CH2",                    .wValue = 0x0201, .wIndex = 0x8016 },
> +	{ .name =  "AUX",                    .wValue = 0x0204, .wIndex = 0x8016 }
> +};
> +
> +static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_56[] = {
> +	{ .name =  "CH1",                    .wValue = 0x0300, .wIndex = 0x8016 },
> +	{ .name =  "CH2",                    .wValue = 0x0301, .wIndex = 0x8016 },
> +	{ .name =  "AUX",                    .wValue = 0x0304, .wIndex = 0x8016 }
> +};
> +
> +typedef struct {
> +	const char *name;
> +	const snd_pioneer_djm_option *options;
> +	const size_t count;
> +	const u16 default_value;
> +} snd_pioneer_djm_option_group;
> +
> +#define SND_PIONEER_DJM_OPTION_GROUP_ITEM(_name, suffix, _default_value) \
> +	{ .name = _name, .options = SND_PIONEER_DJM_OPTIONS_##suffix, .count = ARRAY_SIZE(SND_PIONEER_DJM_OPTIONS_##suffix), .default_value = _default_value }
> +
> +static const snd_pioneer_djm_option_group SND_PIONEER_DJM_OPTION_GROUPS[] = {
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Master Capture Level Capture Switch",  CAPTURE_LEVEL,  0),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 1-2 Capture Switch",           CAPTURE_CH12,   2),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 3-4 Capture Switch",           CAPTURE_CH34,   2),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 5-6 Capture Switch",           CAPTURE_CH56,   0),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 1-2 Playback Switch",         PLAYBACK_12,    0),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 3-4 Playback Switch",         PLAYBACK_34,    1),
> +	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 5-6 Playback Switch",         PLAYBACK_56,    2)
> +};
> +
> +// layout of the kcontrol->private_value:
> +#define SND_PIONEER_DJM_VALUE_MASK 0x0000ffff
> +#define SND_PIONEER_DJM_GROUP_MASK 0xffff0000
> +#define SND_PIONEER_DJM_GROUP_SHIFT 16
> +
> +static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *info) 
> +{
> +	u16 group = kcontrol->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
> +	size_t count;
> +	const char *name;
> +	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)) {
> +		count = SND_PIONEER_DJM_OPTION_GROUPS[group].count;
> +		if (info->value.enumerated.item >= count) info->value.enumerated.item = count - 1;
> +		name = SND_PIONEER_DJM_OPTION_GROUPS[group].options[info->value.enumerated.item].name;
> +		strlcpy(info->value.enumerated.name, name, sizeof (info->value.enumerated.name));
> +		info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
> +		info->count = 1;
> +		info->value.enumerated.items = count;
> +		return 0;
> +	} else {
> +		return -EINVAL;
> +	}
> +}
> +
> +static int snd_pioneer_djm_controls_update(struct usb_mixer_interface *mixer, u16 group, u16 value)
> +{
> +	int err;
> +	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS) && value < SND_PIONEER_DJM_OPTION_GROUPS[group].count) {
> +		err = snd_usb_lock_shutdown(mixer->chip);
> +		if (err) return err;
> +		
> +		err = snd_usb_ctl_msg(
> +			mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
> +			USB_REQ_SET_FEATURE,
> +			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> +			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wValue,
> +			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wIndex,
> +			NULL, 0);
> +		
> +		snd_usb_unlock_shutdown(mixer->chip);
> +		return err;
> +	} else {
> +		return -EINVAL;
> +	}
> +}
> +
> +static int snd_pioneer_djm_controls_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
> +{
> +	ucontrol->value.enumerated.item[0] = kcontrol->private_value & SND_PIONEER_DJM_VALUE_MASK;
> +	return 0;
> +}
> +
> +static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
> +	struct usb_mixer_interface *mixer = list->mixer;
> +	
> +	u16 group = (kcontrol->private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
> +	u16 value = ucontrol->value.enumerated.item[0];
> +	kcontrol->private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | value;
> +	
> +	return snd_pioneer_djm_controls_update(mixer, group, value);
> +}
> +
> +static int snd_pioneer_djm_controls_resume(struct usb_mixer_elem_list *list)
> +{
> +	u16 group = (list->kctl->private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
> +	u16 value = (list->kctl->private_value & SND_PIONEER_DJM_VALUE_MASK);
> +	return snd_pioneer_djm_controls_update(list->mixer, group, value);
> +}
> +
> +static int snd_pioneer_djm_controls_create(struct usb_mixer_interface *mixer)
> +{
> +	int err, group;
> +	for (group = 0; group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS); group++ ) {
> +		struct snd_kcontrol_new knew = {
> +			.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
> +			.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
> +			.index = 0,
> +			.info = snd_pioneer_djm_controls_info,
> +			.get  = snd_pioneer_djm_controls_get,
> +			.put  = snd_pioneer_djm_controls_put,
> +			.name = SND_PIONEER_DJM_OPTION_GROUPS[group].name,
> +			.private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | SND_PIONEER_DJM_OPTION_GROUPS[group].default_value
> +		};
> +		err = snd_pioneer_djm_controls_update(mixer, group, SND_PIONEER_DJM_OPTION_GROUPS[group].default_value);
> +		if (err) return err;
> +		err = add_single_ctl_with_resume(mixer, 0, snd_pioneer_djm_controls_resume, &knew, NULL);
> +		if (err) return err;
> +	}
> +	return 0;
> +}
> +
>  int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
>  {
>  	int err = 0;
> @@ -2706,6 +2897,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
>  	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
>  		err = snd_bbfpro_controls_create(mixer);
>  		break;
> +	case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
> +		err = snd_pioneer_djm_controls_create(mixer);
> +		break;
>  	}
>  
>  	return err;
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
@ 2020-09-21 16:16 František Kučera
  2020-09-21 16:36 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: František Kučera @ 2020-09-21 16:16 UTC (permalink / raw)
  To: alsa-devel, Takashi Iwai, František Kučera,
	Dmitry Panchenko, Fabian Lesniak

From: František Kučera <franta-linux@frantovo.cz>

This patch extends support for DJM-250MK2 and allows mapping
playback and capture channels to available sources.
Configures the card through USB commands.
---
 sound/usb/mixer_quirks.c | 194 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 194 insertions(+)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 199cdbfdc761..f2aeb5ac3611 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2602,6 +2602,197 @@ static int snd_bbfpro_controls_create(struct usb_mixer_interface *mixer)
 	return 0;
 }
 
+/*
+ * Pioneer DJ DJM-250MK2 and maybe other DJM models
+ * 
+ * For playback, no duplicate mapping should be set.
+ * There are three mixer stereo channels (CH1, CH2, AUX) and three stereo sources (PLAYBACK 1-2, PLAYBACK 3-4, PLAYBACK 5-6).
+ * Each channel should be mapped just once to one source.
+ * If mapped multiple times, only one source will play on given channel (sources are not mixed together).
+ * 
+ * For recording, duplicate mapping is OK. We will get the same signal multiple times.
+ * 
+ * Channels 7-8 are in both directions fixed to FX SEND / FX RETURN.
+ * 
+ * See also notes in the quirks-table.h file.
+ */
+
+typedef struct {
+	const u16 wIndex;
+	const u16 wValue;
+	const char *name;
+} snd_pioneer_djm_option;
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_LEVEL[] = {
+	{ .name =  "-5 dB",                  .wValue = 0x0300, .wIndex = 0x8003 },
+	{ .name = "-10 dB",                  .wValue = 0x0200, .wIndex = 0x8003 },
+	{ .name = "-15 dB",                  .wValue = 0x0100, .wIndex = 0x8003 },
+	{ .name = "-19 dB",                  .wValue = 0x0000, .wIndex = 0x8003 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH12[] = {
+	{ .name =  "CH1 Control Tone PHONO", .wValue = 0x0103, .wIndex = 0x8002 },
+	{ .name =  "CH1 Control Tone LINE",  .wValue = 0x0100, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0106, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0107, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0108, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0109, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x010d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x010a, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH34[] = {
+	{ .name =  "CH2 Control Tone PHONO", .wValue = 0x0203, .wIndex = 0x8002 },
+	{ .name =  "CH2 Control Tone LINE",  .wValue = 0x0200, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0206, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0207, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0208, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0209, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x020d, .wIndex = 0x8002 },
+	{ .name =  "REC OUT",                .wValue = 0x020a, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_CAPTURE_CH56[] = {
+	{ .name =  "REC OUT",                .wValue = 0x030a, .wIndex = 0x8002 },
+	{ .name =  "Post CH1 Fader",         .wValue = 0x0311, .wIndex = 0x8002 },
+	{ .name =  "Post CH2 Fader",         .wValue = 0x0312, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader A",          .wValue = 0x0307, .wIndex = 0x8002 },
+	{ .name =  "Cross Fader B",          .wValue = 0x0308, .wIndex = 0x8002 },
+	{ .name =  "MIC",                    .wValue = 0x0309, .wIndex = 0x8002 },
+	{ .name =  "AUX",                    .wValue = 0x030d, .wIndex = 0x8002 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_12[] = {
+	{ .name =  "CH1",                    .wValue = 0x0100, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0101, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0104, .wIndex = 0x8016 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_34[] = {
+	{ .name =  "CH1",                    .wValue = 0x0200, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0201, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0204, .wIndex = 0x8016 }
+};
+
+static const snd_pioneer_djm_option SND_PIONEER_DJM_OPTIONS_PLAYBACK_56[] = {
+	{ .name =  "CH1",                    .wValue = 0x0300, .wIndex = 0x8016 },
+	{ .name =  "CH2",                    .wValue = 0x0301, .wIndex = 0x8016 },
+	{ .name =  "AUX",                    .wValue = 0x0304, .wIndex = 0x8016 }
+};
+
+typedef struct {
+	const char *name;
+	const snd_pioneer_djm_option *options;
+	const size_t count;
+	const u16 default_value;
+} snd_pioneer_djm_option_group;
+
+#define SND_PIONEER_DJM_OPTION_GROUP_ITEM(_name, suffix, _default_value) \
+	{ .name = _name, .options = SND_PIONEER_DJM_OPTIONS_##suffix, .count = ARRAY_SIZE(SND_PIONEER_DJM_OPTIONS_##suffix), .default_value = _default_value }
+
+static const snd_pioneer_djm_option_group SND_PIONEER_DJM_OPTION_GROUPS[] = {
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Master Capture Level Capture Switch",  CAPTURE_LEVEL,  0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 1-2 Capture Switch",           CAPTURE_CH12,   2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 3-4 Capture Switch",           CAPTURE_CH34,   2),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Capture 5-6 Capture Switch",           CAPTURE_CH56,   0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 1-2 Playback Switch",         PLAYBACK_12,    0),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 3-4 Playback Switch",         PLAYBACK_34,    1),
+	SND_PIONEER_DJM_OPTION_GROUP_ITEM("Playback 5-6 Playback Switch",         PLAYBACK_56,    2)
+};
+
+// layout of the kcontrol->private_value:
+#define SND_PIONEER_DJM_VALUE_MASK 0x0000ffff
+#define SND_PIONEER_DJM_GROUP_MASK 0xffff0000
+#define SND_PIONEER_DJM_GROUP_SHIFT 16
+
+static int snd_pioneer_djm_controls_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *info) 
+{
+	u16 group = kcontrol->private_value >> SND_PIONEER_DJM_GROUP_SHIFT;
+	size_t count;
+	const char *name;
+	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS)) {
+		count = SND_PIONEER_DJM_OPTION_GROUPS[group].count;
+		if (info->value.enumerated.item >= count) info->value.enumerated.item = count - 1;
+		name = SND_PIONEER_DJM_OPTION_GROUPS[group].options[info->value.enumerated.item].name;
+		strlcpy(info->value.enumerated.name, name, sizeof (info->value.enumerated.name));
+		info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+		info->count = 1;
+		info->value.enumerated.items = count;
+		return 0;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_update(struct usb_mixer_interface *mixer, u16 group, u16 value)
+{
+	int err;
+	if (group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS) && value < SND_PIONEER_DJM_OPTION_GROUPS[group].count) {
+		err = snd_usb_lock_shutdown(mixer->chip);
+		if (err) return err;
+		
+		err = snd_usb_ctl_msg(
+			mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
+			USB_REQ_SET_FEATURE,
+			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wValue,
+			SND_PIONEER_DJM_OPTION_GROUPS[group].options[value].wIndex,
+			NULL, 0);
+		
+		snd_usb_unlock_shutdown(mixer->chip);
+		return err;
+	} else {
+		return -EINVAL;
+	}
+}
+
+static int snd_pioneer_djm_controls_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+	ucontrol->value.enumerated.item[0] = kcontrol->private_value & SND_PIONEER_DJM_VALUE_MASK;
+	return 0;
+}
+
+static int snd_pioneer_djm_controls_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+	struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol);
+	struct usb_mixer_interface *mixer = list->mixer;
+	
+	u16 group = (kcontrol->private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = ucontrol->value.enumerated.item[0];
+	kcontrol->private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | value;
+	
+	return snd_pioneer_djm_controls_update(mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_resume(struct usb_mixer_elem_list *list)
+{
+	u16 group = (list->kctl->private_value & SND_PIONEER_DJM_GROUP_MASK) >> SND_PIONEER_DJM_GROUP_SHIFT;
+	u16 value = (list->kctl->private_value & SND_PIONEER_DJM_VALUE_MASK);
+	return snd_pioneer_djm_controls_update(list->mixer, group, value);
+}
+
+static int snd_pioneer_djm_controls_create(struct usb_mixer_interface *mixer)
+{
+	int err, group;
+	for (group = 0; group < ARRAY_SIZE(SND_PIONEER_DJM_OPTION_GROUPS); group++ ) {
+		struct snd_kcontrol_new knew = {
+			.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
+			.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+			.index = 0,
+			.info = snd_pioneer_djm_controls_info,
+			.get  = snd_pioneer_djm_controls_get,
+			.put  = snd_pioneer_djm_controls_put,
+			.name = SND_PIONEER_DJM_OPTION_GROUPS[group].name,
+			.private_value = group << SND_PIONEER_DJM_GROUP_SHIFT | SND_PIONEER_DJM_OPTION_GROUPS[group].default_value
+		};
+		err = snd_pioneer_djm_controls_update(mixer, group, SND_PIONEER_DJM_OPTION_GROUPS[group].default_value);
+		if (err) return err;
+		err = add_single_ctl_with_resume(mixer, 0, snd_pioneer_djm_controls_resume, &knew, NULL);
+		if (err) return err;
+	}
+	return 0;
+}
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -2706,6 +2897,9 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
 		err = snd_bbfpro_controls_create(mixer);
 		break;
+	case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
+		err = snd_pioneer_djm_controls_create(mixer);
+		break;
 	}
 
 	return err;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-23 12:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 19:09 [PATCH] ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2 František Kučera
2020-09-22 10:02 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2020-09-22 14:42 František Kučera
2020-09-23 12:44 ` Takashi Iwai
2020-09-21 18:20 František Kučera
2020-09-21 16:16 František Kučera
2020-09-21 16:36 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).