Skip to contentSkip to conversation

Digidesign Mbox 1 clock source and duplex mode

PATCH Superseded [email protected] 1 participant 3 messages Nov 9, 2014 Sound

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover Digidesign Mbox 1 clock source and duplex mode

From: Damien Zammit <[email protected]>

This is a cleaned up patchset version 2.

Damien Zammit (2):
ALSA: usb-audio: Add mixer control for Digidesign mbox 1 clock source
ALSA: usb-audio: Add duplex mode for Digidesign Mbox 1 and enable
mixer

 sound/usb/card.h         |   5 ++
 sound/usb/mixer_maps.c   |   9 ++++
 sound/usb/mixer_quirks.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++
 sound/usb/quirks-table.h |  73 +++++++++++++++++---------
 sound/usb/quirks.c       |  30 +++++++++++
 sound/usb/usbaudio.h     |   1 +
 6 files changed, 227 insertions(+), 24 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 ALSA: usb-audio: Add mixer control for Digidesign mbox 1 clock source

From: Damien Zammit <[email protected]>

This patch provides the infrastructure for the Digidesign Mbox 1 to have a mixer control for selecting the clock source. Valid options are Internal and S/PDIF external sync.

---
 sound/usb/mixer_maps.c   |   9 ++++
 sound/usb/mixer_quirks.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 142 insertions(+)
sound/usb/mixer_maps.c +9 -0
index d1d72ff..1994d41 100644
@@ -179,6 +179,11 @@ static struct usbmix_name_map audigy2nx_map[] = {
 	{ 0 } /* terminator */
 };
 
+static struct usbmix_name_map mbox1_map[] = {
+	{ 1, "Clock" },
+	{ 0 } /* terminator */
+};
+
 static struct usbmix_selector_map c400_selectors[] = {
 	{
 		.id = 0x80,
@@ -416,6 +421,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
 		.map = aureon_51_2_map,
 	},
 	{
+		.id = USB_ID(0x0dba, 0x1000),
+		.map = mbox1_map,
+	},
+	{
 		.id = USB_ID(0x13e5, 0x0001),
 		.map = scratch_live_map,
 		.ignore_ctl_error = 1,
sound/usb/mixer_quirks.c +133 -0

145 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 ALSA: usb-audio: Add duplex mode for Digidesign Mbox 1 and enable mixer

In reply to [email protected]

From: Damien Zammit <[email protected]>

This patch provides duplex support for the Digidesign Mbox 1 sound card and has been a work in progress for about a year.
Users have confirmed on my website that previous versions of this patch have worked on the hardware and I have been testing extensively.

It also enables the mixer control for providing clock source selector based on the previous patch.

The sample rate has been hardcoded to 48kHz because it works better with the S/PDIF sync mode when the sample rate is locked. This is the highest rate that the device supports and no loss of functionality is observed by restricting the sample rate.

---
 sound/usb/card.h         |  5 ++++
 sound/usb/quirks-table.h | 73 ++++++++++++++++++++++++++++++++----------------
 sound/usb/quirks.c       | 30 ++++++++++++++++++++
 sound/usb/usbaudio.h     |  1 +
 4 files changed, 85 insertions(+), 24 deletions(-)
sound/usb/card.h +5 -0
index 97acb90..a8fe22f 100644
@@ -33,6 +33,11 @@ struct audioformat {
 	bool dsd_bitrev;		/* reverse the bits of each DSD sample */
 };
 
+struct audioformats {
+	unsigned int n_formats;
+	const struct audioformat *format;
+};
+
 struct snd_usb_substream;
 struct snd_usb_endpoint;
 
sound/usb/quirks-table.h +49 -24

92 lines not on this page · raw message

sound/usb/quirks.c +30 -0
index d2aa45a..90227cd 100644
@@ -180,6 +180,34 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
 	return 0;
 }
 
+/*
+ * create N streams for an interface without proper descriptors but with
+ * multiple endpoints
+ */
+static int create_fixed_multi_stream_quirk(struct snd_usb_audio *chip,
+				     struct usb_interface *iface,
+				     struct usb_driver *driver,
+				     const struct snd_usb_audio_quirk *quirk)
+{
+	struct audioformats *fp;
+	int i;
+
+	fp = kmemdup(quirk->data, sizeof(*fp), GFP_KERNEL);
+	if (!fp) {
+		usb_audio_err(chip, "cannot memdup\n");
+		return -ENOMEM;
+	}
+	for (i = 0; i < fp->n_formats; i++) {
+		struct snd_usb_audio_quirk nquirk = {
+			.ifnum = quirk->ifnum,
+			.type = QUIRK_AUDIO_FIXED_MULTI_ENDPOINT,
+			.data = (const struct audioformat *) &fp->format[i]
+		};
+		create_fixed_stream_quirk(chip, iface, driver, &nquirk);
+	}
+	return 0;
+}
+
 static int create_auto_pcm_quirk(struct snd_usb_audio *chip,
 				 struct usb_interface *iface,
 				 struct usb_driver *driver)
@@ -528,6 +556,8 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
 		[QUIRK_MIDI_FTDI] = create_any_midi_quirk,
 		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
 		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
+		[QUIRK_AUDIO_FIXED_MULTI_ENDPOINT] =
+			create_fixed_multi_stream_quirk,
 		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
 		[QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
 		[QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
sound/usb/usbaudio.h +1 -0
index 91d0380..31d8ff0 100644
@@ -96,6 +96,7 @@ enum quirk_type {
 	QUIRK_MIDI_FTDI,
 	QUIRK_AUDIO_STANDARD_INTERFACE,
 	QUIRK_AUDIO_FIXED_ENDPOINT,
+	QUIRK_AUDIO_FIXED_MULTI_ENDPOINT,
 	QUIRK_AUDIO_EDIROL_UAXX,
 	QUIRK_AUDIO_ALIGN_TRANSFER,
 	QUIRK_AUDIO_STANDARD_MIXER,
Signature · 1 line
1.9.1