diff options
Diffstat (limited to 'sound/usb/ua101.c')
-rw-r--r-- | sound/usb/ua101.c | 45 |
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 @@ /* - * Edirol UA-101 driver + * Edirol UA-101/UA-1000 driver * Copyright (c) Clemens Ladisch <clemens@ladisch.de> * * This driver is free software: you can redistribute it and/or modify @@ -25,10 +25,10 @@ #include <sound/pcm_params.h> #include "usbaudio.h" -MODULE_DESCRIPTION("Edirol UA-101 driver"); +MODULE_DESCRIPTION("Edirol UA-101/1000 driver"); MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); MODULE_LICENSE("GPL v2"); -MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101}}"); +MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); /* I use my UA-1A for testing because I don't have a UA-101 ... */ #define UA1A_HACK @@ -1200,13 +1200,30 @@ static int ua101_probe(struct usb_interface *interface, .type = QUIRK_MIDI_FIXED_ENDPOINT, .data = &midi_ep }; + static const int intf_numbers[2][3] = { + { /* UA-101 */ + [INTF_PLAYBACK] = 0, + [INTF_CAPTURE] = 1, + [INTF_MIDI] = 2, + }, + { /* UA-1000 */ + [INTF_CAPTURE] = 1, + [INTF_PLAYBACK] = 2, + [INTF_MIDI] = 3, + }, + }; struct snd_card *card; struct ua101 *ua; unsigned int card_index, i; + int is_ua1000; + const char *name; char usb_path[32]; int err; - if (interface->altsetting->desc.bInterfaceNumber != 0) + is_ua1000 = usb_id->idProduct == 0x0044; + + if (interface->altsetting->desc.bInterfaceNumber != + intf_numbers[is_ua1000][0]) return -ENODEV; mutex_lock(&devices_mutex); @@ -1250,9 +1267,11 @@ static int ua101_probe(struct usb_interface *interface, #endif ua->intf[0] = interface; for (i = 1; i < ARRAY_SIZE(ua->intf); ++i) { - ua->intf[i] = usb_ifnum_to_if(ua->dev, i); + ua->intf[i] = usb_ifnum_to_if(ua->dev, + intf_numbers[is_ua1000][i]); if (!ua->intf[i]) { - dev_err(&ua->dev->dev, "interface %u not found\n", i); + dev_err(&ua->dev->dev, "interface %u not found\n", + intf_numbers[is_ua1000][i]); err = -ENXIO; goto probe_error; } @@ -1292,11 +1311,12 @@ static int ua101_probe(struct usb_interface *interface, } #endif + name = usb_id->idProduct == 0x0044 ? "UA-1000" : "UA-101"; strcpy(card->driver, "UA-101"); - strcpy(card->shortname, "UA-101"); + strcpy(card->shortname, name); usb_make_path(ua->dev, usb_path, sizeof(usb_path)); snprintf(ua->card->longname, sizeof(ua->card->longname), - "EDIROL UA-101 (serial %s), %u Hz at %s, %s speed", + "EDIROL %s (serial %s), %u Hz at %s, %s speed", name, ua->dev->serial ? ua->dev->serial : "?", ua->rate, usb_path, ua->dev->speed == USB_SPEED_HIGH ? "high" : "full"); @@ -1314,11 +1334,11 @@ static int ua101_probe(struct usb_interface *interface, if (err < 0) goto probe_error; - err = snd_pcm_new(card, "UA-101", 0, 1, 1, &ua->pcm); + err = snd_pcm_new(card, name, 0, 1, 1, &ua->pcm); if (err < 0) goto probe_error; ua->pcm->private_data = ua; - strcpy(ua->pcm->name, "UA-101"); + strcpy(ua->pcm->name, name); snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_PLAYBACK, &playback_pcm_ops); snd_pcm_set_ops(ua->pcm, SNDRV_PCM_STREAM_CAPTURE, &capture_pcm_ops); @@ -1389,8 +1409,9 @@ static struct usb_device_id ua101_ids[] = { #ifdef UA1A_HACK { USB_DEVICE(0x0582, 0x0018) }, #endif - { USB_DEVICE(0x0582, 0x007d) }, - { USB_DEVICE(0x0582, 0x008d) }, + { USB_DEVICE(0x0582, 0x0044) }, /* UA-1000 high speed */ + { USB_DEVICE(0x0582, 0x007d) }, /* UA-101 high speed */ + { USB_DEVICE(0x0582, 0x008d) }, /* UA-101 full speed */ { } }; MODULE_DEVICE_TABLE(usb, ua101_ids); |