Skip to content

Commit

Permalink
ALSA: Add USB US122L driver
Browse files Browse the repository at this point in the history
Added a new US122L usb-audio driver.  This driver works together with a
dedicated alsa-lib plugin.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
Karsten Wiese authored and perexg committed Aug 1, 2008
1 parent 896e6cc commit 030a07e
Show file tree
Hide file tree
Showing 10 changed files with 1,648 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/sound/asound.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ enum {
SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */

/* Don't forget to change the following: */
SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_HDA
SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
};

struct snd_hwdep_info {
Expand Down
11 changes: 11 additions & 0 deletions sound/usb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,16 @@ config SND_USB_CAIAQ_INPUT
* Native Instruments Kore Controller 2
* Native Instruments Audio Kontrol 1

config SND_USB_US122L
tristate "Tascam US-122L USB driver"
depends on X86 && EXPERIMENTAL
select SND_RAWMIDI
help
Say Y here to include support for Tascam US-122L USB Audio/MIDI
interfaces.

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

endif # SND_USB

1 change: 1 addition & 0 deletions sound/usb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ snd-usb-lib-objs := usbmidi.o
# Toplevel Module Dependency
obj-$(CONFIG_SND_USB_AUDIO) += snd-usb-audio.o snd-usb-lib.o
obj-$(CONFIG_SND_USB_USX2Y) += snd-usb-lib.o
obj-$(CONFIG_SND_USB_US122L) += snd-usb-lib.o

obj-$(CONFIG_SND) += usx2y/ caiaq/
1 change: 1 addition & 0 deletions sound/usb/usbaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ enum quirk_type {
QUIRK_MIDI_RAW,
QUIRK_MIDI_EMAGIC,
QUIRK_MIDI_CME,
QUIRK_MIDI_US122L,
QUIRK_AUDIO_STANDARD_INTERFACE,
QUIRK_AUDIO_FIXED_ENDPOINT,
QUIRK_AUDIO_EDIROL_UA700_UA25,
Expand Down
39 changes: 39 additions & 0 deletions sound/usb/usbmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,42 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = {
.output = snd_usbmidi_raw_output,
};

static void snd_usbmidi_us122l_input(struct snd_usb_midi_in_endpoint *ep,
uint8_t *buffer, int buffer_length)
{
if (buffer_length != 9)
return;
buffer_length = 8;
while (buffer_length && buffer[buffer_length - 1] == 0xFD)
buffer_length--;
if (buffer_length)
snd_usbmidi_input_data(ep, 0, buffer, buffer_length);
}

static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep)
{
int count;

if (!ep->ports[0].active)
return;
count = ep->urb->dev->speed == USB_SPEED_HIGH ? 1 : 2;
count = snd_rawmidi_transmit(ep->ports[0].substream,
ep->urb->transfer_buffer,
count);
if (count < 1) {
ep->ports[0].active = 0;
return;
}

memset(ep->urb->transfer_buffer + count, 0xFD, 9 - count);
ep->urb->transfer_buffer_length = count;
}

static struct usb_protocol_ops snd_usbmidi_122l_ops = {
.input = snd_usbmidi_us122l_input,
.output = snd_usbmidi_us122l_output,
};

/*
* Emagic USB MIDI protocol: raw MIDI with "F5 xx" port switching.
*/
Expand Down Expand Up @@ -1714,6 +1750,9 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip,
umidi->usb_protocol_ops =
&snd_usbmidi_maudio_broken_running_status_ops;
break;
case QUIRK_MIDI_US122L:
umidi->usb_protocol_ops = &snd_usbmidi_122l_ops;
/* fall through */
case QUIRK_MIDI_FIXED_ENDPOINT:
memcpy(&endpoints[0], quirk->data,
sizeof(struct snd_usb_midi_endpoint_info));
Expand Down
2 changes: 2 additions & 0 deletions sound/usb/usx2y/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
snd-usb-usx2y-objs := usbusx2y.o usX2Yhwdep.o usx2yhwdeppcm.o
snd-usb-us122l-objs := us122l.o

obj-$(CONFIG_SND_USB_USX2Y) += snd-usb-usx2y.o
obj-$(CONFIG_SND_USB_US122L) += snd-usb-us122l.o
Loading

0 comments on commit 030a07e

Please sign in to comment.