diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-02-19 07:58:05 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-02-19 07:58:05 -0500 |
commit | e432472db2ca42366240c32c38dc36de424ac7cd (patch) | |
tree | 25a5cd284e9a92cbe93b34a643c41d1e7c25459c | |
parent | e6845d9101c5ad2b132473d515e77d74415f004b (diff) | |
parent | 3b03cc5b86e2052295b9b484f37226ee15c87924 (diff) |
Merge branch 'fix/usb-audio' into for-linus
-rw-r--r-- | sound/usb/usbaudio.c | 20 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 1 |
2 files changed, 12 insertions, 9 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2ab83129d9b0..19e37451c216 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2524 | * build the rate table and bitmap flags | 2524 | * build the rate table and bitmap flags |
2525 | */ | 2525 | */ |
2526 | int r, idx; | 2526 | int r, idx; |
2527 | unsigned int nonzero_rates = 0; | ||
2528 | 2527 | ||
2529 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); | 2528 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); |
2530 | if (fp->rate_table == NULL) { | 2529 | if (fp->rate_table == NULL) { |
@@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2532 | return -1; | 2531 | return -1; |
2533 | } | 2532 | } |
2534 | 2533 | ||
2535 | fp->nr_rates = nr_rates; | 2534 | fp->nr_rates = 0; |
2536 | fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); | 2535 | fp->rate_min = fp->rate_max = 0; |
2537 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { | 2536 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { |
2538 | unsigned int rate = combine_triple(&fmt[idx]); | 2537 | unsigned int rate = combine_triple(&fmt[idx]); |
2538 | if (!rate) | ||
2539 | continue; | ||
2539 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ | 2540 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
2540 | if (rate == 48000 && nr_rates == 1 && | 2541 | if (rate == 48000 && nr_rates == 1 && |
2541 | chip->usb_id == USB_ID(0x0d8c, 0x0201) && | 2542 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
2543 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | ||
2542 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2544 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2543 | rate = 96000; | 2545 | rate = 96000; |
2544 | fp->rate_table[r] = rate; | 2546 | fp->rate_table[fp->nr_rates] = rate; |
2545 | nonzero_rates |= rate; | 2547 | if (!fp->rate_min || rate < fp->rate_min) |
2546 | if (rate < fp->rate_min) | ||
2547 | fp->rate_min = rate; | 2548 | fp->rate_min = rate; |
2548 | else if (rate > fp->rate_max) | 2549 | if (!fp->rate_max || rate > fp->rate_max) |
2549 | fp->rate_max = rate; | 2550 | fp->rate_max = rate; |
2550 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); | 2551 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); |
2552 | fp->nr_rates++; | ||
2551 | } | 2553 | } |
2552 | if (!nonzero_rates) { | 2554 | if (!fp->nr_rates) { |
2553 | hwc_debug("All rates were zero. Skipping format!\n"); | 2555 | hwc_debug("All rates were zero. Skipping format!\n"); |
2554 | return -1; | 2556 | return -1; |
2555 | } | 2557 | } |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 320641ab5be7..26bad373fe65 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; |
1628 | ep_info.out_interval = 0; | ||
1628 | ep_info.out_cables = endpoint->out_cables & 0x5555; | 1629 | ep_info.out_cables = endpoint->out_cables & 0x5555; |
1629 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 1630 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); |
1630 | if (err < 0) | 1631 | if (err < 0) |