[ALSA] usb-audio: work around wrong frequency in CM6501 descriptors
authorClemens Ladisch <clemens@ladisch.de>
Mon, 20 Nov 2006 13:14:39 +0000 (14:14 +0100)
committerJaroslav Kysela <perex@suse.cz>
Tue, 9 Jan 2007 08:06:15 +0000 (09:06 +0100)
The C-Media CM6501 chip's descriptors say that altsetting 5 supports
48 kHz, but it actually plays at 96 kHz.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/usb/usbaudio.c

index 3d7f36fb4cf02b514a9599cbf8db64adb1cfa8b6..5f160eebd15cbbb1edefdd9f4bf206ac1ee0196d 100644 (file)
@@ -2471,7 +2471,13 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
                fp->nr_rates = nr_rates;
                fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
                for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
-                       unsigned int rate = fp->rate_table[r] = combine_triple(&fmt[idx]);
+                       unsigned int rate = combine_triple(&fmt[idx]);
+                       /* C-Media CM6501 mislabels its 96 kHz altsetting */
+                       if (rate == 48000 && nr_rates == 1 &&
+                           chip->usb_id == USB_ID(0x0d8c, 0x0201) &&
+                           fp->altsetting == 5 && fp->maxpacksize == 392)
+                               rate = 96000;
+                       fp->rate_table[r] = rate;
                        if (rate < fp->rate_min)
                                fp->rate_min = rate;
                        else if (rate > fp->rate_max)