Merge remote branch 'alsa/devel' into topic/misc

Conflicts:
sound/usb/usbaudio.c

+38 -156
+1 -1
Documentation/sound/alsa/ALSA-Configuration.txt
··· 1812 1812 Module snd-ua101 1813 1813 ---------------- 1814 1814 1815 - Module for the Edirol UA-101 audio/MIDI interface. 1815 + Module for the Edirol UA-101/UA-1000 audio/MIDI interfaces. 1816 1816 1817 1817 This module supports multiple devices, autoprobe and hotplugging. 1818 1818
+3 -3
sound/usb/Kconfig
··· 22 22 will be called snd-usb-audio. 23 23 24 24 config SND_USB_UA101 25 - tristate "Edirol UA-101 driver (EXPERIMENTAL)" 25 + tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)" 26 26 depends on EXPERIMENTAL 27 27 select SND_PCM 28 28 select SND_RAWMIDI 29 29 help 30 - Say Y here to include support for the Edirol UA-101 audio/MIDI 31 - interface. 30 + Say Y here to include support for the Edirol UA-101 and UA-1000 31 + audio/MIDI interfaces. 32 32 33 33 To compile this driver as a module, choose M here: the module 34 34 will be called snd-ua101.
+33 -67
sound/usb/ua101.c
··· 1 1 /* 2 - * Edirol UA-101 driver 2 + * Edirol UA-101/UA-1000 driver 3 3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 4 4 * 5 5 * This driver is free software: you can redistribute it and/or modify ··· 25 25 #include <sound/pcm_params.h> 26 26 #include "usbaudio.h" 27 27 28 - MODULE_DESCRIPTION("Edirol UA-101 driver"); 28 + MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); 29 29 MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 30 30 MODULE_LICENSE("GPL v2"); 31 - MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); 32 - 33 - /* I use my UA-1A for testing because I don't have a UA-101 ... */ 34 - #define UA1A_HACK 31 + MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); 35 32 36 33 /* 37 34 * Should not be lower than the minimum scheduling delay of the host ··· 129 132 dma_addr_t dma; 130 133 } buffers[MAX_MEMORY_BUFFERS]; 131 134 } capture, playback; 132 - 133 - unsigned int fps[10]; 134 - unsigned int frame_counter; 135 135 }; 136 136 137 137 static DEFINE_MUTEX(devices_mutex); ··· 418 424 if (do_period_elapsed) 419 425 snd_pcm_period_elapsed(stream->substream); 420 426 421 - /* for debugging: measure the sample rate relative to the USB clock */ 422 - ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames; 423 - if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) { 424 - printk(KERN_DEBUG "capture rate:"); 425 - for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames) 426 - printk(KERN_CONT " %u", ua->fps[frames]); 427 - printk(KERN_CONT "\n"); 428 - memset(ua->fps, 0, sizeof(ua->fps)); 429 - ua->frame_counter = 0; 430 - } 431 427 return; 432 428 433 429 stream_stopped: ··· 1184 1200 .type = QUIRK_MIDI_FIXED_ENDPOINT, 1185 1201 .data = &midi_ep 1186 1202 }; 1203 + static const int intf_numbers[2][3] = { 1204 + { /* UA-101 */ 1205 + [INTF_PLAYBACK] = 0, 1206 + [INTF_CAPTURE] = 1, 1207 + [INTF_MIDI] = 2, 1208 + }, 1209 + { /* UA-1000 */ 1210 + [INTF_CAPTURE] = 1, 1211 + [INTF_PLAYBACK] = 2, 1212 + [INTF_MIDI] = 3, 1213 + }, 1214 + }; 1187 1215 struct snd_card *card; 1188 1216 struct ua101 *ua; 1189 1217 unsigned int card_index, i; 1218 + int is_ua1000; 1219 + const char *name; 1190 1220 char usb_path[32]; 1191 1221 int err; 1192 1222 1193 - if (interface->altsetting->desc.bInterfaceNumber != 0) 1223 + is_ua1000 = usb_id->idProduct == 0x0044; 1224 + 1225 + if (interface->altsetting->desc.bInterfaceNumber != 1226 + intf_numbers[is_ua1000][0]) 1194 1227 return -ENODEV; 1195 1228 1196 1229 mutex_lock(&devices_mutex); ··· 1240 1239 init_waitqueue_head(&ua->rate_feedback_wait); 1241 1240 init_waitqueue_head(&ua->alsa_playback_wait); 1242 1241 1243 - #ifdef UA1A_HACK 1244 - if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { 1245 - ua->intf[2] = interface; 1246 - ua->intf[0] = usb_ifnum_to_if(ua->dev, 1); 1247 - ua->intf[1] = usb_ifnum_to_if(ua->dev, 2); 1248 - usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua); 1249 - usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua); 1250 - } else { 1251 - #endif 1252 1242 ua->intf[0] = interface; 1253 1243 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { 1254 - ua->intf[i] = usb_ifnum_to_if(ua->dev, i); 1244 + ua->intf[i] = usb_ifnum_to_if(ua->dev, 1245 + intf_numbers[is_ua1000][i]); 1255 1246 if (!ua->intf[i]) { 1256 - dev_err(&ua->dev->dev, "interface %u not found\n", i); 1247 + dev_err(&ua->dev->dev, "interface %u not found\n", 1248 + intf_numbers[is_ua1000][i]); 1257 1249 err = -ENXIO; 1258 1250 goto probe_error; 1259 1251 } ··· 1258 1264 goto probe_error; 1259 1265 } 1260 1266 } 1261 - #ifdef UA1A_HACK 1262 - } 1263 - #endif 1264 1267 1265 1268 snd_card_set_dev(card, &interface->dev); 1266 1269 1267 - #ifdef UA1A_HACK 1268 - if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) { 1269 - ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE; 1270 - ua->rate = 44100; 1271 - ua->packets_per_second = 1000; 1272 - ua->capture.channels = 2; 1273 - ua->playback.channels = 2; 1274 - ua->capture.frame_bytes = 4; 1275 - ua->playback.frame_bytes = 4; 1276 - ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2); 1277 - ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1); 1278 - ua->capture.max_packet_bytes = 192; 1279 - ua->playback.max_packet_bytes = 192; 1280 - } else { 1281 - #endif 1282 1270 err = detect_usb_format(ua); 1283 1271 if (err < 0) 1284 1272 goto probe_error; 1285 - #ifdef UA1A_HACK 1286 - } 1287 - #endif 1288 1273 1274 + name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101"; 1289 1275 strcpy(card->driver, "UA-101"); 1290 - strcpy(card->shortname, "UA-101"); 1276 + strcpy(card->shortname, name); 1291 1277 usb_make_path(ua->dev, usb_path, sizeof(usb_path)); 1292 1278 snprintf(ua->card->longname, sizeof(ua->card->longname), 1293 - "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", 1279 + "EDIROL %s (serial %s), %u Hz at %s, %s speed", name, 1294 1280 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, 1295 1281 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); 1296 1282 ··· 1288 1314 if (err < 0) 1289 1315 goto probe_error; 1290 1316 1291 - err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); 1317 + err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm); 1292 1318 if (err < 0) 1293 1319 goto probe_error; 1294 1320 ua->pcm->private_data = ua; 1295 - strcpy(ua->pcm->name, "UA-101"); 1321 + strcpy(ua->pcm->name, name); 1296 1322 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); 1297 1323 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); 1298 1324 1299 - #ifdef UA1A_HACK 1300 - if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) { 1301 - #endif 1302 1325 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI], 1303 1326 &ua->midi_list, &midi_quirk); 1304 1327 if (err < 0) 1305 1328 goto probe_error; 1306 - #ifdef UA1A_HACK 1307 - } 1308 - #endif 1309 1329 1310 1330 err = snd_card_register(card); 1311 1331 if (err < 0) ··· 1354 1386 } 1355 1387 1356 1388 static struct usb_device_id ua101_ids[] = { 1357 - #ifdef UA1A_HACK 1358 - { USB_DEVICE(0x0582, 0x0018) }, 1359 - #endif 1360 - { USB_DEVICE(0x0582, 0x007d) }, 1361 - { USB_DEVICE(0x0582, 0x008d) }, 1389 + { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */ 1390 + { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */ 1391 + { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */ 1362 1392 { } 1363 1393 }; 1364 1394 MODULE_DEVICE_TABLE(usb, ua101_ids);
-53
sound/usb/usbaudio.c
··· 3386 3386 return 0; 3387 3387 } 3388 3388 3389 - /* 3390 - * Create a stream for an Edirol UA-1000 interface. 3391 - */ 3392 - static int create_ua1000_quirk(struct snd_usb_audio *chip, 3393 - struct usb_interface *iface, 3394 - const struct snd_usb_audio_quirk *quirk) 3395 - { 3396 - static const struct audioformat ua1000_format = { 3397 - .format = SNDRV_PCM_FORMAT_S32_LE, 3398 - .fmt_type = UAC_FORMAT_TYPE_I, 3399 - .altsetting = 1, 3400 - .altset_idx = 1, 3401 - .attributes = 0, 3402 - .rates = SNDRV_PCM_RATE_CONTINUOUS, 3403 - }; 3404 - struct usb_host_interface *alts; 3405 - struct usb_interface_descriptor *altsd; 3406 - struct audioformat *fp; 3407 - int stream, err; 3408 - 3409 - if (iface->num_altsetting != 2) 3410 - return -ENXIO; 3411 - alts = &iface->altsetting[1]; 3412 - altsd = get_iface_desc(alts); 3413 - if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE || 3414 - altsd->bNumEndpoints != 1) 3415 - return -ENXIO; 3416 - 3417 - fp = kmemdup(&ua1000_format, sizeof(*fp), GFP_KERNEL); 3418 - if (!fp) 3419 - return -ENOMEM; 3420 - 3421 - fp->channels = alts->extra[4]; 3422 - fp->iface = altsd->bInterfaceNumber; 3423 - fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; 3424 - fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; 3425 - fp->datainterval = parse_datainterval(chip, alts); 3426 - fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 3427 - fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]); 3428 - 3429 - stream = (fp->endpoint & USB_DIR_IN) 3430 - ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; 3431 - err = add_audio_endpoint(chip, stream, fp); 3432 - if (err < 0) { 3433 - kfree(fp); 3434 - return err; 3435 - } 3436 - /* FIXME: playback must be synchronized to capture */ 3437 - usb_set_interface(chip->dev, fp->iface, 0); 3438 - return 0; 3439 - } 3440 - 3441 3389 static int snd_usb_create_quirk(struct snd_usb_audio *chip, 3442 3390 struct usb_interface *iface, 3443 3391 const struct snd_usb_audio_quirk *quirk); ··· 3634 3686 [QUIRK_MIDI_CME] = create_any_midi_quirk, 3635 3687 [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, 3636 3688 [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, 3637 - [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, 3638 3689 [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, 3639 3690 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk 3640 3691 };
+1 -2
sound/usb/usbaudio.h
··· 75 75 QUIRK_MIDI_US122L, 76 76 QUIRK_AUDIO_STANDARD_INTERFACE, 77 77 QUIRK_AUDIO_FIXED_ENDPOINT, 78 - QUIRK_AUDIO_EDIROL_UA1000, 79 78 QUIRK_AUDIO_EDIROL_UAXX, 80 79 QUIRK_AUDIO_ALIGN_TRANSFER, 81 80 ··· 111 112 112 113 /* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */ 113 114 114 - /* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */ 115 + /* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */ 115 116 116 117 /* for QUIRK_IGNORE_INTERFACE, data is NULL */ 117 118
-30
sound/usb/usbquirks.h
··· 1016 1016 } 1017 1017 }, 1018 1018 { 1019 - USB_DEVICE(0x0582, 0x0044), 1020 - .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1021 - .vendor_name = "Roland", 1022 - .product_name = "UA-1000", 1023 - .ifnum = QUIRK_ANY_INTERFACE, 1024 - .type = QUIRK_COMPOSITE, 1025 - .data = (const struct snd_usb_audio_quirk[]) { 1026 - { 1027 - .ifnum = 1, 1028 - .type = QUIRK_AUDIO_EDIROL_UA1000 1029 - }, 1030 - { 1031 - .ifnum = 2, 1032 - .type = QUIRK_AUDIO_EDIROL_UA1000 1033 - }, 1034 - { 1035 - .ifnum = 3, 1036 - .type = QUIRK_MIDI_FIXED_ENDPOINT, 1037 - .data = & (const struct snd_usb_midi_endpoint_info) { 1038 - .out_cables = 0x0003, 1039 - .in_cables = 0x0003 1040 - } 1041 - }, 1042 - { 1043 - .ifnum = -1 1044 - } 1045 - } 1046 - } 1047 - }, 1048 - { 1049 1019 /* has ID 0x0049 when not in "Advanced Driver" mode */ 1050 1020 USB_DEVICE(0x0582, 0x0047), 1051 1021 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {