aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2010-08-13 15:42:07 -0400
committerTakashi Iwai <tiwai@suse.de>2010-08-14 04:30:08 -0400
commit4f4e8f69895c8696a4bcc751817d4b186023ac44 (patch)
tree602ca69d763218a50cfab862169e8194be191b5e /sound/usb
parent31cbd97726207b483a1731562559fabd4e2efdd0 (diff)
ALSA: usb: USB3 SuperSpeed sound support
This is V2 of the patch, after feedback from Clemens and Daniel. This patch adds SuperSpeed support to the USB drivers under sound/. It adds tests for USB_SPEED_SUPER to the appropriate places that check for the USB speed. This patch has been tested with our SS USB3 device emulating a set of Yamaha speakers and a Logitech microphone, but with the descriptors modified to add USB3 support. It has also been tested with the real speakers and microphone, to make sure that USB2 devices still work. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Daniel Mack <daniel@caiaq.de> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/card.c31
-rw-r--r--sound/usb/helper.c17
-rw-r--r--sound/usb/midi.c9
-rw-r--r--sound/usb/pcm.c4
-rw-r--r--sound/usb/proc.c2
-rw-r--r--sound/usb/urb.c2
6 files changed, 46 insertions, 19 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 9feb00c831a0..498a2d8fa4bb 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -299,9 +299,13 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
299 299
300 *rchip = NULL; 300 *rchip = NULL;
301 301
302 if (snd_usb_get_speed(dev) != USB_SPEED_LOW && 302 switch (snd_usb_get_speed(dev)) {
303 snd_usb_get_speed(dev) != USB_SPEED_FULL && 303 case USB_SPEED_LOW:
304 snd_usb_get_speed(dev) != USB_SPEED_HIGH) { 304 case USB_SPEED_FULL:
305 case USB_SPEED_HIGH:
306 case USB_SPEED_SUPER:
307 break;
308 default:
305 snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev)); 309 snd_printk(KERN_ERR "unknown device speed %d\n", snd_usb_get_speed(dev));
306 return -ENXIO; 310 return -ENXIO;
307 } 311 }
@@ -377,11 +381,22 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
377 if (len < sizeof(card->longname)) 381 if (len < sizeof(card->longname))
378 usb_make_path(dev, card->longname + len, sizeof(card->longname) - len); 382 usb_make_path(dev, card->longname + len, sizeof(card->longname) - len);
379 383
380 strlcat(card->longname, 384 switch (snd_usb_get_speed(dev)) {
381 snd_usb_get_speed(dev) == USB_SPEED_LOW ? ", low speed" : 385 case USB_SPEED_LOW:
382 snd_usb_get_speed(dev) == USB_SPEED_FULL ? ", full speed" : 386 strlcat(card->longname, ", low speed", sizeof(card->longname));
383 ", high speed", 387 break;
384 sizeof(card->longname)); 388 case USB_SPEED_FULL:
389 strlcat(card->longname, ", full speed", sizeof(card->longname));
390 break;
391 case USB_SPEED_HIGH:
392 strlcat(card->longname, ", high speed", sizeof(card->longname));
393 break;
394 case USB_SPEED_SUPER:
395 strlcat(card->longname, ", super speed", sizeof(card->longname));
396 break;
397 default:
398 break;
399 }
385 400
386 snd_usb_audio_create_proc(chip); 401 snd_usb_audio_create_proc(chip);
387 402
diff --git a/sound/usb/helper.c b/sound/usb/helper.c
index d48d6f8f6ac9..f280c1903c25 100644
--- a/sound/usb/helper.c
+++ b/sound/usb/helper.c
@@ -103,11 +103,16 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int pipe, __u8 request,
103unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip, 103unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
104 struct usb_host_interface *alts) 104 struct usb_host_interface *alts)
105{ 105{
106 if (snd_usb_get_speed(chip->dev) == USB_SPEED_HIGH && 106 switch (snd_usb_get_speed(chip->dev)) {
107 get_endpoint(alts, 0)->bInterval >= 1 && 107 case USB_SPEED_HIGH:
108 get_endpoint(alts, 0)->bInterval <= 4) 108 case USB_SPEED_SUPER:
109 return get_endpoint(alts, 0)->bInterval - 1; 109 if (get_endpoint(alts, 0)->bInterval >= 1 &&
110 else 110 get_endpoint(alts, 0)->bInterval <= 4)
111 return 0; 111 return get_endpoint(alts, 0)->bInterval - 1;
112 break;
113 default:
114 break;
115 }
116 return 0;
112} 117}
113 118
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index b9c2bc65f51a..156cd0716c42 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -834,7 +834,14 @@ static void snd_usbmidi_us122l_output(struct snd_usb_midi_out_endpoint *ep,
834 834
835 if (!ep->ports[0].active) 835 if (!ep->ports[0].active)
836 return; 836 return;
837 count = snd_usb_get_speed(ep->umidi->dev) == USB_SPEED_HIGH ? 1 : 2; 837 switch (snd_usb_get_speed(ep->umidi->dev)) {
838 case USB_SPEED_HIGH:
839 case USB_SPEED_SUPER:
840 count = 1;
841 break;
842 default:
843 count = 2;
844 }
838 count = snd_rawmidi_transmit(ep->ports[0].substream, 845 count = snd_rawmidi_transmit(ep->ports[0].substream,
839 urb->transfer_buffer, 846 urb->transfer_buffer,
840 count); 847 count);
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 456829882f40..ebd09acd186e 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -467,7 +467,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs,
467 return 0; 467 return 0;
468 } 468 }
469 /* check whether the period time is >= the data packet interval */ 469 /* check whether the period time is >= the data packet interval */
470 if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) { 470 if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) {
471 ptime = 125 * (1 << fp->datainterval); 471 ptime = 125 * (1 << fp->datainterval);
472 if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { 472 if (ptime > pt->max || (ptime == pt->max && pt->openmax)) {
473 hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); 473 hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max);
@@ -735,7 +735,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre
735 } 735 }
736 736
737 param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; 737 param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
738 if (snd_usb_get_speed(subs->dev) != USB_SPEED_HIGH) 738 if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
739 /* full speed devices have fixed data packet interval */ 739 /* full speed devices have fixed data packet interval */
740 ptmin = 1000; 740 ptmin = 1000;
741 if (ptmin == 1000) 741 if (ptmin == 1000)
diff --git a/sound/usb/proc.c b/sound/usb/proc.c
index f5e3f356b95f..3c650ab3c91d 100644
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -107,7 +107,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s
107 } 107 }
108 snd_iprintf(buffer, "\n"); 108 snd_iprintf(buffer, "\n");
109 } 109 }
110 if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) 110 if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL)
111 snd_iprintf(buffer, " Data packet interval: %d us\n", 111 snd_iprintf(buffer, " Data packet interval: %d us\n",
112 125 * (1 << fp->datainterval)); 112 125 * (1 << fp->datainterval));
113 // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); 113 // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
diff --git a/sound/usb/urb.c b/sound/usb/urb.c
index de607d4411ac..8deeaad10f10 100644
--- a/sound/usb/urb.c
+++ b/sound/usb/urb.c
@@ -244,7 +244,7 @@ int snd_usb_init_substream_urbs(struct snd_usb_substream *subs,
244 else 244 else
245 subs->curpacksize = maxsize; 245 subs->curpacksize = maxsize;
246 246
247 if (snd_usb_get_speed(subs->dev) == USB_SPEED_HIGH) 247 if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL)
248 packs_per_ms = 8 >> subs->datainterval; 248 packs_per_ms = 8 >> subs->datainterval;
249 else 249 else
250 packs_per_ms = 1; 250 packs_per_ms = 1;