aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/usb/card.c9
-rw-r--r--sound/usb/clock.c3
-rw-r--r--sound/usb/endpoint.c11
-rw-r--r--sound/usb/format.c22
-rw-r--r--sound/usb/mixer.c10
-rw-r--r--sound/usb/pcm.c3
6 files changed, 32 insertions, 26 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index b443a33d31c9..32e4be8a187c 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -216,6 +216,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
216 } 216 }
217 217
218 switch (protocol) { 218 switch (protocol) {
219 default:
220 snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n",
221 protocol);
222 /* fall through */
223
219 case UAC_VERSION_1: { 224 case UAC_VERSION_1: {
220 struct uac1_ac_header_descriptor *h1 = control_header; 225 struct uac1_ac_header_descriptor *h1 = control_header;
221 226
@@ -253,10 +258,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
253 258
254 break; 259 break;
255 } 260 }
256
257 default:
258 snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol);
259 return -EINVAL;
260 } 261 }
261 262
262 return 0; 263 return 0;
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index b853f8df794f..7754a1034545 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -295,12 +295,11 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
295 295
296 switch (altsd->bInterfaceProtocol) { 296 switch (altsd->bInterfaceProtocol) {
297 case UAC_VERSION_1: 297 case UAC_VERSION_1:
298 default:
298 return set_sample_rate_v1(chip, iface, alts, fmt, rate); 299 return set_sample_rate_v1(chip, iface, alts, fmt, rate);
299 300
300 case UAC_VERSION_2: 301 case UAC_VERSION_2:
301 return set_sample_rate_v2(chip, iface, alts, fmt, rate); 302 return set_sample_rate_v2(chip, iface, alts, fmt, rate);
302 } 303 }
303
304 return -EINVAL;
305} 304}
306 305
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 1a701f1e8f50..ef0a07e34844 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -275,6 +275,12 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
275 275
276 /* get audio formats */ 276 /* get audio formats */
277 switch (protocol) { 277 switch (protocol) {
278 default:
279 snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n",
280 dev->devnum, iface_no, altno, protocol);
281 protocol = UAC_VERSION_1;
282 /* fall through */
283
278 case UAC_VERSION_1: { 284 case UAC_VERSION_1: {
279 struct uac1_as_header_descriptor *as = 285 struct uac1_as_header_descriptor *as =
280 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 286 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
@@ -336,11 +342,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
336 dev->devnum, iface_no, altno, as->bTerminalLink); 342 dev->devnum, iface_no, altno, as->bTerminalLink);
337 continue; 343 continue;
338 } 344 }
339
340 default:
341 snd_printk(KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n",
342 dev->devnum, iface_no, altno, protocol);
343 continue;
344 } 345 }
345 346
346 /* get format type */ 347 /* get format type */
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 3a1375459c06..69148212aa70 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
49 u64 pcm_formats; 49 u64 pcm_formats;
50 50
51 switch (protocol) { 51 switch (protocol) {
52 case UAC_VERSION_1: { 52 case UAC_VERSION_1:
53 default: {
53 struct uac_format_type_i_discrete_descriptor *fmt = _fmt; 54 struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
54 sample_width = fmt->bBitResolution; 55 sample_width = fmt->bBitResolution;
55 sample_bytes = fmt->bSubframeSize; 56 sample_bytes = fmt->bSubframeSize;
@@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
64 format <<= 1; 65 format <<= 1;
65 break; 66 break;
66 } 67 }
67
68 default:
69 return -EINVAL;
70 } 68 }
71 69
72 pcm_formats = 0; 70 pcm_formats = 0;
@@ -384,6 +382,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
384 * audio class v2 uses class specific EP0 range requests for that. 382 * audio class v2 uses class specific EP0 range requests for that.
385 */ 383 */
386 switch (protocol) { 384 switch (protocol) {
385 default:
386 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
387 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
388 /* fall through */
387 case UAC_VERSION_1: 389 case UAC_VERSION_1:
388 fp->channels = fmt->bNrChannels; 390 fp->channels = fmt->bNrChannels;
389 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); 391 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
@@ -392,10 +394,6 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
392 /* fp->channels is already set in this case */ 394 /* fp->channels is already set in this case */
393 ret = parse_audio_format_rates_v2(chip, fp); 395 ret = parse_audio_format_rates_v2(chip, fp);
394 break; 396 break;
395 default:
396 snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
397 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
398 return -EINVAL;
399 } 397 }
400 398
401 if (fp->channels < 1) { 399 if (fp->channels < 1) {
@@ -438,6 +436,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
438 fp->channels = 1; 436 fp->channels = 1;
439 437
440 switch (protocol) { 438 switch (protocol) {
439 default:
440 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
441 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
442 /* fall through */
441 case UAC_VERSION_1: { 443 case UAC_VERSION_1: {
442 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; 444 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
443 brate = le16_to_cpu(fmt->wMaxBitRate); 445 brate = le16_to_cpu(fmt->wMaxBitRate);
@@ -456,10 +458,6 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
456 ret = parse_audio_format_rates_v2(chip, fp); 458 ret = parse_audio_format_rates_v2(chip, fp);
457 break; 459 break;
458 } 460 }
459 default:
460 snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
461 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
462 return -EINVAL;
463 } 461 }
464 462
465 return ret; 463 return ret;
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c166db0057d3..3ed3901369ce 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2175,7 +2175,15 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2175 } 2175 }
2176 2176
2177 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; 2177 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
2178 mixer->protocol = get_iface_desc(host_iface)->bInterfaceProtocol; 2178 switch (get_iface_desc(host_iface)->bInterfaceProtocol) {
2179 case UAC_VERSION_1:
2180 default:
2181 mixer->protocol = UAC_VERSION_1;
2182 break;
2183 case UAC_VERSION_2:
2184 mixer->protocol = UAC_VERSION_2;
2185 break;
2186 }
2179 2187
2180 if ((err = snd_usb_mixer_controls(mixer)) < 0 || 2188 if ((err = snd_usb_mixer_controls(mixer)) < 0 ||
2181 (err = snd_usb_mixer_status_create(mixer)) < 0) 2189 (err = snd_usb_mixer_status_create(mixer)) < 0)
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 3634cedf9306..3b5135c93062 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -173,13 +173,12 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
173 173
174 switch (altsd->bInterfaceProtocol) { 174 switch (altsd->bInterfaceProtocol) {
175 case UAC_VERSION_1: 175 case UAC_VERSION_1:
176 default:
176 return init_pitch_v1(chip, iface, alts, fmt); 177 return init_pitch_v1(chip, iface, alts, fmt);
177 178
178 case UAC_VERSION_2: 179 case UAC_VERSION_2:
179 return init_pitch_v2(chip, iface, alts, fmt); 180 return init_pitch_v2(chip, iface, alts, fmt);
180 } 181 }
181
182 return -EINVAL;
183} 182}
184 183
185/* 184/*