Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63978ab3 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai
Browse files

sound: add Edirol UA-101 support



Add experimental support for the Edirol UA-101 audio/MIDI interface.

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0d64b568
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1791,6 +1791,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.

    The power-management is supported.

  Module snd-ua101
  ----------------

    Module for the Edirol UA-101 audio/MIDI interface.

    This module supports multiple devices, autoprobe and hotplugging.

  Module snd-usb-audio
  --------------------

+12 −0
Original line number Diff line number Diff line
@@ -21,6 +21,18 @@ config SND_USB_AUDIO
	  To compile this driver as a module, choose M here: the module
	  will be called snd-usb-audio.

config SND_USB_UA101
	tristate "Edirol UA-101 driver (EXPERIMENTAL)"
	depends on EXPERIMENTAL
	select SND_PCM
	select SND_RAWMIDI
	help
	  Say Y here to include support for the Edirol UA-101 audio/MIDI
	  interface.

	  To compile this driver as a module, choose M here: the module
	  will be called snd-ua101.

config SND_USB_USX2Y
	tristate "Tascam US-122, US-224 and US-428 USB driver"
	depends on X86 || PPC || ALPHA
+2 −0
Original line number Diff line number Diff line
@@ -4,9 +4,11 @@

snd-usb-audio-objs := usbaudio.o usbmixer.o
snd-usb-lib-objs := usbmidi.o
snd-ua101-objs := ua101.o

# Toplevel Module Dependency
obj-$(CONFIG_SND_USB_AUDIO) += snd-usb-audio.o snd-usb-lib.o
obj-$(CONFIG_SND_USB_UA101) += snd-ua101.o snd-usb-lib.o
obj-$(CONFIG_SND_USB_USX2Y) += snd-usb-lib.o
obj-$(CONFIG_SND_USB_US122L) += snd-usb-lib.o

sound/usb/ua101.c

0 → 100644
+1457 −0

File added.

Preview size limit exceeded, changes collapsed.

+0 −54
Original line number Diff line number Diff line
@@ -3142,59 +3142,6 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip,
	return 0;
}

/*
 * Create a stream for an Edirol UA-101 interface.
 * Copy, paste and modify from Edirol UA-1000
 */
static int create_ua101_quirk(struct snd_usb_audio *chip,
			       struct usb_interface *iface,
			       const struct snd_usb_audio_quirk *quirk)
{
	static const struct audioformat ua101_format = {
		.format = SNDRV_PCM_FORMAT_S32_LE,
		.fmt_type = USB_FORMAT_TYPE_I,
		.altsetting = 1,
		.altset_idx = 1,
		.attributes = 0,
		.rates = SNDRV_PCM_RATE_CONTINUOUS,
	};
	struct usb_host_interface *alts;
	struct usb_interface_descriptor *altsd;
	struct audioformat *fp;
	int stream, err;

	if (iface->num_altsetting != 2)
		return -ENXIO;
	alts = &iface->altsetting[1];
	altsd = get_iface_desc(alts);
	if (alts->extralen != 18 || alts->extra[1] != USB_DT_CS_INTERFACE ||
	    altsd->bNumEndpoints != 1)
		return -ENXIO;

	fp = kmemdup(&ua101_format, sizeof(*fp), GFP_KERNEL);
	if (!fp)
		return -ENOMEM;

	fp->channels = alts->extra[11];
	fp->iface = altsd->bInterfaceNumber;
	fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
	fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
	fp->datainterval = parse_datainterval(chip, alts);
	fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
	fp->rate_max = fp->rate_min = combine_triple(&alts->extra[15]);

	stream = (fp->endpoint & USB_DIR_IN)
		? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
	err = add_audio_endpoint(chip, stream, fp);
	if (err < 0) {
		kfree(fp);
		return err;
	}
	/* FIXME: playback must be synchronized to capture */
	usb_set_interface(chip->dev, fp->iface, 0);
	return 0;
}

static int snd_usb_create_quirk(struct snd_usb_audio *chip,
				struct usb_interface *iface,
				const struct snd_usb_audio_quirk *quirk);
@@ -3406,7 +3353,6 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip,
		[QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
		[QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
		[QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk,
		[QUIRK_AUDIO_EDIROL_UA101] = create_ua101_quirk,
		[QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk
	};

Loading