aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorKristian Amlie <kristian@amlie.name>2011-08-26 07:19:49 -0400
committerTakashi Iwai <tiwai@suse.de>2011-08-26 08:12:34 -0400
commit1ef0e0a05345b7411bdabbfca27f58bd33dcc7c8 (patch)
tree84e8816d89a6918411226c3f58501db59cd0b924 /sound/usb
parent391e69143d0a05f960e3ab39a8c26b7b230bb8a9 (diff)
ALSA: usb-audio: add Starr Labs USB MIDI support
Add support for Starr Labs USB MIDI devices such as the Z7S, which are based on an FTDI serial UART chip. Based on a patch by Daniel Mack. Signed-off-by: Kristian Amlie <kristian@amlie.name> Acked-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/midi.c27
-rw-r--r--sound/usb/quirks-table.h11
-rw-r--r--sound/usb/quirks.c1
-rw-r--r--sound/usb/usbaudio.h1
4 files changed, 40 insertions, 0 deletions
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index f9289102886a..e21f026d9577 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -816,6 +816,22 @@ static struct usb_protocol_ops snd_usbmidi_raw_ops = {
816 .output = snd_usbmidi_raw_output, 816 .output = snd_usbmidi_raw_output,
817}; 817};
818 818
819/*
820 * FTDI protocol: raw MIDI bytes, but input packets have two modem status bytes.
821 */
822
823static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint* ep,
824 uint8_t* buffer, int buffer_length)
825{
826 if (buffer_length > 2)
827 snd_usbmidi_input_data(ep, 0, buffer + 2, buffer_length - 2);
828}
829
830static struct usb_protocol_ops snd_usbmidi_ftdi_ops = {
831 .input = snd_usbmidi_ftdi_input,
832 .output = snd_usbmidi_raw_output,
833};
834
819static void snd_usbmidi_us122l_input(struct snd_usb_midi_in_endpoint *ep, 835static void snd_usbmidi_us122l_input(struct snd_usb_midi_in_endpoint *ep,
820 uint8_t *buffer, int buffer_length) 836 uint8_t *buffer, int buffer_length)
821{ 837{
@@ -2163,6 +2179,17 @@ int snd_usbmidi_create(struct snd_card *card,
2163 /* endpoint 1 is input-only */ 2179 /* endpoint 1 is input-only */
2164 endpoints[1].out_cables = 0; 2180 endpoints[1].out_cables = 0;
2165 break; 2181 break;
2182 case QUIRK_MIDI_FTDI:
2183 umidi->usb_protocol_ops = &snd_usbmidi_ftdi_ops;
2184
2185 /* set baud rate to 31250 (48 MHz / 16 / 96) */
2186 err = usb_control_msg(umidi->dev, usb_sndctrlpipe(umidi->dev, 0),
2187 3, 0x40, 0x60, 0, NULL, 0, 1000);
2188 if (err < 0)
2189 break;
2190
2191 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2192 break;
2166 default: 2193 default:
2167 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); 2194 snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type);
2168 err = -ENXIO; 2195 err = -ENXIO;
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index a42e3ef3832d..da898229bb11 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -39,6 +39,17 @@
39 .idProduct = prod, \ 39 .idProduct = prod, \
40 .bInterfaceClass = USB_CLASS_VENDOR_SPEC 40 .bInterfaceClass = USB_CLASS_VENDOR_SPEC
41 41
42/* FTDI devices */
43{
44 USB_DEVICE(0x0403, 0xb8d8),
45 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
46 /* .vendor_name = "STARR LABS", */
47 /* .product_name = "Starr Labs MIDI USB device", */
48 .ifnum = 0,
49 .type = QUIRK_MIDI_FTDI
50 }
51},
52
42/* Creative/Toshiba Multimedia Center SB-0500 */ 53/* Creative/Toshiba Multimedia Center SB-0500 */
43{ 54{
44 USB_DEVICE(0x041e, 0x3048), 55 USB_DEVICE(0x041e, 0x3048),
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 81e07d842581..cf61b0340026 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -306,6 +306,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
306 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, 306 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk,
307 [QUIRK_MIDI_CME] = create_any_midi_quirk, 307 [QUIRK_MIDI_CME] = create_any_midi_quirk,
308 [QUIRK_MIDI_AKAI] = create_any_midi_quirk, 308 [QUIRK_MIDI_AKAI] = create_any_midi_quirk,
309 [QUIRK_MIDI_FTDI] = create_any_midi_quirk,
309 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, 310 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
310 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 311 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
311 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 312 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 1e79986b5777..3e2b03577936 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -80,6 +80,7 @@ enum quirk_type {
80 QUIRK_MIDI_CME, 80 QUIRK_MIDI_CME,
81 QUIRK_MIDI_AKAI, 81 QUIRK_MIDI_AKAI,
82 QUIRK_MIDI_US122L, 82 QUIRK_MIDI_US122L,
83 QUIRK_MIDI_FTDI,
83 QUIRK_AUDIO_STANDARD_INTERFACE, 84 QUIRK_AUDIO_STANDARD_INTERFACE,
84 QUIRK_AUDIO_FIXED_ENDPOINT, 85 QUIRK_AUDIO_FIXED_ENDPOINT,
85 QUIRK_AUDIO_EDIROL_UAXX, 86 QUIRK_AUDIO_EDIROL_UAXX,