···18121812 Module snd-ua10118131813 ----------------1814181418151815- Module for the Edirol UA-101 audio/MIDI interface.18151815+ Module for the Edirol UA-101/UA-1000 audio/MIDI interfaces.1816181618171817 This module supports multiple devices, autoprobe and hotplugging.18181818
+3-3
sound/usb/Kconfig
···2222 will be called snd-usb-audio.23232424config SND_USB_UA1012525- tristate "Edirol UA-101 driver (EXPERIMENTAL)"2525+ tristate "Edirol UA-101/UA-1000 driver (EXPERIMENTAL)"2626 depends on EXPERIMENTAL2727 select SND_PCM2828 select SND_RAWMIDI2929 help3030- Say Y here to include support for the Edirol UA-101 audio/MIDI3131- interface.3030+ Say Y here to include support for the Edirol UA-101 and UA-10003131+ audio/MIDI interfaces.32323333 To compile this driver as a module, choose M here: the module3434 will be called snd-ua101.
+33-67
sound/usb/ua101.c
···11/*22- * Edirol UA-101 driver22+ * Edirol UA-101/UA-1000 driver33 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>44 *55 * This driver is free software: you can redistribute it and/or modify···2525#include <sound/pcm_params.h>2626#include "usbaudio.h"27272828-MODULE_DESCRIPTION("Edirol UA-101 driver");2828+MODULE_DESCRIPTION("Edirol UA-101/1000 driver");2929MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");3030MODULE_LICENSE("GPL v2");3131-MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}");3232-3333-/* I use my UA-1A for testing because I don't have a UA-101 ... */3434-#define UA1A_HACK3131+MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");35323633/*3734 * Should not be lower than the minimum scheduling delay of the host···129132 dma_addr_t dma;130133 } buffers[MAX_MEMORY_BUFFERS];131134 } capture, playback;132132-133133- unsigned int fps[10];134134- unsigned int frame_counter;135135};136136137137static DEFINE_MUTEX(devices_mutex);···418424 if (do_period_elapsed)419425 snd_pcm_period_elapsed(stream->substream);420426421421- /* for debugging: measure the sample rate relative to the USB clock */422422- ua->fps[ua->frame_counter++ / ua->packets_per_second] += frames;423423- if (ua->frame_counter >= ARRAY_SIZE(ua->fps) * ua->packets_per_second) {424424- printk(KERN_DEBUG "capture rate:");425425- for (frames = 0; frames < ARRAY_SIZE(ua->fps); ++frames)426426- printk(KERN_CONT " %u", ua->fps[frames]);427427- printk(KERN_CONT "\n");428428- memset(ua->fps, 0, sizeof(ua->fps));429429- ua->frame_counter = 0;430430- }431427 return;432428433429stream_stopped:···11841200 .type = QUIRK_MIDI_FIXED_ENDPOINT,11851201 .data = &midi_ep11861202 };12031203+ static const int intf_numbers[2][3] = {12041204+ { /* UA-101 */12051205+ [INTF_PLAYBACK] = 0,12061206+ [INTF_CAPTURE] = 1,12071207+ [INTF_MIDI] = 2,12081208+ },12091209+ { /* UA-1000 */12101210+ [INTF_CAPTURE] = 1,12111211+ [INTF_PLAYBACK] = 2,12121212+ [INTF_MIDI] = 3,12131213+ },12141214+ };11871215 struct snd_card *card;11881216 struct ua101 *ua;11891217 unsigned int card_index, i;12181218+ int is_ua1000;12191219+ const char *name;11901220 char usb_path[32];11911221 int err;1192122211931193- if (interface->altsetting->desc.bInterfaceNumber != 0)12231223+ is_ua1000 = usb_id->idProduct == 0x0044;12241224+12251225+ if (interface->altsetting->desc.bInterfaceNumber !=12261226+ intf_numbers[is_ua1000][0])11941227 return -ENODEV;1195122811961229 mutex_lock(&devices_mutex);···12401239 init_waitqueue_head(&ua->rate_feedback_wait);12411240 init_waitqueue_head(&ua->alsa_playback_wait);1242124112431243-#ifdef UA1A_HACK12441244- if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {12451245- ua->intf[2] = interface;12461246- ua->intf[0] = usb_ifnum_to_if(ua->dev, 1);12471247- ua->intf[1] = usb_ifnum_to_if(ua->dev, 2);12481248- usb_driver_claim_interface(&ua101_driver, ua->intf[0], ua);12491249- usb_driver_claim_interface(&ua101_driver, ua->intf[1], ua);12501250- } else {12511251-#endif12521242 ua->intf[0] = interface;12531243 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {12541254- ua->intf[i] = usb_ifnum_to_if(ua->dev, i);12441244+ ua->intf[i] = usb_ifnum_to_if(ua->dev,12451245+ intf_numbers[is_ua1000][i]);12551246 if (!ua->intf[i]) {12561256- dev_err(&ua->dev->dev, "interface %u not found\n", i);12471247+ dev_err(&ua->dev->dev, "interface %u not found\n",12481248+ intf_numbers[is_ua1000][i]);12571249 err = -ENXIO;12581250 goto probe_error;12591251 }···12581264 goto probe_error;12591265 }12601266 }12611261-#ifdef UA1A_HACK12621262- }12631263-#endif1264126712651268 snd_card_set_dev(card, &interface->dev);1266126912671267-#ifdef UA1A_HACK12681268- if (ua->dev->descriptor.idProduct == cpu_to_le16(0x0018)) {12691269- ua->format_bit = SNDRV_PCM_FMTBIT_S16_LE;12701270- ua->rate = 44100;12711271- ua->packets_per_second = 1000;12721272- ua->capture.channels = 2;12731273- ua->playback.channels = 2;12741274- ua->capture.frame_bytes = 4;12751275- ua->playback.frame_bytes = 4;12761276- ua->capture.usb_pipe = usb_rcvisocpipe(ua->dev, 2);12771277- ua->playback.usb_pipe = usb_sndisocpipe(ua->dev, 1);12781278- ua->capture.max_packet_bytes = 192;12791279- ua->playback.max_packet_bytes = 192;12801280- } else {12811281-#endif12821270 err = detect_usb_format(ua);12831271 if (err < 0)12841272 goto probe_error;12851285-#ifdef UA1A_HACK12861286- }12871287-#endif1288127312741274+ name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";12891275 strcpy(card->driver, "UA-101");12901290- strcpy(card->shortname, "UA-101");12761276+ strcpy(card->shortname, name);12911277 usb_make_path(ua->dev, usb_path, sizeof(usb_path));12921278 snprintf(ua->card->longname, sizeof(ua->card->longname),12931293- "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed",12791279+ "EDIROL %s (serial %s), %u Hz at %s, %s speed", name,12941280 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,12951281 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");12961282···12881314 if (err < 0)12891315 goto probe_error;1290131612911291- err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm);13171317+ err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm);12921318 if (err < 0)12931319 goto probe_error;12941320 ua->pcm->private_data = ua;12951295- strcpy(ua->pcm->name, "UA-101");13211321+ strcpy(ua->pcm->name, name);12961322 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops);12971323 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);1298132412991299-#ifdef UA1A_HACK13001300- if (ua->dev->descriptor.idProduct != cpu_to_le16(0x0018)) {13011301-#endif13021325 err = snd_usbmidi_create(card, ua->intf[INTF_MIDI],13031326 &ua->midi_list, &midi_quirk);13041327 if (err < 0)13051328 goto probe_error;13061306-#ifdef UA1A_HACK13071307- }13081308-#endif1309132913101330 err = snd_card_register(card);13111331 if (err < 0)···13541386}1355138713561388static struct usb_device_id ua101_ids[] = {13571357-#ifdef UA1A_HACK13581358- { USB_DEVICE(0x0582, 0x0018) },13591359-#endif13601360- { USB_DEVICE(0x0582, 0x007d) },13611361- { USB_DEVICE(0x0582, 0x008d) },13891389+ { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */13901390+ { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */13911391+ { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */13621392 { }13631393};13641394MODULE_DEVICE_TABLE(usb, ua101_ids);
···7575 QUIRK_MIDI_US122L,7676 QUIRK_AUDIO_STANDARD_INTERFACE,7777 QUIRK_AUDIO_FIXED_ENDPOINT,7878- QUIRK_AUDIO_EDIROL_UA1000,7978 QUIRK_AUDIO_EDIROL_UAXX,8079 QUIRK_AUDIO_ALIGN_TRANSFER,8180···111112112113/* for QUIRK_AUDIO/MIDI_STANDARD_INTERFACE, data is NULL */113114114114-/* for QUIRK_AUDIO_EDIROL_UA700_UA25/UA1000, data is NULL */115115+/* for QUIRK_AUDIO_EDIROL_UAXX, data is NULL */115116116117/* for QUIRK_IGNORE_INTERFACE, data is NULL */117118