···1812 Module snd-ua1011813 ----------------18141815- Module for the Edirol UA-101 audio/MIDI interface.18161817 This module supports multiple devices, autoprobe and hotplugging.1818
···1812 Module snd-ua1011813 ----------------18141815+ Module for the Edirol UA-101/UA-1000 audio/MIDI interfaces.18161817 This module supports multiple devices, autoprobe and hotplugging.1818
+3-3
sound/usb/Kconfig
···22 will be called snd-usb-audio.2324config SND_USB_UA10125- tristate "Edirol UA-101 driver (EXPERIMENTAL)"26 depends on EXPERIMENTAL27 select SND_PCM28 select SND_RAWMIDI29 help30- Say Y here to include support for the Edirol UA-101 audio/MIDI31- interface.3233 To compile this driver as a module, choose M here: the module34 will be called snd-ua101.
···22 will be called snd-usb-audio.2324config SND_USB_UA10125+ tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)"26 depends on EXPERIMENTAL27 select SND_PCM28 select SND_RAWMIDI29 help30+ Say Y here to include support for the Edirol UA-101 and UA-100031+ audio/MIDI interfaces.3233 To compile this driver as a module, choose M here: the module34 will be called snd-ua101.
+33-67
sound/usb/ua101.c
···1/*2- * Edirol UA-101 driver3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>4 *5 * This driver is free software: you can redistribute it and/or modify···25#include <sound/pcm_params.h>26#include "usbaudio.h"2728-MODULE_DESCRIPTION("Edirol UA-101 driver");29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");30MODULE_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_HACK3536/*37 * Should not be lower than the minimum scheduling delay of the host···129 dma_addr_t dma;130 } buffers[MAX_MEMORY_BUFFERS];131 } capture, playback;132-133- unsigned int fps[10];134- unsigned int frame_counter;135};136137static DEFINE_MUTEX(devices_mutex);···418 if (do_period_elapsed)419 snd_pcm_period_elapsed(stream->substream);420421- /* 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 return;432433stream_stopped:···1184 .type = QUIRK_MIDI_FIXED_ENDPOINT,1185 .data = &midi_ep1186 };0000000000001187 struct snd_card *card;1188 struct ua101 *ua;1189 unsigned int card_index, i;001190 char usb_path[32];1191 int err;11921193- if (interface->altsetting->desc.bInterfaceNumber != 0)0001194 return -ENODEV;11951196 mutex_lock(&devices_mutex);···1240 init_waitqueue_head(&ua->rate_feedback_wait);1241 init_waitqueue_head(&ua->alsa_playback_wait);12421243-#ifdef UA1A_HACK1244- 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-#endif1252 ua->intf[0] = interface;1253 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {1254- ua->intf[i] = usb_ifnum_to_if(ua->dev, i);01255 if (!ua->intf[i]) {1256- dev_err(&ua->dev->dev, "interface %u not found\n", i);01257 err = -ENXIO;1258 goto probe_error;1259 }···1258 goto probe_error;1259 }1260 }1261-#ifdef UA1A_HACK1262- }1263-#endif12641265 snd_card_set_dev(card, &interface->dev);12661267-#ifdef UA1A_HACK1268- 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-#endif1282 err = detect_usb_format(ua);1283 if (err < 0)1284 goto probe_error;1285-#ifdef UA1A_HACK1286- }1287-#endif128801289 strcpy(card->driver, "UA-101");1290- strcpy(card->shortname, "UA-101");1291 usb_make_path(ua->dev, usb_path, sizeof(usb_path));1292 snprintf(ua->card->longname, sizeof(ua->card->longname),1293- "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed",1294 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,1295 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");1296···1288 if (err < 0)1289 goto probe_error;12901291- err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm);1292 if (err < 0)1293 goto probe_error;1294 ua->pcm->private_data = ua;1295- strcpy(ua->pcm->name, "UA-101");1296 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);1297 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);12981299-#ifdef UA1A_HACK1300- if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) {1301-#endif1302 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],1303 &ua->midi_list, &midi_quirk);1304 if (err < 0)1305 goto probe_error;1306-#ifdef UA1A_HACK1307- }1308-#endif13091310 err = snd_card_register(card);1311 if (err < 0)···1354}13551356static struct usb_device_id ua101_ids[] = {1357-#ifdef UA1A_HACK1358- { USB_DEVICE(0x0582, 0x0018) },1359-#endif1360- { USB_DEVICE(0x0582, 0x007d) },1361- { USB_DEVICE(0x0582, 0x008d) },1362 { }1363};1364MODULE_DEVICE_TABLE(usb, ua101_ids);
···1/*2+ * Edirol UA-101/UA-1000 driver3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>4 *5 * This driver is free software: you can redistribute it and/or modify···25#include <sound/pcm_params.h>26#include "usbaudio.h"2728+MODULE_DESCRIPTION("Edirol UA-101/1000 driver");29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");30MODULE_LICENSE("GPL v2");31+MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");0003233/*34 * Should not be lower than the minimum scheduling delay of the host···132 dma_addr_t dma;133 } buffers[MAX_MEMORY_BUFFERS];134 } capture, playback;000135};136137static DEFINE_MUTEX(devices_mutex);···424 if (do_period_elapsed)425 snd_pcm_period_elapsed(stream->substream);4260000000000427 return;428429stream_stopped:···1200 .type = QUIRK_MIDI_FIXED_ENDPOINT,1201 .data = &midi_ep1202 };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+ };1215 struct snd_card *card;1216 struct ua101 *ua;1217 unsigned int card_index, i;1218+ int is_ua1000;1219+ const char *name;1220 char usb_path[32];1221 int err;12221223+ is_ua1000 = usb_id->idProduct == 0x0044;1224+1225+ if (interface->altsetting->desc.bInterfaceNumber !=1226+ intf_numbers[is_ua1000][0])1227 return -ENODEV;12281229 mutex_lock(&devices_mutex);···1239 init_waitqueue_head(&ua->rate_feedback_wait);1240 init_waitqueue_head(&ua->alsa_playback_wait);12410000000001242 ua->intf[0] = interface;1243 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {1244+ ua->intf[i] = usb_ifnum_to_if(ua->dev,1245+ intf_numbers[is_ua1000][i]);1246 if (!ua->intf[i]) {1247+ dev_err(&ua->dev->dev, "interface %u not found\n",1248+ intf_numbers[is_ua1000][i]);1249 err = -ENXIO;1250 goto probe_error;1251 }···1264 goto probe_error;1265 }1266 }00012671268 snd_card_set_dev(card, &interface->dev);12690000000000000001270 err = detect_usb_format(ua);1271 if (err < 0)1272 goto probe_error;00012731274+ name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";1275 strcpy(card->driver, "UA-101");1276+ strcpy(card->shortname, name);1277 usb_make_path(ua->dev, usb_path, sizeof(usb_path));1278 snprintf(ua->card->longname, sizeof(ua->card->longname),1279+ "EDIROL %s (serial %s), %u Hz at %s, %s speed", name,1280 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,1281 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");1282···1314 if (err < 0)1315 goto probe_error;13161317+ err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm);1318 if (err < 0)1319 goto probe_error;1320 ua->pcm->private_data = ua;1321+ strcpy(ua->pcm->name, name);1322 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);1323 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);13240001325 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],1326 &ua->midi_list, &midi_quirk);1327 if (err < 0)1328 goto probe_error;00013291330 err = snd_card_register(card);1331 if (err < 0)···1386}13871388static struct usb_device_id ua101_ids[] = {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 */001392 { }1393};1394MODULE_DEVICE_TABLE(usb, ua101_ids);
···75 QUIRK_MIDI_US122L,76 QUIRK_AUDIO_STANDARD_INTERFACE,77 QUIRK_AUDIO_FIXED_ENDPOINT,78- QUIRK_AUDIO_EDIROL_UA1000,79 QUIRK_AUDIO_EDIROL_UAXX,80 QUIRK_AUDIO_ALIGN_TRANSFER,81···111112/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */113114-/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */115116/* for QUIRK_IGNORE_INTERFACE, data is NULL */117
···75 QUIRK_MIDI_US122L,76 QUIRK_AUDIO_STANDARD_INTERFACE,77 QUIRK_AUDIO_FIXED_ENDPOINT,078 QUIRK_AUDIO_EDIROL_UAXX,79 QUIRK_AUDIO_ALIGN_TRANSFER,80···112113/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */114115+/* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */116117/* for QUIRK_IGNORE_INTERFACE, data is NULL */118
···1016 }1017},1018{0000000000000000000000000000001019 /* has ID 0x0049 when not in "Advanced Driver" mode */1020 USB_DEVICE(0x0582, 0x0047),1021 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {