aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-06-28 06:13:26 -0400
committerTakashi Iwai <tiwai@suse.de>2013-06-28 06:13:26 -0400
commitea70ee057cf373d45aab9b69370ce94a8b6a94b4 (patch)
tree45a92cdec4fc8fa9b1ec582f53b0a045e8bc3244 /sound/usb
parentad60d502fb8aaa3c1e011f4d72b8228f553d87a8 (diff)
parentb7f33917bcd993ff81f3f80b9dc1890fb7410c6d (diff)
Merge branch 'full-roland-support' of git://git.alsa-project.org/alsa-kprivate into for-next
For adding support for many Roland and Yamaha devices: * 'full-roland-support' of git://git.alsa-project.org/alsa-kprivate: ALSA: usb-audio: add quirks for Roland QUAD/OCTO-CAPTURE ALSA: usb-audio: claim autodetected PCM interfaces all at once ALSA: usb-audio: remove superfluous Roland quirks ALSA: usb-audio: add MIDI port names for some Roland devices ALSA: usb-audio: add support for many Roland/Yamaha devices ALSA: usb-audio: detect implicit feedback on Roland devices ALSA: usb-audio: store protocol version in struct audioformat
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/card.h1
-rw-r--r--sound/usb/clock.c4
-rw-r--r--sound/usb/format.c34
-rw-r--r--sound/usb/format.h2
-rw-r--r--sound/usb/midi.c74
-rw-r--r--sound/usb/pcm.c45
-rw-r--r--sound/usb/quirks-table.h497
-rw-r--r--sound/usb/quirks.c209
-rw-r--r--sound/usb/stream.c18
-rw-r--r--sound/usb/usbaudio.h2
10 files changed, 445 insertions, 441 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h
index bf2889a2cae5..5ecacaa90b53 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -21,6 +21,7 @@ struct audioformat {
21 unsigned char endpoint; /* endpoint */ 21 unsigned char endpoint; /* endpoint */
22 unsigned char ep_attr; /* endpoint attributes */ 22 unsigned char ep_attr; /* endpoint attributes */
23 unsigned char datainterval; /* log_2 of data packet interval */ 23 unsigned char datainterval; /* log_2 of data packet interval */
24 unsigned char protocol; /* UAC_VERSION_1/2 */
24 unsigned int maxpacksize; /* max. packet size */ 25 unsigned int maxpacksize; /* max. packet size */
25 unsigned int rates; /* rate bitmasks */ 26 unsigned int rates; /* rate bitmasks */
26 unsigned int rate_min, rate_max; /* min/max rates */ 27 unsigned int rate_min, rate_max; /* min/max rates */
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 3a2ce390e278..86f80c60b21f 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -407,9 +407,7 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
407 struct usb_host_interface *alts, 407 struct usb_host_interface *alts,
408 struct audioformat *fmt, int rate) 408 struct audioformat *fmt, int rate)
409{ 409{
410 struct usb_interface_descriptor *altsd = get_iface_desc(alts); 410 switch (fmt->protocol) {
411
412 switch (altsd->bInterfaceProtocol) {
413 case UAC_VERSION_1: 411 case UAC_VERSION_1:
414 default: 412 default:
415 return set_sample_rate_v1(chip, iface, alts, fmt, rate); 413 return set_sample_rate_v1(chip, iface, alts, fmt, rate);
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 99299ffb33ac..3525231c6b97 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -43,13 +43,12 @@
43 */ 43 */
44static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, 44static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
45 struct audioformat *fp, 45 struct audioformat *fp,
46 unsigned int format, void *_fmt, 46 unsigned int format, void *_fmt)
47 int protocol)
48{ 47{
49 int sample_width, sample_bytes; 48 int sample_width, sample_bytes;
50 u64 pcm_formats = 0; 49 u64 pcm_formats = 0;
51 50
52 switch (protocol) { 51 switch (fp->protocol) {
53 case UAC_VERSION_1: 52 case UAC_VERSION_1:
54 default: { 53 default: {
55 struct uac_format_type_i_discrete_descriptor *fmt = _fmt; 54 struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
@@ -360,11 +359,8 @@ err:
360 */ 359 */
361static int parse_audio_format_i(struct snd_usb_audio *chip, 360static int parse_audio_format_i(struct snd_usb_audio *chip,
362 struct audioformat *fp, unsigned int format, 361 struct audioformat *fp, unsigned int format,
363 struct uac_format_type_i_continuous_descriptor *fmt, 362 struct uac_format_type_i_continuous_descriptor *fmt)
364 struct usb_host_interface *iface)
365{ 363{
366 struct usb_interface_descriptor *altsd = get_iface_desc(iface);
367 int protocol = altsd->bInterfaceProtocol;
368 snd_pcm_format_t pcm_format; 364 snd_pcm_format_t pcm_format;
369 int ret; 365 int ret;
370 366
@@ -387,8 +383,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
387 } 383 }
388 fp->formats = pcm_format_to_bits(pcm_format); 384 fp->formats = pcm_format_to_bits(pcm_format);
389 } else { 385 } else {
390 fp->formats = parse_audio_format_i_type(chip, fp, format, 386 fp->formats = parse_audio_format_i_type(chip, fp, format, fmt);
391 fmt, protocol);
392 if (!fp->formats) 387 if (!fp->formats)
393 return -EINVAL; 388 return -EINVAL;
394 } 389 }
@@ -398,11 +393,8 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
398 * proprietary class specific descriptor. 393 * proprietary class specific descriptor.
399 * audio class v2 uses class specific EP0 range requests for that. 394 * audio class v2 uses class specific EP0 range requests for that.
400 */ 395 */
401 switch (protocol) { 396 switch (fp->protocol) {
402 default: 397 default:
403 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
404 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
405 /* fall through */
406 case UAC_VERSION_1: 398 case UAC_VERSION_1:
407 fp->channels = fmt->bNrChannels; 399 fp->channels = fmt->bNrChannels;
408 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); 400 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
@@ -427,12 +419,9 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
427 */ 419 */
428static int parse_audio_format_ii(struct snd_usb_audio *chip, 420static int parse_audio_format_ii(struct snd_usb_audio *chip,
429 struct audioformat *fp, 421 struct audioformat *fp,
430 int format, void *_fmt, 422 int format, void *_fmt)
431 struct usb_host_interface *iface)
432{ 423{
433 int brate, framesize, ret; 424 int brate, framesize, ret;
434 struct usb_interface_descriptor *altsd = get_iface_desc(iface);
435 int protocol = altsd->bInterfaceProtocol;
436 425
437 switch (format) { 426 switch (format) {
438 case UAC_FORMAT_TYPE_II_AC3: 427 case UAC_FORMAT_TYPE_II_AC3:
@@ -452,11 +441,8 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
452 441
453 fp->channels = 1; 442 fp->channels = 1;
454 443
455 switch (protocol) { 444 switch (fp->protocol) {
456 default: 445 default:
457 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
458 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
459 /* fall through */
460 case UAC_VERSION_1: { 446 case UAC_VERSION_1: {
461 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; 447 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
462 brate = le16_to_cpu(fmt->wMaxBitRate); 448 brate = le16_to_cpu(fmt->wMaxBitRate);
@@ -483,17 +469,17 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
483int snd_usb_parse_audio_format(struct snd_usb_audio *chip, 469int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
484 struct audioformat *fp, unsigned int format, 470 struct audioformat *fp, unsigned int format,
485 struct uac_format_type_i_continuous_descriptor *fmt, 471 struct uac_format_type_i_continuous_descriptor *fmt,
486 int stream, struct usb_host_interface *iface) 472 int stream)
487{ 473{
488 int err; 474 int err;
489 475
490 switch (fmt->bFormatType) { 476 switch (fmt->bFormatType) {
491 case UAC_FORMAT_TYPE_I: 477 case UAC_FORMAT_TYPE_I:
492 case UAC_FORMAT_TYPE_III: 478 case UAC_FORMAT_TYPE_III:
493 err = parse_audio_format_i(chip, fp, format, fmt, iface); 479 err = parse_audio_format_i(chip, fp, format, fmt);
494 break; 480 break;
495 case UAC_FORMAT_TYPE_II: 481 case UAC_FORMAT_TYPE_II:
496 err = parse_audio_format_ii(chip, fp, format, fmt, iface); 482 err = parse_audio_format_ii(chip, fp, format, fmt);
497 break; 483 break;
498 default: 484 default:
499 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", 485 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n",
diff --git a/sound/usb/format.h b/sound/usb/format.h
index 6f315226f320..4b8a01129f24 100644
--- a/sound/usb/format.h
+++ b/sound/usb/format.h
@@ -4,6 +4,6 @@
4int snd_usb_parse_audio_format(struct snd_usb_audio *chip, 4int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
5 struct audioformat *fp, unsigned int format, 5 struct audioformat *fp, unsigned int format,
6 struct uac_format_type_i_continuous_descriptor *fmt, 6 struct uac_format_type_i_continuous_descriptor *fmt,
7 int stream, struct usb_host_interface *iface); 7 int stream);
8 8
9#endif /* __USBAUDIO_FORMAT_H */ 9#endif /* __USBAUDIO_FORMAT_H */
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 8e01fa4991c5..b901f468b67a 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -1575,8 +1575,41 @@ static struct port_info {
1575 EXTERNAL_PORT(0x0582, 0x004d, 0, "%s MIDI"), 1575 EXTERNAL_PORT(0x0582, 0x004d, 0, "%s MIDI"),
1576 EXTERNAL_PORT(0x0582, 0x004d, 1, "%s 1"), 1576 EXTERNAL_PORT(0x0582, 0x004d, 1, "%s 1"),
1577 EXTERNAL_PORT(0x0582, 0x004d, 2, "%s 2"), 1577 EXTERNAL_PORT(0x0582, 0x004d, 2, "%s 2"),
1578 /* BOSS GT-PRO */
1579 CONTROL_PORT(0x0582, 0x0089, 0, "%s Control"),
1578 /* Edirol UM-3EX */ 1580 /* Edirol UM-3EX */
1579 CONTROL_PORT(0x0582, 0x009a, 3, "%s Control"), 1581 CONTROL_PORT(0x0582, 0x009a, 3, "%s Control"),
1582 /* Roland VG-99 */
1583 CONTROL_PORT(0x0582, 0x00b2, 0, "%s Control"),
1584 EXTERNAL_PORT(0x0582, 0x00b2, 1, "%s MIDI"),
1585 /* Cakewalk Sonar V-Studio 100 */
1586 EXTERNAL_PORT(0x0582, 0x00eb, 0, "%s MIDI"),
1587 CONTROL_PORT(0x0582, 0x00eb, 1, "%s Control"),
1588 /* Roland VB-99 */
1589 CONTROL_PORT(0x0582, 0x0102, 0, "%s Control"),
1590 EXTERNAL_PORT(0x0582, 0x0102, 1, "%s MIDI"),
1591 /* Roland A-PRO */
1592 EXTERNAL_PORT(0x0582, 0x010f, 0, "%s MIDI"),
1593 CONTROL_PORT(0x0582, 0x010f, 1, "%s 1"),
1594 CONTROL_PORT(0x0582, 0x010f, 2, "%s 2"),
1595 /* Roland SD-50 */
1596 ROLAND_SYNTH_PORT(0x0582, 0x0114, 0, "%s Synth", 128),
1597 EXTERNAL_PORT(0x0582, 0x0114, 1, "%s MIDI"),
1598 CONTROL_PORT(0x0582, 0x0114, 2, "%s Control"),
1599 /* Roland OCTA-CAPTURE */
1600 EXTERNAL_PORT(0x0582, 0x0120, 0, "%s MIDI"),
1601 CONTROL_PORT(0x0582, 0x0120, 1, "%s Control"),
1602 EXTERNAL_PORT(0x0582, 0x0121, 0, "%s MIDI"),
1603 CONTROL_PORT(0x0582, 0x0121, 1, "%s Control"),
1604 /* Roland SPD-SX */
1605 CONTROL_PORT(0x0582, 0x0145, 0, "%s Control"),
1606 EXTERNAL_PORT(0x0582, 0x0145, 1, "%s MIDI"),
1607 /* Roland A-Series */
1608 CONTROL_PORT(0x0582, 0x0156, 0, "%s Keyboard"),
1609 EXTERNAL_PORT(0x0582, 0x0156, 1, "%s MIDI"),
1610 /* Roland INTEGRA-7 */
1611 ROLAND_SYNTH_PORT(0x0582, 0x015b, 0, "%s Synth", 128),
1612 CONTROL_PORT(0x0582, 0x015b, 1, "%s Control"),
1580 /* M-Audio MidiSport 8x8 */ 1613 /* M-Audio MidiSport 8x8 */
1581 CONTROL_PORT(0x0763, 0x1031, 8, "%s Control"), 1614 CONTROL_PORT(0x0763, 0x1031, 8, "%s Control"),
1582 CONTROL_PORT(0x0763, 0x1033, 8, "%s Control"), 1615 CONTROL_PORT(0x0763, 0x1033, 8, "%s Control"),
@@ -1948,6 +1981,44 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi,
1948} 1981}
1949 1982
1950/* 1983/*
1984 * Detects the endpoints and ports of Roland devices.
1985 */
1986static int snd_usbmidi_detect_roland(struct snd_usb_midi* umidi,
1987 struct snd_usb_midi_endpoint_info* endpoint)
1988{
1989 struct usb_interface* intf;
1990 struct usb_host_interface *hostif;
1991 u8* cs_desc;
1992
1993 intf = umidi->iface;
1994 if (!intf)
1995 return -ENOENT;
1996 hostif = intf->altsetting;
1997 /*
1998 * Some devices have a descriptor <06 24 F1 02 <inputs> <outputs>>,
1999 * some have standard class descriptors, or both kinds, or neither.
2000 */
2001 for (cs_desc = hostif->extra;
2002 cs_desc < hostif->extra + hostif->extralen && cs_desc[0] >= 2;
2003 cs_desc += cs_desc[0]) {
2004 if (cs_desc[0] >= 6 &&
2005 cs_desc[1] == USB_DT_CS_INTERFACE &&
2006 cs_desc[2] == 0xf1 &&
2007 cs_desc[3] == 0x02) {
2008 endpoint->in_cables = (1 << cs_desc[4]) - 1;
2009 endpoint->out_cables = (1 << cs_desc[5]) - 1;
2010 return snd_usbmidi_detect_endpoints(umidi, endpoint, 1);
2011 } else if (cs_desc[0] >= 7 &&
2012 cs_desc[1] == USB_DT_CS_INTERFACE &&
2013 cs_desc[2] == UAC_HEADER) {
2014 return snd_usbmidi_get_ms_info(umidi, endpoint);
2015 }
2016 }
2017
2018 return -ENODEV;
2019}
2020
2021/*
1951 * Creates the endpoints and their ports for Midiman devices. 2022 * Creates the endpoints and their ports for Midiman devices.
1952 */ 2023 */
1953static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, 2024static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
@@ -2162,6 +2233,9 @@ int snd_usbmidi_create(struct snd_card *card,
2162 case QUIRK_MIDI_YAMAHA: 2233 case QUIRK_MIDI_YAMAHA:
2163 err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]); 2234 err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]);
2164 break; 2235 break;
2236 case QUIRK_MIDI_ROLAND:
2237 err = snd_usbmidi_detect_roland(umidi, &endpoints[0]);
2238 break;
2165 case QUIRK_MIDI_MIDIMAN: 2239 case QUIRK_MIDI_MIDIMAN:
2166 umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; 2240 umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops;
2167 memcpy(&endpoints[0], quirk->data, 2241 memcpy(&endpoints[0], quirk->data,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 93b6e32cfead..15b151ed4899 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -202,13 +202,11 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
202 struct usb_host_interface *alts, 202 struct usb_host_interface *alts,
203 struct audioformat *fmt) 203 struct audioformat *fmt)
204{ 204{
205 struct usb_interface_descriptor *altsd = get_iface_desc(alts);
206
207 /* if endpoint doesn't have pitch control, bail out */ 205 /* if endpoint doesn't have pitch control, bail out */
208 if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL)) 206 if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL))
209 return 0; 207 return 0;
210 208
211 switch (altsd->bInterfaceProtocol) { 209 switch (fmt->protocol) {
212 case UAC_VERSION_1: 210 case UAC_VERSION_1:
213 default: 211 default:
214 return init_pitch_v1(chip, iface, alts, fmt); 212 return init_pitch_v1(chip, iface, alts, fmt);
@@ -300,6 +298,35 @@ static int deactivate_endpoints(struct snd_usb_substream *subs)
300 return 0; 298 return 0;
301} 299}
302 300
301static int search_roland_implicit_fb(struct usb_device *dev, int ifnum,
302 unsigned int altsetting,
303 struct usb_host_interface **alts,
304 unsigned int *ep)
305{
306 struct usb_interface *iface;
307 struct usb_interface_descriptor *altsd;
308 struct usb_endpoint_descriptor *epd;
309
310 iface = usb_ifnum_to_if(dev, ifnum);
311 if (!iface || iface->num_altsetting < altsetting + 1)
312 return -ENOENT;
313 *alts = &iface->altsetting[altsetting];
314 altsd = get_iface_desc(*alts);
315 if (altsd->bAlternateSetting != altsetting ||
316 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC ||
317 (altsd->bInterfaceSubClass != 2 &&
318 altsd->bInterfaceProtocol != 2 ) ||
319 altsd->bNumEndpoints < 1)
320 return -ENOENT;
321 epd = get_endpoint(*alts, 0);
322 if (!usb_endpoint_is_isoc_in(epd) ||
323 (epd->bmAttributes & USB_ENDPOINT_USAGE_MASK) !=
324 USB_ENDPOINT_USAGE_IMPLICIT_FB)
325 return -ENOENT;
326 *ep = epd->bEndpointAddress;
327 return 0;
328}
329
303/* 330/*
304 * find a matching format and set up the interface 331 * find a matching format and set up the interface
305 */ 332 */
@@ -395,6 +422,18 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
395 goto add_sync_ep; 422 goto add_sync_ep;
396 } 423 }
397 } 424 }
425 if (is_playback &&
426 attr == USB_ENDPOINT_SYNC_ASYNC &&
427 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
428 altsd->bInterfaceProtocol == 2 &&
429 altsd->bNumEndpoints == 1 &&
430 USB_ID_VENDOR(subs->stream->chip->usb_id) == 0x0582 /* Roland */ &&
431 search_roland_implicit_fb(dev, altsd->bInterfaceNumber + 1,
432 altsd->bAlternateSetting,
433 &alts, &ep) >= 0) {
434 implicit_fb = 1;
435 goto add_sync_ep;
436 }
398 437
399 if (((is_playback && attr == USB_ENDPOINT_SYNC_ASYNC) || 438 if (((is_playback && attr == USB_ENDPOINT_SYNC_ASYNC) ||
400 (!is_playback && attr == USB_ENDPOINT_SYNC_ADAPTIVE)) && 439 (!is_playback && attr == USB_ENDPOINT_SYNC_ADAPTIVE)) &&
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 8b75bcf136f6..9c636c2d99f6 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -461,6 +461,17 @@ YAMAHA_DEVICE(0x7000, "DTX"),
461YAMAHA_DEVICE(0x7010, "UB99"), 461YAMAHA_DEVICE(0x7010, "UB99"),
462#undef YAMAHA_DEVICE 462#undef YAMAHA_DEVICE
463#undef YAMAHA_INTERFACE 463#undef YAMAHA_INTERFACE
464/* this catches most recent vendor-specific Yamaha devices */
465{
466 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
467 USB_DEVICE_ID_MATCH_INT_CLASS,
468 .idVendor = 0x0499,
469 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
470 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
471 .ifnum = QUIRK_ANY_INTERFACE,
472 .type = QUIRK_AUTODETECT
473 }
474},
464 475
465/* 476/*
466 * Roland/RolandED/Edirol/BOSS devices 477 * Roland/RolandED/Edirol/BOSS devices
@@ -1136,7 +1147,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1136 } 1147 }
1137 } 1148 }
1138}, 1149},
1139 /* TODO: add Roland M-1000 support */
1140{ 1150{
1141 /* 1151 /*
1142 * Has ID 0x0038 when not in "Advanced Driver" mode; 1152 * Has ID 0x0038 when not in "Advanced Driver" mode;
@@ -1251,7 +1261,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1251 } 1261 }
1252 } 1262 }
1253}, 1263},
1254 /* TODO: add Edirol M-100FX support */
1255{ 1264{
1256 /* has ID 0x004e when not in "Advanced Driver" mode */ 1265 /* has ID 0x004e when not in "Advanced Driver" mode */
1257 USB_DEVICE(0x0582, 0x004c), 1266 USB_DEVICE(0x0582, 0x004c),
@@ -1371,20 +1380,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1371 } 1380 }
1372}, 1381},
1373{ 1382{
1374 /* has ID 0x006b when not in "Advanced Driver" mode */
1375 USB_DEVICE_VENDOR_SPEC(0x0582, 0x006a),
1376 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1377 .vendor_name = "Roland",
1378 .product_name = "SP-606",
1379 .ifnum = 3,
1380 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1381 .data = & (const struct snd_usb_midi_endpoint_info) {
1382 .out_cables = 0x0001,
1383 .in_cables = 0x0001
1384 }
1385 }
1386},
1387{
1388 /* has ID 0x006e when not in "Advanced Driver" mode */ 1383 /* has ID 0x006e when not in "Advanced Driver" mode */
1389 USB_DEVICE(0x0582, 0x006d), 1384 USB_DEVICE(0x0582, 0x006d),
1390 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1385 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
@@ -1471,8 +1466,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1471 } 1466 }
1472 } 1467 }
1473}, 1468},
1474 /* TODO: add Roland V-SYNTH XT support */
1475 /* TODO: add BOSS GT-PRO support */
1476{ 1469{
1477 /* has ID 0x008c when not in "Advanced Driver" mode */ 1470 /* has ID 0x008c when not in "Advanced Driver" mode */
1478 USB_DEVICE(0x0582, 0x008b), 1471 USB_DEVICE(0x0582, 0x008b),
@@ -1487,42 +1480,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1487 } 1480 }
1488 } 1481 }
1489}, 1482},
1490 /* TODO: add Edirol PC-80 support */
1491{
1492 USB_DEVICE(0x0582, 0x0096),
1493 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1494 .vendor_name = "EDIROL",
1495 .product_name = "UA-1EX",
1496 .ifnum = QUIRK_ANY_INTERFACE,
1497 .type = QUIRK_COMPOSITE,
1498 .data = (const struct snd_usb_audio_quirk[]) {
1499 {
1500 .ifnum = 0,
1501 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1502 },
1503 {
1504 .ifnum = 1,
1505 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1506 },
1507 {
1508 .ifnum = -1
1509 }
1510 }
1511 }
1512},
1513{
1514 USB_DEVICE(0x0582, 0x009a),
1515 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1516 .vendor_name = "EDIROL",
1517 .product_name = "UM-3EX",
1518 .ifnum = 0,
1519 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1520 .data = & (const struct snd_usb_midi_endpoint_info) {
1521 .out_cables = 0x000f,
1522 .in_cables = 0x000f
1523 }
1524 }
1525},
1526{ 1483{
1527 /* 1484 /*
1528 * This quirk is for the "Advanced Driver" mode. If off, the UA-4FX 1485 * This quirk is for the "Advanced Driver" mode. If off, the UA-4FX
@@ -1553,124 +1510,8 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1553 } 1510 }
1554 } 1511 }
1555}, 1512},
1556 /* TODO: add Edirol MD-P1 support */
1557{
1558 USB_DEVICE(0x582, 0x00a6),
1559 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1560 .vendor_name = "Roland",
1561 .product_name = "Juno-G",
1562 .ifnum = 0,
1563 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1564 .data = & (const struct snd_usb_midi_endpoint_info) {
1565 .out_cables = 0x0001,
1566 .in_cables = 0x0001
1567 }
1568 }
1569},
1570{
1571 /* Roland SH-201 */
1572 USB_DEVICE(0x0582, 0x00ad),
1573 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1574 .vendor_name = "Roland",
1575 .product_name = "SH-201",
1576 .ifnum = QUIRK_ANY_INTERFACE,
1577 .type = QUIRK_COMPOSITE,
1578 .data = (const struct snd_usb_audio_quirk[]) {
1579 {
1580 .ifnum = 0,
1581 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1582 },
1583 {
1584 .ifnum = 1,
1585 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1586 },
1587 {
1588 .ifnum = 2,
1589 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1590 .data = & (const struct snd_usb_midi_endpoint_info) {
1591 .out_cables = 0x0001,
1592 .in_cables = 0x0001
1593 }
1594 },
1595 {
1596 .ifnum = -1
1597 }
1598 }
1599 }
1600},
1601{
1602 /* Advanced mode of the Roland VG-99, with MIDI and 24-bit PCM at 44.1
1603 * kHz. In standard mode, the device has ID 0582:00b3, and offers
1604 * 16-bit PCM at 44.1 kHz with no MIDI.
1605 */
1606 USB_DEVICE(0x0582, 0x00b2),
1607 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1608 .vendor_name = "Roland",
1609 .product_name = "VG-99",
1610 .ifnum = QUIRK_ANY_INTERFACE,
1611 .type = QUIRK_COMPOSITE,
1612 .data = (const struct snd_usb_audio_quirk[]) {
1613 {
1614 .ifnum = 0,
1615 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1616 },
1617 {
1618 .ifnum = 1,
1619 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1620 },
1621 {
1622 .ifnum = 2,
1623 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1624 .data = & (const struct snd_usb_midi_endpoint_info) {
1625 .out_cables = 0x0003,
1626 .in_cables = 0x0003
1627 }
1628 },
1629 {
1630 .ifnum = -1
1631 }
1632 }
1633 }
1634},
1635{
1636 /* Roland SonicCell */
1637 USB_DEVICE(0x0582, 0x00c2),
1638 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1639 .vendor_name = "Roland",
1640 .product_name = "SonicCell",
1641 .ifnum = QUIRK_ANY_INTERFACE,
1642 .type = QUIRK_COMPOSITE,
1643 .data = (const struct snd_usb_audio_quirk[]) {
1644 {
1645 .ifnum = 0,
1646 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1647 },
1648 {
1649 .ifnum = 1,
1650 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1651 },
1652 {
1653 .ifnum = 2,
1654 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1655 .data = & (const struct snd_usb_midi_endpoint_info) {
1656 .out_cables = 0x0001,
1657 .in_cables = 0x0001
1658 }
1659 },
1660 {
1661 .ifnum = -1
1662 }
1663 }
1664 }
1665},
1666{ 1513{
1667 /* Edirol M-16DX */ 1514 /* Edirol M-16DX */
1668 /* FIXME: This quirk gives a good-working capture stream but the
1669 * playback seems problematic because of lacking of sync
1670 * with capture stream. It needs to sync with the capture
1671 * clock. As now, you'll get frequent sound distortions
1672 * via the playback.
1673 */
1674 USB_DEVICE(0x0582, 0x00c4), 1515 USB_DEVICE(0x0582, 0x00c4),
1675 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1516 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1676 .ifnum = QUIRK_ANY_INTERFACE, 1517 .ifnum = QUIRK_ANY_INTERFACE,
@@ -1699,35 +1540,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1699 } 1540 }
1700}, 1541},
1701{ 1542{
1702 /* BOSS GT-10 */
1703 USB_DEVICE(0x0582, 0x00da),
1704 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1705 .ifnum = QUIRK_ANY_INTERFACE,
1706 .type = QUIRK_COMPOSITE,
1707 .data = (const struct snd_usb_audio_quirk[]) {
1708 {
1709 .ifnum = 0,
1710 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1711 },
1712 {
1713 .ifnum = 1,
1714 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1715 },
1716 {
1717 .ifnum = 2,
1718 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1719 .data = & (const struct snd_usb_midi_endpoint_info) {
1720 .out_cables = 0x0001,
1721 .in_cables = 0x0001
1722 }
1723 },
1724 {
1725 .ifnum = -1
1726 }
1727 }
1728 }
1729},
1730{
1731 /* Advanced modes of the Edirol UA-25EX. 1543 /* Advanced modes of the Edirol UA-25EX.
1732 * For the standard mode, UA-25EX has ID 0582:00e7, which 1544 * For the standard mode, UA-25EX has ID 0582:00e7, which
1733 * offers only 16-bit PCM at 44.1 kHz and no MIDI. 1545 * offers only 16-bit PCM at 44.1 kHz and no MIDI.
@@ -1758,42 +1570,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1758 } 1570 }
1759}, 1571},
1760{ 1572{
1761 /* has ID 0x00ea when not in Advanced Driver mode */
1762 USB_DEVICE_VENDOR_SPEC(0x0582, 0x00e9),
1763 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1764 /* .vendor_name = "Roland", */
1765 /* .product_name = "UA-1G", */
1766 .ifnum = QUIRK_ANY_INTERFACE,
1767 .type = QUIRK_COMPOSITE,
1768 .data = (const struct snd_usb_audio_quirk[]) {
1769 {
1770 .ifnum = 0,
1771 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1772 },
1773 {
1774 .ifnum = 1,
1775 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1776 },
1777 {
1778 .ifnum = -1
1779 }
1780 }
1781 }
1782},
1783{
1784 USB_DEVICE_VENDOR_SPEC(0x0582, 0x0104),
1785 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1786 /* .vendor_name = "Roland", */
1787 /* .product_name = "UM-1G", */
1788 .ifnum = 0,
1789 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1790 .data = & (const struct snd_usb_midi_endpoint_info) {
1791 .out_cables = 0x0001,
1792 .in_cables = 0x0001
1793 }
1794 }
1795},
1796{
1797 /* Edirol UM-3G */ 1573 /* Edirol UM-3G */
1798 USB_DEVICE_VENDOR_SPEC(0x0582, 0x0108), 1574 USB_DEVICE_VENDOR_SPEC(0x0582, 0x0108),
1799 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1575 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
@@ -1806,92 +1582,49 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1806 } 1582 }
1807}, 1583},
1808{ 1584{
1809 /* Boss JS-8 Jam Station */ 1585 /* only 44.1 kHz works at the moment */
1810 USB_DEVICE(0x0582, 0x0109), 1586 USB_DEVICE(0x0582, 0x0120),
1811 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1812 /* .vendor_name = "BOSS", */
1813 /* .product_name = "JS-8", */
1814 .ifnum = QUIRK_ANY_INTERFACE,
1815 .type = QUIRK_COMPOSITE,
1816 .data = (const struct snd_usb_audio_quirk[]) {
1817 {
1818 .ifnum = 0,
1819 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1820 },
1821 {
1822 .ifnum = 1,
1823 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1824 },
1825 {
1826 .ifnum = 2,
1827 .type = QUIRK_MIDI_STANDARD_INTERFACE
1828 },
1829 {
1830 .ifnum = -1
1831 }
1832 }
1833 }
1834},
1835{
1836 /* has ID 0x0110 when not in Advanced Driver mode */
1837 USB_DEVICE_VENDOR_SPEC(0x0582, 0x010f),
1838 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1587 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1839 /* .vendor_name = "Roland", */ 1588 /* .vendor_name = "Roland", */
1840 /* .product_name = "A-PRO", */ 1589 /* .product_name = "OCTO-CAPTURE", */
1841 .ifnum = 0,
1842 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1843 .data = & (const struct snd_usb_midi_endpoint_info) {
1844 .out_cables = 0x0003,
1845 .in_cables = 0x0007
1846 }
1847 }
1848},
1849{
1850 /* Roland GAIA SH-01 */
1851 USB_DEVICE(0x0582, 0x0111),
1852 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
1853 .vendor_name = "Roland",
1854 .product_name = "GAIA",
1855 .ifnum = QUIRK_ANY_INTERFACE, 1590 .ifnum = QUIRK_ANY_INTERFACE,
1856 .type = QUIRK_COMPOSITE, 1591 .type = QUIRK_COMPOSITE,
1857 .data = (const struct snd_usb_audio_quirk[]) { 1592 .data = (const struct snd_usb_audio_quirk[]) {
1858 { 1593 {
1859 .ifnum = 0, 1594 .ifnum = 0,
1860 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1595 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
1861 }, 1596 .data = & (const struct audioformat) {
1862 { 1597 .formats = SNDRV_PCM_FMTBIT_S32_LE,
1863 .ifnum = 1, 1598 .channels = 10,
1864 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1599 .iface = 0,
1865 }, 1600 .altsetting = 1,
1866 { 1601 .altset_idx = 1,
1867 .ifnum = 2, 1602 .endpoint = 0x05,
1868 .type = QUIRK_MIDI_FIXED_ENDPOINT, 1603 .ep_attr = 0x05,
1869 .data = &(const struct snd_usb_midi_endpoint_info) { 1604 .rates = SNDRV_PCM_RATE_44100,
1870 .out_cables = 0x0003, 1605 .rate_min = 44100,
1871 .in_cables = 0x0003 1606 .rate_max = 44100,
1607 .nr_rates = 1,
1608 .rate_table = (unsigned int[]) { 44100 }
1872 } 1609 }
1873 }, 1610 },
1874 { 1611 {
1875 .ifnum = -1
1876 }
1877 }
1878 }
1879},
1880{
1881 USB_DEVICE(0x0582, 0x0113),
1882 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1883 /* .vendor_name = "BOSS", */
1884 /* .product_name = "ME-25", */
1885 .ifnum = QUIRK_ANY_INTERFACE,
1886 .type = QUIRK_COMPOSITE,
1887 .data = (const struct snd_usb_audio_quirk[]) {
1888 {
1889 .ifnum = 0,
1890 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1891 },
1892 {
1893 .ifnum = 1, 1612 .ifnum = 1,
1894 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1613 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
1614 .data = & (const struct audioformat) {
1615 .formats = SNDRV_PCM_FMTBIT_S32_LE,
1616 .channels = 12,
1617 .iface = 1,
1618 .altsetting = 1,
1619 .altset_idx = 1,
1620 .endpoint = 0x85,
1621 .ep_attr = 0x25,
1622 .rates = SNDRV_PCM_RATE_44100,
1623 .rate_min = 44100,
1624 .rate_max = 44100,
1625 .nr_rates = 1,
1626 .rate_table = (unsigned int[]) { 44100 }
1627 }
1895 }, 1628 },
1896 { 1629 {
1897 .ifnum = 2, 1630 .ifnum = 2,
@@ -1902,30 +1635,12 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1902 } 1635 }
1903 }, 1636 },
1904 { 1637 {
1905 .ifnum = -1 1638 .ifnum = 3,
1906 } 1639 .type = QUIRK_IGNORE_INTERFACE
1907 }
1908 }
1909},
1910{
1911 USB_DEVICE(0x0582, 0x0127),
1912 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1913 /* .vendor_name = "Roland", */
1914 /* .product_name = "GR-55", */
1915 .ifnum = QUIRK_ANY_INTERFACE,
1916 .type = QUIRK_COMPOSITE,
1917 .data = (const struct snd_usb_audio_quirk[]) {
1918 {
1919 .ifnum = 0,
1920 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1921 },
1922 {
1923 .ifnum = 1,
1924 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1925 }, 1640 },
1926 { 1641 {
1927 .ifnum = 2, 1642 .ifnum = 4,
1928 .type = QUIRK_MIDI_STANDARD_INTERFACE 1643 .type = QUIRK_IGNORE_INTERFACE
1929 }, 1644 },
1930 { 1645 {
1931 .ifnum = -1 1646 .ifnum = -1
@@ -1934,34 +1649,49 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1934 } 1649 }
1935}, 1650},
1936{ 1651{
1937 /* Added support for Roland UM-ONE which differs from UM-1 */ 1652 /* only 44.1 kHz works at the moment */
1938 USB_DEVICE(0x0582, 0x012a), 1653 USB_DEVICE(0x0582, 0x012f),
1939 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1654 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1940 /* .vendor_name = "ROLAND", */ 1655 /* .vendor_name = "Roland", */
1941 /* .product_name = "UM-ONE", */ 1656 /* .product_name = "QUAD-CAPTURE", */
1942 .ifnum = 0,
1943 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1944 .data = & (const struct snd_usb_midi_endpoint_info) {
1945 .out_cables = 0x0001,
1946 .in_cables = 0x0003
1947 }
1948 }
1949},
1950{
1951 USB_DEVICE(0x0582, 0x011e),
1952 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1953 /* .vendor_name = "BOSS", */
1954 /* .product_name = "BR-800", */
1955 .ifnum = QUIRK_ANY_INTERFACE, 1657 .ifnum = QUIRK_ANY_INTERFACE,
1956 .type = QUIRK_COMPOSITE, 1658 .type = QUIRK_COMPOSITE,
1957 .data = (const struct snd_usb_audio_quirk[]) { 1659 .data = (const struct snd_usb_audio_quirk[]) {
1958 { 1660 {
1959 .ifnum = 0, 1661 .ifnum = 0,
1960 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1662 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
1663 .data = & (const struct audioformat) {
1664 .formats = SNDRV_PCM_FMTBIT_S32_LE,
1665 .channels = 4,
1666 .iface = 0,
1667 .altsetting = 1,
1668 .altset_idx = 1,
1669 .endpoint = 0x05,
1670 .ep_attr = 0x05,
1671 .rates = SNDRV_PCM_RATE_44100,
1672 .rate_min = 44100,
1673 .rate_max = 44100,
1674 .nr_rates = 1,
1675 .rate_table = (unsigned int[]) { 44100 }
1676 }
1961 }, 1677 },
1962 { 1678 {
1963 .ifnum = 1, 1679 .ifnum = 1,
1964 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1680 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
1681 .data = & (const struct audioformat) {
1682 .formats = SNDRV_PCM_FMTBIT_S32_LE,
1683 .channels = 6,
1684 .iface = 1,
1685 .altsetting = 1,
1686 .altset_idx = 1,
1687 .endpoint = 0x85,
1688 .ep_attr = 0x25,
1689 .rates = SNDRV_PCM_RATE_44100,
1690 .rate_min = 44100,
1691 .rate_max = 44100,
1692 .nr_rates = 1,
1693 .rate_table = (unsigned int[]) { 44100 }
1694 }
1965 }, 1695 },
1966 { 1696 {
1967 .ifnum = 2, 1697 .ifnum = 2,
@@ -1972,38 +1702,12 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1972 } 1702 }
1973 }, 1703 },
1974 { 1704 {
1975 .ifnum = -1 1705 .ifnum = 3,
1976 }
1977 }
1978 }
1979},
1980{
1981 USB_DEVICE(0x0582, 0x0130),
1982 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1983 /* .vendor_name = "BOSS", */
1984 /* .product_name = "MICRO BR-80", */
1985 .ifnum = QUIRK_ANY_INTERFACE,
1986 .type = QUIRK_COMPOSITE,
1987 .data = (const struct snd_usb_audio_quirk[]) {
1988 {
1989 .ifnum = 0,
1990 .type = QUIRK_IGNORE_INTERFACE 1706 .type = QUIRK_IGNORE_INTERFACE
1991 }, 1707 },
1992 { 1708 {
1993 .ifnum = 1, 1709 .ifnum = 4,
1994 .type = QUIRK_AUDIO_STANDARD_INTERFACE 1710 .type = QUIRK_IGNORE_INTERFACE
1995 },
1996 {
1997 .ifnum = 2,
1998 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1999 },
2000 {
2001 .ifnum = 3,
2002 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2003 .data = & (const struct snd_usb_midi_endpoint_info) {
2004 .out_cables = 0x0001,
2005 .in_cables = 0x0001
2006 }
2007 }, 1711 },
2008 { 1712 {
2009 .ifnum = -1 1713 .ifnum = -1
@@ -2011,34 +1715,15 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2011 } 1715 }
2012 } 1716 }
2013}, 1717},
1718/* this catches most recent vendor-specific Roland devices */
2014{ 1719{
2015 USB_DEVICE(0x0582, 0x014d), 1720 .match_flags = USB_DEVICE_ID_MATCH_VENDOR |
2016 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1721 USB_DEVICE_ID_MATCH_INT_CLASS,
2017 /* .vendor_name = "BOSS", */ 1722 .idVendor = 0x0582,
2018 /* .product_name = "GT-100", */ 1723 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
1724 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2019 .ifnum = QUIRK_ANY_INTERFACE, 1725 .ifnum = QUIRK_ANY_INTERFACE,
2020 .type = QUIRK_COMPOSITE, 1726 .type = QUIRK_AUTODETECT
2021 .data = (const struct snd_usb_audio_quirk[]) {
2022 {
2023 .ifnum = 1,
2024 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2025 },
2026 {
2027 .ifnum = 2,
2028 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2029 },
2030 {
2031 .ifnum = 3,
2032 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2033 .data = & (const struct snd_usb_midi_endpoint_info) {
2034 .out_cables = 0x0001,
2035 .in_cables = 0x0001
2036 }
2037 },
2038 {
2039 .ifnum = -1
2040 }
2041 }
2042 } 1727 }
2043}, 1728},
2044 1729
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 3879eae7e874..5b01330b8452 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -18,6 +18,7 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/usb.h> 19#include <linux/usb.h>
20#include <linux/usb/audio.h> 20#include <linux/usb/audio.h>
21#include <linux/usb/midi.h>
21 22
22#include <sound/control.h> 23#include <sound/control.h>
23#include <sound/core.h> 24#include <sound/core.h>
@@ -175,6 +176,212 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
175 return 0; 176 return 0;
176} 177}
177 178
179static int create_auto_pcm_quirk(struct snd_usb_audio *chip,
180 struct usb_interface *iface,
181 struct usb_driver *driver)
182{
183 struct usb_host_interface *alts;
184 struct usb_interface_descriptor *altsd;
185 struct usb_endpoint_descriptor *epd;
186 struct uac1_as_header_descriptor *ashd;
187 struct uac_format_type_i_discrete_descriptor *fmtd;
188
189 /*
190 * Most Roland/Yamaha audio streaming interfaces have more or less
191 * standard descriptors, but older devices might lack descriptors, and
192 * future ones might change, so ensure that we fail silently if the
193 * interface doesn't look exactly right.
194 */
195
196 /* must have a non-zero altsetting for streaming */
197 if (iface->num_altsetting < 2)
198 return -ENODEV;
199 alts = &iface->altsetting[1];
200 altsd = get_iface_desc(alts);
201
202 /* must have an isochronous endpoint for streaming */
203 if (altsd->bNumEndpoints < 1)
204 return -ENODEV;
205 epd = get_endpoint(alts, 0);
206 if (!usb_endpoint_xfer_isoc(epd))
207 return -ENODEV;
208
209 /* must have format descriptors */
210 ashd = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL,
211 UAC_AS_GENERAL);
212 fmtd = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL,
213 UAC_FORMAT_TYPE);
214 if (!ashd || ashd->bLength < 7 ||
215 !fmtd || fmtd->bLength < 8)
216 return -ENODEV;
217
218 return create_standard_audio_quirk(chip, iface, driver, NULL);
219}
220
221static int create_yamaha_midi_quirk(struct snd_usb_audio *chip,
222 struct usb_interface *iface,
223 struct usb_driver *driver,
224 struct usb_host_interface *alts)
225{
226 static const struct snd_usb_audio_quirk yamaha_midi_quirk = {
227 .type = QUIRK_MIDI_YAMAHA
228 };
229 struct usb_midi_in_jack_descriptor *injd;
230 struct usb_midi_out_jack_descriptor *outjd;
231
232 /* must have some valid jack descriptors */
233 injd = snd_usb_find_csint_desc(alts->extra, alts->extralen,
234 NULL, USB_MS_MIDI_IN_JACK);
235 outjd = snd_usb_find_csint_desc(alts->extra, alts->extralen,
236 NULL, USB_MS_MIDI_OUT_JACK);
237 if (!injd && !outjd)
238 return -ENODEV;
239 if (injd && (injd->bLength < 5 ||
240 (injd->bJackType != USB_MS_EMBEDDED &&
241 injd->bJackType != USB_MS_EXTERNAL)))
242 return -ENODEV;
243 if (outjd && (outjd->bLength < 6 ||
244 (outjd->bJackType != USB_MS_EMBEDDED &&
245 outjd->bJackType != USB_MS_EXTERNAL)))
246 return -ENODEV;
247 return create_any_midi_quirk(chip, iface, driver, &yamaha_midi_quirk);
248}
249
250static int create_roland_midi_quirk(struct snd_usb_audio *chip,
251 struct usb_interface *iface,
252 struct usb_driver *driver,
253 struct usb_host_interface *alts)
254{
255 static const struct snd_usb_audio_quirk roland_midi_quirk = {
256 .type = QUIRK_MIDI_ROLAND
257 };
258 u8 *roland_desc = NULL;
259
260 /* might have a vendor-specific descriptor <06 24 F1 02 ...> */
261 for (;;) {
262 roland_desc = snd_usb_find_csint_desc(alts->extra,
263 alts->extralen,
264 roland_desc, 0xf1);
265 if (!roland_desc)
266 return -ENODEV;
267 if (roland_desc[0] < 6 || roland_desc[3] != 2)
268 continue;
269 return create_any_midi_quirk(chip, iface, driver,
270 &roland_midi_quirk);
271 }
272}
273
274static int create_std_midi_quirk(struct snd_usb_audio *chip,
275 struct usb_interface *iface,
276 struct usb_driver *driver,
277 struct usb_host_interface *alts)
278{
279 struct usb_ms_header_descriptor *mshd;
280 struct usb_ms_endpoint_descriptor *msepd;
281
282 /* must have the MIDIStreaming interface header descriptor*/
283 mshd = (struct usb_ms_header_descriptor *)alts->extra;
284 if (alts->extralen < 7 ||
285 mshd->bLength < 7 ||
286 mshd->bDescriptorType != USB_DT_CS_INTERFACE ||
287 mshd->bDescriptorSubtype != USB_MS_HEADER)
288 return -ENODEV;
289 /* must have the MIDIStreaming endpoint descriptor*/
290 msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra;
291 if (alts->endpoint[0].extralen < 4 ||
292 msepd->bLength < 4 ||
293 msepd->bDescriptorType != USB_DT_CS_ENDPOINT ||
294 msepd->bDescriptorSubtype != UAC_MS_GENERAL ||
295 msepd->bNumEmbMIDIJack < 1 ||
296 msepd->bNumEmbMIDIJack > 16)
297 return -ENODEV;
298
299 return create_any_midi_quirk(chip, iface, driver, NULL);
300}
301
302static int create_auto_midi_quirk(struct snd_usb_audio *chip,
303 struct usb_interface *iface,
304 struct usb_driver *driver)
305{
306 struct usb_host_interface *alts;
307 struct usb_interface_descriptor *altsd;
308 struct usb_endpoint_descriptor *epd;
309 int err;
310
311 alts = &iface->altsetting[0];
312 altsd = get_iface_desc(alts);
313
314 /* must have at least one bulk/interrupt endpoint for streaming */
315 if (altsd->bNumEndpoints < 1)
316 return -ENODEV;
317 epd = get_endpoint(alts, 0);
318 if (!usb_endpoint_xfer_bulk(epd) ||
319 !usb_endpoint_xfer_int(epd))
320 return -ENODEV;
321
322 switch (USB_ID_VENDOR(chip->usb_id)) {
323 case 0x0499: /* Yamaha */
324 err = create_yamaha_midi_quirk(chip, iface, driver, alts);
325 if (err < 0 && err != -ENODEV)
326 return err;
327 break;
328 case 0x0582: /* Roland */
329 err = create_roland_midi_quirk(chip, iface, driver, alts);
330 if (err < 0 && err != -ENODEV)
331 return err;
332 break;
333 }
334
335 return create_std_midi_quirk(chip, iface, driver, alts);
336}
337
338static int create_autodetect_quirk(struct snd_usb_audio *chip,
339 struct usb_interface *iface,
340 struct usb_driver *driver)
341{
342 int err;
343
344 err = create_auto_pcm_quirk(chip, iface, driver);
345 if (err == -ENODEV)
346 err = create_auto_midi_quirk(chip, iface, driver);
347 return err;
348}
349
350static int create_autodetect_quirks(struct snd_usb_audio *chip,
351 struct usb_interface *iface,
352 struct usb_driver *driver,
353 const struct snd_usb_audio_quirk *quirk)
354{
355 int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
356 int ifcount, ifnum, err;
357
358 err = create_autodetect_quirk(chip, iface, driver);
359 if (err < 0)
360 return err;
361
362 /*
363 * ALSA PCM playback/capture devices cannot be registered in two steps,
364 * so we have to claim the other corresponding interface here.
365 */
366 ifcount = chip->dev->actconfig->desc.bNumInterfaces;
367 for (ifnum = 0; ifnum < ifcount; ifnum++) {
368 if (ifnum == probed_ifnum || quirk->ifnum >= 0)
369 continue;
370 iface = usb_ifnum_to_if(chip->dev, ifnum);
371 if (!iface ||
372 usb_interface_claimed(iface) ||
373 get_iface_desc(iface->altsetting)->bInterfaceClass !=
374 USB_CLASS_VENDOR_SPEC)
375 continue;
376
377 err = create_autodetect_quirk(chip, iface, driver);
378 if (err >= 0)
379 usb_driver_claim_interface(driver, iface, (void *)-1L);
380 }
381
382 return 0;
383}
384
178/* 385/*
179 * Create a stream for an Edirol UA-700/UA-25/UA-4FX interface. 386 * Create a stream for an Edirol UA-700/UA-25/UA-4FX interface.
180 * The only way to detect the sample rate is by looking at wMaxPacketSize. 387 * The only way to detect the sample rate is by looking at wMaxPacketSize.
@@ -303,9 +510,11 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
303 static const quirk_func_t quirk_funcs[] = { 510 static const quirk_func_t quirk_funcs[] = {
304 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, 511 [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
305 [QUIRK_COMPOSITE] = create_composite_quirk, 512 [QUIRK_COMPOSITE] = create_composite_quirk,
513 [QUIRK_AUTODETECT] = create_autodetect_quirks,
306 [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk, 514 [QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk,
307 [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk, 515 [QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk,
308 [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, 516 [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
517 [QUIRK_MIDI_ROLAND] = create_any_midi_quirk,
309 [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, 518 [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk,
310 [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, 519 [QUIRK_MIDI_NOVATION] = create_any_midi_quirk,
311 [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, 520 [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk,
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 7db2f8958e79..c4339f97226b 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -493,10 +493,10 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
493 altsd = get_iface_desc(alts); 493 altsd = get_iface_desc(alts);
494 protocol = altsd->bInterfaceProtocol; 494 protocol = altsd->bInterfaceProtocol;
495 /* skip invalid one */ 495 /* skip invalid one */
496 if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && 496 if (((altsd->bInterfaceClass != USB_CLASS_AUDIO ||
497 (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING &&
498 altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC)) &&
497 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || 499 altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
498 (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING &&
499 altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) ||
500 altsd->bNumEndpoints < 1 || 500 altsd->bNumEndpoints < 1 ||
501 le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0) 501 le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0)
502 continue; 502 continue;
@@ -512,6 +512,15 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
512 if (snd_usb_apply_interface_quirk(chip, iface_no, altno)) 512 if (snd_usb_apply_interface_quirk(chip, iface_no, altno))
513 continue; 513 continue;
514 514
515 /*
516 * Roland audio streaming interfaces are marked with protocols
517 * 0/1/2, but are UAC 1 compatible.
518 */
519 if (USB_ID_VENDOR(chip->usb_id) == 0x0582 &&
520 altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
521 protocol <= 2)
522 protocol = UAC_VERSION_1;
523
515 chconfig = 0; 524 chconfig = 0;
516 /* get audio formats */ 525 /* get audio formats */
517 switch (protocol) { 526 switch (protocol) {
@@ -635,6 +644,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
635 fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; 644 fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
636 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; 645 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
637 fp->datainterval = snd_usb_parse_datainterval(chip, alts); 646 fp->datainterval = snd_usb_parse_datainterval(chip, alts);
647 fp->protocol = protocol;
638 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 648 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
639 fp->channels = num_channels; 649 fp->channels = num_channels;
640 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) 650 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH)
@@ -676,7 +686,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
676 } 686 }
677 687
678 /* ok, let's parse further... */ 688 /* ok, let's parse further... */
679 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) { 689 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream) < 0) {
680 kfree(fp->rate_table); 690 kfree(fp->rate_table);
681 kfree(fp->chmap); 691 kfree(fp->chmap);
682 kfree(fp); 692 kfree(fp);
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index bc43bcaddf4d..caabe9b3af49 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -72,9 +72,11 @@ struct snd_usb_audio {
72enum quirk_type { 72enum quirk_type {
73 QUIRK_IGNORE_INTERFACE, 73 QUIRK_IGNORE_INTERFACE,
74 QUIRK_COMPOSITE, 74 QUIRK_COMPOSITE,
75 QUIRK_AUTODETECT,
75 QUIRK_MIDI_STANDARD_INTERFACE, 76 QUIRK_MIDI_STANDARD_INTERFACE,
76 QUIRK_MIDI_FIXED_ENDPOINT, 77 QUIRK_MIDI_FIXED_ENDPOINT,
77 QUIRK_MIDI_YAMAHA, 78 QUIRK_MIDI_YAMAHA,
79 QUIRK_MIDI_ROLAND,
78 QUIRK_MIDI_MIDIMAN, 80 QUIRK_MIDI_MIDIMAN,
79 QUIRK_MIDI_NOVATION, 81 QUIRK_MIDI_NOVATION,
80 QUIRK_MIDI_RAW_BYTES, 82 QUIRK_MIDI_RAW_BYTES,