aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/card.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r--sound/usb/card.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 7a8ac1d81be..800f7cb4f25 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -126,7 +126,7 @@ static void snd_usb_stream_disconnect(struct list_head *head)
126 for (idx = 0; idx < 2; idx++) { 126 for (idx = 0; idx < 2; idx++) {
127 subs = &as->substream[idx]; 127 subs = &as->substream[idx];
128 if (!subs->num_formats) 128 if (!subs->num_formats)
129 return; 129 continue;
130 snd_usb_release_substream_urbs(subs, 1); 130 snd_usb_release_substream_urbs(subs, 1);
131 subs->interface = -1; 131 subs->interface = -1;
132 } 132 }
@@ -216,8 +216,13 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
216 } 216 }
217 217
218 switch (protocol) { 218 switch (protocol) {
219 default:
220 snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n",
221 protocol);
222 /* fall through */
223
219 case UAC_VERSION_1: { 224 case UAC_VERSION_1: {
220 struct uac_ac_header_descriptor_v1 *h1 = control_header; 225 struct uac1_ac_header_descriptor *h1 = control_header;
221 226
222 if (!h1->bInCollection) { 227 if (!h1->bInCollection) {
223 snd_printk(KERN_INFO "skipping empty audio interface (v1)\n"); 228 snd_printk(KERN_INFO "skipping empty audio interface (v1)\n");
@@ -253,10 +258,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
253 258
254 break; 259 break;
255 } 260 }
256
257 default:
258 snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol);
259 return -EINVAL;
260 } 261 }
261 262
262 return 0; 263 return 0;
@@ -299,9 +300,13 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
299 300
300 *rchip = NULL; 301 *rchip = NULL;
301 302
302 if (snd_usb_get_speed(dev) != USB_SPEED_LOW && 303 switch (snd_usb_get_speed(dev)) {
303 snd_usb_get_speed(dev) != USB_SPEED_FULL && 304 case USB_SPEED_LOW:
304 snd_usb_get_speed(dev) != USB_SPEED_HIGH) { 305 case USB_SPEED_FULL:
306 case USB_SPEED_HIGH:
307 case USB_SPEED_SUPER:
308 break;
309 default:
305 snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev)); 310 snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev));
306 return -ENXIO; 311 return -ENXIO;
307 } 312 }
@@ -377,11 +382,22 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
377 if (len < sizeof(card->longname)) 382 if (len < sizeof(card->longname))
378 usb_make_path(dev, card->longname + len, sizeof(card->longname) - len); 383 usb_make_path(dev, card->longname + len, sizeof(card->longname) - len);
379 384
380 strlcat(card->longname, 385 switch (snd_usb_get_speed(dev)) {
381 snd_usb_get_speed(dev) == USB_SPEED_LOW ? ", low speed" : 386 case USB_SPEED_LOW:
382 snd_usb_get_speed(dev) == USB_SPEED_FULL ? ", full speed" : 387 strlcat(card->longname, ", low speed", sizeof(card->longname));
383 ", high speed", 388 break;
384 sizeof(card->longname)); 389 case USB_SPEED_FULL:
390 strlcat(card->longname, ", full speed", sizeof(card->longname));
391 break;
392 case USB_SPEED_HIGH:
393 strlcat(card->longname, ", high speed", sizeof(card->longname));
394 break;
395 case USB_SPEED_SUPER:
396 strlcat(card->longname, ", super speed", sizeof(card->longname));
397 break;
398 default:
399 break;
400 }
385 401
386 snd_usb_audio_create_proc(chip); 402 snd_usb_audio_create_proc(chip);
387 403
@@ -465,7 +481,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
465 goto __error; 481 goto __error;
466 } 482 }
467 483
468 chip->ctrl_intf = alts; 484 /*
485 * For devices with more than one control interface, we assume the
486 * first contains the audio controls. We might need a more specific
487 * check here in the future.
488 */
489 if (!chip->ctrl_intf)
490 chip->ctrl_intf = alts;
469 491
470 if (err > 0) { 492 if (err > 0) {
471 /* create normal USB audio interfaces */ 493 /* create normal USB audio interfaces */