[alsa-devel] [PATCH] Workaround for misdetected sample rate with CM6207

Joris van Rantwijk jorispubl at xs4all.nl
Sat Feb 14 22:22:05 CET 2009


Summary: Workaround for misdetected sample rate with CM6207

The CM6207 incorrectly advertises its 96 kHz playback setting as 48 kHz
in its USB device descriptor. This patch extends an existing workaround
in usbaudio.c to also cover the CM6207.

This resolves issue 0004249 in the ALSA bug tracker.

Signed-off by: Joris van Rantwijk <jorispubl at xs4all.nl>

diff -ur linux-2.6.28.4/sound/usb/usbaudio.c linux-2.6.28.4_j/sound/usb/usbaudio.c
--- linux-2.6.28.4/sound/usb/usbaudio.c	2009-02-13 21:45:17.000000000 +0100
+++ linux-2.6.28.4_j/sound/usb/usbaudio.c	2009-02-13 22:00:44.000000000 +0100
@@ -2533,19 +2533,20 @@
 		}
 
 		fp->nr_rates = nr_rates;
-		fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
+		fp->rate_min = fp->rate_max = 0;
 		for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
 			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) &&
+                            (chip->usb_id == USB_ID(0x0d8c, 0x0201) ||
+                             chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
 			    fp->altsetting == 5 && fp->maxpacksize == 392)
 				rate = 96000;
 			fp->rate_table[r] = rate;
 			nonzero_rates |= rate;
-			if (rate < fp->rate_min)
+			if (r == 0 || rate < fp->rate_min)
 				fp->rate_min = rate;
-			else if (rate > fp->rate_max)
+			else if (r == 0 || rate > fp->rate_max)
 				fp->rate_max = rate;
 			fp->rates |= snd_pcm_rate_to_rate_bit(rate);
 		}


More information about the Alsa-devel mailing list