aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/ua101.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/ua101.c')
-rw-r--r--sound/usb/ua101.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/sound/usb/ua101.c b/sound/usb/ua101.c
index 4f4ccdf70dd0..047dc1ca84d0 100644
--- a/sound/usb/ua101.c
+++ b/sound/usb/ua101.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Edirol UA-101 driver 2 * Edirol UA-101/UA-1000 driver
3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de> 3 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
4 * 4 *
5 * This driver is free software: you can redistribute it and/or modify 5 * This driver is free software: you can redistribute it and/or modify
@@ -25,10 +25,10 @@
25#include <sound/pcm_params.h> 25#include <sound/pcm_params.h>
26#include "usbaudio.h" 26#include "usbaudio.h"
27 27
28MODULE_DESCRIPTION("Edirol UA-101 driver"); 28MODULE_DESCRIPTION("Edirol UA-101/1000 driver");
29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); 29MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
30MODULE_LICENSE("GPL v2"); 30MODULE_LICENSE("GPL v2");
31MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); 31MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");
32 32
33/* I use my UA-1A for testing because I don't have a UA-101 ... */ 33/* I use my UA-1A for testing because I don't have a UA-101 ... */
34#define UA1A_HACK 34#define UA1A_HACK
@@ -1200,13 +1200,30 @@ static int ua101_probe(struct usb_interface *interface,
1200 .type = QUIRK_MIDI_FIXED_ENDPOINT, 1200 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1201 .data = &midi_ep 1201 .data = &midi_ep
1202 }; 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 };
1203 struct snd_card *card; 1215 struct snd_card *card;
1204 struct ua101 *ua; 1216 struct ua101 *ua;
1205 unsigned int card_index, i; 1217 unsigned int card_index, i;
1218 int is_ua1000;
1219 const char *name;
1206 char usb_path[32]; 1220 char usb_path[32];
1207 int err; 1221 int err;
1208 1222
1209 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])
1210 return -ENODEV; 1227 return -ENODEV;
1211 1228
1212 mutex_lock(&devices_mutex); 1229 mutex_lock(&devices_mutex);
@@ -1250,9 +1267,11 @@ static int ua101_probe(struct usb_interface *interface,
1250#endif 1267#endif
1251 ua->intf[0] = interface; 1268 ua->intf[0] = interface;
1252 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { 1269 for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) {
1253 ua->intf[i] = usb_ifnum_to_if(ua->dev, i); 1270 ua->intf[i] = usb_ifnum_to_if(ua->dev,
1271 intf_numbers[is_ua1000][i]);
1254 if (!ua->intf[i]) { 1272 if (!ua->intf[i]) {
1255 dev_err(&ua->dev->dev, "interface %u not found\n", i); 1273 dev_err(&ua->dev->dev, "interface %u not found\n",
1274 intf_numbers[is_ua1000][i]);
1256 err = -ENXIO; 1275 err = -ENXIO;
1257 goto probe_error; 1276 goto probe_error;
1258 } 1277 }
@@ -1292,11 +1311,12 @@ static int ua101_probe(struct usb_interface *interface,
1292 } 1311 }
1293#endif 1312#endif
1294 1313
1314 name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101";
1295 strcpy(card->driver, "UA-101"); 1315 strcpy(card->driver, "UA-101");
1296 strcpy(card->shortname, "UA-101"); 1316 strcpy(card->shortname, name);
1297 usb_make_path(ua->dev, usb_path, sizeof(usb_path)); 1317 usb_make_path(ua->dev, usb_path, sizeof(usb_path));
1298 snprintf(ua->card->longname, sizeof(ua->card->longname), 1318 snprintf(ua->card->longname, sizeof(ua->card->longname),
1299 "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", 1319 "EDIROL %s (serial %s), %u Hz at %s, %s speed", name,
1300 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, 1320 ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path,
1301 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); 1321 ua->dev->speed == USB_SPEED_HIGH ? "high" : "full");
1302 1322
@@ -1314,11 +1334,11 @@ static int ua101_probe(struct usb_interface *interface,
1314 if (err < 0) 1334 if (err < 0)
1315 goto probe_error; 1335 goto probe_error;
1316 1336
1317 err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); 1337 err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm);
1318 if (err < 0) 1338 if (err < 0)
1319 goto probe_error; 1339 goto probe_error;
1320 ua->pcm->private_data = ua; 1340 ua->pcm->private_data = ua;
1321 strcpy(ua->pcm->name, "UA-101"); 1341 strcpy(ua->pcm->name, name);
1322 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); 1342 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); 1343 snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops);
1324 1344
@@ -1389,8 +1409,9 @@ static struct usb_device_id ua101_ids[] = {
1389#ifdef UA1A_HACK 1409#ifdef UA1A_HACK
1390 { USB_DEVICE(0x0582, 0x0018) }, 1410 { USB_DEVICE(0x0582, 0x0018) },
1391#endif 1411#endif
1392 { USB_DEVICE(0x0582, 0x007d) }, 1412 { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */
1393 { USB_DEVICE(0x0582, 0x008d) }, 1413 { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */
1414 { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */
1394 { } 1415 { }
1395}; 1416};
1396MODULE_DEVICE_TABLE(usb, ua101_ids); 1417MODULE_DEVICE_TABLE(usb, ua101_ids);