Skip to contentSkip to conversation

usb audio: make quirk handling more readable, and fix commented-out code

PATCH Applied Pavel Machek 2 participants 2 messages Mar 29, 2008 – Apr 14, 2008 Sound

lore
Share & tools
lore
#0 lore raw

usb audio contains useful debugging code, protected by #if
0. Unfortunately, it will not compile because variable names changed; fix it.

Dallas workaround is formatted in a way where it is not quite obvious what is normal code and what is quirk. Reformat it to make it obvious.

sound/usb/usbaudio.c +7 -6
index 257a4e1..b6b2490 100644
@@ -1427,9 +1433,9 @@ static int set_format(struct snd_usb_sub
 
 	subs->cur_audiofmt = fmt;
 
-#if 0
-	printk("setting done: format = %d, rate = %d, channels = %d\n",
-	       fmt->format, fmt->rate, fmt->channels);
+#if 0
+	printk("setting done: format = %d, rate = %d..%d, channels = %d\n",
+	       fmt->format, fmt->rate_min, fmt->rate_max, fmt->channels);
 	printk("  datapipe = 0x%0x, syncpipe = 0x%0x\n",
 	       subs->datapipe, subs->syncpipe);
 #endif
@@ -2464,11 +2470,12 @@ static int parse_audio_format_i_type(str
 		}
 		break;
 	case USB_AUDIO_FORMAT_PCM8:
-		/* Dallas DS4201 workaround */
+		pcm_format = SNDRV_PCM_FORMAT_U8;
+
+		/* Dallas DS4201 workaround: it advertises U8 format, but really
+		   supports S8. */
 		if (chip->usb_id == USB_ID(0x04fa, 0x4201))
 			pcm_format = SNDRV_PCM_FORMAT_S8;
-		else
-			pcm_format = SNDRV_PCM_FORMAT_U8;
 		break;
 	case USB_AUDIO_FORMAT_IEEE_FLOAT:
 		pcm_format = SNDRV_PCM_FORMAT_FLOAT_LE;
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Applied
#1 lore raw

At Sat, 29 Mar 2008 23:35:40 +0100,

Quoted 10 lines · Pavel Machek

usb audio contains useful debugging code, protected by #if
0. Unfortunately, it will not compile because variable names changed; fix it.

Dallas workaround is formatted in a way where it is not quite obvious what is normal code and what is quirk. Reformat it to make it obvious.

Applied to ALSA tree now. Thanks.

Takashi

Quoted 38 lines
sound/usb/usbaudio.c +7 -6
index 257a4e1..b6b2490 100644
@@ -1427,9 +1433,9 @@ static int set_format(struct snd_usb_sub
 
 	subs->cur_audiofmt = fmt;
 
-#if 0
-	printk("setting done: format = %d, rate = %d, channels = %d\n",
-	       fmt->format, fmt->rate, fmt->channels);
+#if 0
+	printk("setting done: format = %d, rate = %d..%d, channels = %d\n",
+	       fmt->format, fmt->rate_min, fmt->rate_max, fmt->channels);
 	printk("  datapipe = 0x%0x, syncpipe = 0x%0x\n",
 	       subs->datapipe, subs->syncpipe);
 #endif
@@ -2464,11 +2470,12 @@ static int parse_audio_format_i_type(str
 		}
 		break;
 	case USB_AUDIO_FORMAT_PCM8:
-		/* Dallas DS4201 workaround */
+		pcm_format = SNDRV_PCM_FORMAT_U8;
+
+		/* Dallas DS4201 workaround: it advertises U8 format, but really
+		   supports S8. */
 		if (chip->usb_id == USB_ID(0x04fa, 0x4201))
 			pcm_format = SNDRV_PCM_FORMAT_S8;
-		else
-			pcm_format = SNDRV_PCM_FORMAT_U8;
 		break;
 	case USB_AUDIO_FORMAT_IEEE_FLOAT:
 		pcm_format = SNDRV_PCM_FORMAT_FLOAT_LE;
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html