aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-05-02 02:51:26 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:05:47 -0400
commit27d10f5664c7650af3b2ffadfefaf19b36dc7bd8 (patch)
treeb89c8d639041f460557bf6e9078c7cee7426cd2b /sound/usb/usbaudio.c
parentb259b10c420a59a2fdbcf5a3498253ebcbdffa1e (diff)
[ALSA] usb-audio - cache vendor/product IDs
USB generic driver Cache the decoded values of idVendor/idProduct to get rid of most of those ugly le16_to_cpu() calls. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c104
1 files changed, 50 insertions, 54 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index eeb09bb8cbf3..e759b73942c2 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -2184,17 +2184,15 @@ static int add_audio_endpoint(snd_usb_audio_t *chip, int stream, struct audiofor
2184/* 2184/*
2185 * check if the device uses big-endian samples 2185 * check if the device uses big-endian samples
2186 */ 2186 */
2187static int is_big_endian_format(struct usb_device *dev, struct audioformat *fp) 2187static int is_big_endian_format(snd_usb_audio_t *chip, struct audioformat *fp)
2188{ 2188{
2189 /* M-Audio */ 2189 switch (chip->usb_id) {
2190 if (le16_to_cpu(dev->descriptor.idVendor) == 0x0763) { 2190 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */
2191 /* Quattro: captured data only */ 2191 if (fp->endpoint & USB_DIR_IN)
2192 if (le16_to_cpu(dev->descriptor.idProduct) == 0x2001 &&
2193 fp->endpoint & USB_DIR_IN)
2194 return 1;
2195 /* Audiophile USB */
2196 if (le16_to_cpu(dev->descriptor.idProduct) == 0x2003)
2197 return 1; 2192 return 1;
2193 break;
2194 case USB_ID(0x0763, 0x2003): /* M-Audio Audiophile USB */
2195 return 1;
2198 } 2196 }
2199 return 0; 2197 return 0;
2200} 2198}
@@ -2208,7 +2206,7 @@ static int is_big_endian_format(struct usb_device *dev, struct audioformat *fp)
2208 * @format: the format tag (wFormatTag) 2206 * @format: the format tag (wFormatTag)
2209 * @fmt: the format type descriptor 2207 * @fmt: the format type descriptor
2210 */ 2208 */
2211static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat *fp, 2209static int parse_audio_format_i_type(snd_usb_audio_t *chip, struct audioformat *fp,
2212 int format, unsigned char *fmt) 2210 int format, unsigned char *fmt)
2213{ 2211{
2214 int pcm_format; 2212 int pcm_format;
@@ -2221,12 +2219,12 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
2221 switch (format) { 2219 switch (format) {
2222 case 0: /* some devices don't define this correctly... */ 2220 case 0: /* some devices don't define this correctly... */
2223 snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", 2221 snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n",
2224 dev->devnum, fp->iface, fp->altsetting); 2222 chip->dev->devnum, fp->iface, fp->altsetting);
2225 /* fall-through */ 2223 /* fall-through */
2226 case USB_AUDIO_FORMAT_PCM: 2224 case USB_AUDIO_FORMAT_PCM:
2227 if (sample_width > sample_bytes * 8) { 2225 if (sample_width > sample_bytes * 8) {
2228 snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n", 2226 snd_printk(KERN_INFO "%d:%u:%d : sample bitwidth %d in over sample bytes %d\n",
2229 dev->devnum, fp->iface, fp->altsetting, 2227 chip->dev->devnum, fp->iface, fp->altsetting,
2230 sample_width, sample_bytes); 2228 sample_width, sample_bytes);
2231 } 2229 }
2232 /* check the format byte size */ 2230 /* check the format byte size */
@@ -2235,13 +2233,13 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
2235 pcm_format = SNDRV_PCM_FORMAT_S8; 2233 pcm_format = SNDRV_PCM_FORMAT_S8;
2236 break; 2234 break;
2237 case 2: 2235 case 2:
2238 if (is_big_endian_format(dev, fp)) 2236 if (is_big_endian_format(chip, fp))
2239 pcm_format = SNDRV_PCM_FORMAT_S16_BE; /* grrr, big endian!! */ 2237 pcm_format = SNDRV_PCM_FORMAT_S16_BE; /* grrr, big endian!! */
2240 else 2238 else
2241 pcm_format = SNDRV_PCM_FORMAT_S16_LE; 2239 pcm_format = SNDRV_PCM_FORMAT_S16_LE;
2242 break; 2240 break;
2243 case 3: 2241 case 3:
2244 if (is_big_endian_format(dev, fp)) 2242 if (is_big_endian_format(chip, fp))
2245 pcm_format = SNDRV_PCM_FORMAT_S24_3BE; /* grrr, big endian!! */ 2243 pcm_format = SNDRV_PCM_FORMAT_S24_3BE; /* grrr, big endian!! */
2246 else 2244 else
2247 pcm_format = SNDRV_PCM_FORMAT_S24_3LE; 2245 pcm_format = SNDRV_PCM_FORMAT_S24_3LE;
@@ -2251,14 +2249,14 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
2251 break; 2249 break;
2252 default: 2250 default:
2253 snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n", 2251 snd_printk(KERN_INFO "%d:%u:%d : unsupported sample bitwidth %d in %d bytes\n",
2254 dev->devnum, fp->iface, fp->altsetting, sample_width, sample_bytes); 2252 chip->dev->devnum, fp->iface,
2253 fp->altsetting, sample_width, sample_bytes);
2255 break; 2254 break;
2256 } 2255 }
2257 break; 2256 break;
2258 case USB_AUDIO_FORMAT_PCM8: 2257 case USB_AUDIO_FORMAT_PCM8:
2259 /* Dallas DS4201 workaround */ 2258 /* Dallas DS4201 workaround */
2260 if (le16_to_cpu(dev->descriptor.idVendor) == 0x04fa && 2259 if (chip->usb_id == USB_ID(0x04fa, 0x4201))
2261 le16_to_cpu(dev->descriptor.idProduct) == 0x4201)
2262 pcm_format = SNDRV_PCM_FORMAT_S8; 2260 pcm_format = SNDRV_PCM_FORMAT_S8;
2263 else 2261 else
2264 pcm_format = SNDRV_PCM_FORMAT_U8; 2262 pcm_format = SNDRV_PCM_FORMAT_U8;
@@ -2274,7 +2272,7 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
2274 break; 2272 break;
2275 default: 2273 default:
2276 snd_printk(KERN_INFO "%d:%u:%d : unsupported format type %d\n", 2274 snd_printk(KERN_INFO "%d:%u:%d : unsupported format type %d\n",
2277 dev->devnum, fp->iface, fp->altsetting, format); 2275 chip->dev->devnum, fp->iface, fp->altsetting, format);
2278 break; 2276 break;
2279 } 2277 }
2280 return pcm_format; 2278 return pcm_format;
@@ -2291,13 +2289,13 @@ static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat
2291 * @offset: the start offset of descriptor pointing the rate type 2289 * @offset: the start offset of descriptor pointing the rate type
2292 * (7 for type I and II, 8 for type II) 2290 * (7 for type I and II, 8 for type II)
2293 */ 2291 */
2294static int parse_audio_format_rates(struct usb_device *dev, struct audioformat *fp, 2292static int parse_audio_format_rates(snd_usb_audio_t *chip, struct audioformat *fp,
2295 unsigned char *fmt, int offset) 2293 unsigned char *fmt, int offset)
2296{ 2294{
2297 int nr_rates = fmt[offset]; 2295 int nr_rates = fmt[offset];
2298 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { 2296 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) {
2299 snd_printk(KERN_ERR "%d:%u:%d : invalid FORMAT_TYPE desc\n", 2297 snd_printk(KERN_ERR "%d:%u:%d : invalid FORMAT_TYPE desc\n",
2300 dev->devnum, fp->iface, fp->altsetting); 2298 chip->dev->devnum, fp->iface, fp->altsetting);
2301 return -1; 2299 return -1;
2302 } 2300 }
2303 2301
@@ -2344,7 +2342,7 @@ static int parse_audio_format_rates(struct usb_device *dev, struct audioformat *
2344/* 2342/*
2345 * parse the format type I and III descriptors 2343 * parse the format type I and III descriptors
2346 */ 2344 */
2347static int parse_audio_format_i(struct usb_device *dev, struct audioformat *fp, 2345static int parse_audio_format_i(snd_usb_audio_t *chip, struct audioformat *fp,
2348 int format, unsigned char *fmt) 2346 int format, unsigned char *fmt)
2349{ 2347{
2350 int pcm_format; 2348 int pcm_format;
@@ -2356,7 +2354,7 @@ static int parse_audio_format_i(struct usb_device *dev, struct audioformat *fp,
2356 */ 2354 */
2357 pcm_format = SNDRV_PCM_FORMAT_S16_LE; 2355 pcm_format = SNDRV_PCM_FORMAT_S16_LE;
2358 } else { 2356 } else {
2359 pcm_format = parse_audio_format_i_type(dev, fp, format, fmt); 2357 pcm_format = parse_audio_format_i_type(chip, fp, format, fmt);
2360 if (pcm_format < 0) 2358 if (pcm_format < 0)
2361 return -1; 2359 return -1;
2362 } 2360 }
@@ -2364,16 +2362,16 @@ static int parse_audio_format_i(struct usb_device *dev, struct audioformat *fp,
2364 fp->channels = fmt[4]; 2362 fp->channels = fmt[4];
2365 if (fp->channels < 1) { 2363 if (fp->channels < 1) {
2366 snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", 2364 snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n",
2367 dev->devnum, fp->iface, fp->altsetting, fp->channels); 2365 chip->dev->devnum, fp->iface, fp->altsetting, fp->channels);
2368 return -1; 2366 return -1;
2369 } 2367 }
2370 return parse_audio_format_rates(dev, fp, fmt, 7); 2368 return parse_audio_format_rates(chip, fp, fmt, 7);
2371} 2369}
2372 2370
2373/* 2371/*
2374 * prase the format type II descriptor 2372 * prase the format type II descriptor
2375 */ 2373 */
2376static int parse_audio_format_ii(struct usb_device *dev, struct audioformat *fp, 2374static int parse_audio_format_ii(snd_usb_audio_t *chip, struct audioformat *fp,
2377 int format, unsigned char *fmt) 2375 int format, unsigned char *fmt)
2378{ 2376{
2379 int brate, framesize; 2377 int brate, framesize;
@@ -2388,7 +2386,7 @@ static int parse_audio_format_ii(struct usb_device *dev, struct audioformat *fp,
2388 break; 2386 break;
2389 default: 2387 default:
2390 snd_printd(KERN_INFO "%d:%u:%d : unknown format tag 0x%x is detected. processed as MPEG.\n", 2388 snd_printd(KERN_INFO "%d:%u:%d : unknown format tag 0x%x is detected. processed as MPEG.\n",
2391 dev->devnum, fp->iface, fp->altsetting, format); 2389 chip->dev->devnum, fp->iface, fp->altsetting, format);
2392 fp->format = SNDRV_PCM_FORMAT_MPEG; 2390 fp->format = SNDRV_PCM_FORMAT_MPEG;
2393 break; 2391 break;
2394 } 2392 }
@@ -2397,10 +2395,10 @@ static int parse_audio_format_ii(struct usb_device *dev, struct audioformat *fp,
2397 framesize = combine_word(&fmt[6]); /* fmt[6,7]: wSamplesPerFrame */ 2395 framesize = combine_word(&fmt[6]); /* fmt[6,7]: wSamplesPerFrame */
2398 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 2396 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);
2399 fp->frame_size = framesize; 2397 fp->frame_size = framesize;
2400 return parse_audio_format_rates(dev, fp, fmt, 8); /* fmt[8..] sample rates */ 2398 return parse_audio_format_rates(chip, fp, fmt, 8); /* fmt[8..] sample rates */
2401} 2399}
2402 2400
2403static int parse_audio_format(struct usb_device *dev, struct audioformat *fp, 2401static int parse_audio_format(snd_usb_audio_t *chip, struct audioformat *fp,
2404 int format, unsigned char *fmt, int stream) 2402 int format, unsigned char *fmt, int stream)
2405{ 2403{
2406 int err; 2404 int err;
@@ -2408,14 +2406,14 @@ static int parse_audio_format(struct usb_device *dev, struct audioformat *fp,
2408 switch (fmt[3]) { 2406 switch (fmt[3]) {
2409 case USB_FORMAT_TYPE_I: 2407 case USB_FORMAT_TYPE_I:
2410 case USB_FORMAT_TYPE_III: 2408 case USB_FORMAT_TYPE_III:
2411 err = parse_audio_format_i(dev, fp, format, fmt); 2409 err = parse_audio_format_i(chip, fp, format, fmt);
2412 break; 2410 break;
2413 case USB_FORMAT_TYPE_II: 2411 case USB_FORMAT_TYPE_II:
2414 err = parse_audio_format_ii(dev, fp, format, fmt); 2412 err = parse_audio_format_ii(chip, fp, format, fmt);
2415 break; 2413 break;
2416 default: 2414 default:
2417 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", 2415 snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n",
2418 dev->devnum, fp->iface, fp->altsetting, fmt[3]); 2416 chip->dev->devnum, fp->iface, fp->altsetting, fmt[3]);
2419 return -1; 2417 return -1;
2420 } 2418 }
2421 fp->fmt_type = fmt[3]; 2419 fp->fmt_type = fmt[3];
@@ -2426,9 +2424,8 @@ static int parse_audio_format(struct usb_device *dev, struct audioformat *fp,
2426 /* extigy apparently supports sample rates other than 48k 2424 /* extigy apparently supports sample rates other than 48k
2427 * but not in ordinary way. so we enable only 48k atm. 2425 * but not in ordinary way. so we enable only 48k atm.
2428 */ 2426 */
2429 if (le16_to_cpu(dev->descriptor.idVendor) == 0x041e && 2427 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||
2430 (le16_to_cpu(dev->descriptor.idProduct) == 0x3000 || 2428 chip->usb_id == USB_ID(0x041e, 0x3020)) {
2431 le16_to_cpu(dev->descriptor.idProduct) == 0x3020)) {
2432 if (fmt[3] == USB_FORMAT_TYPE_I && 2429 if (fmt[3] == USB_FORMAT_TYPE_I &&
2433 stream == SNDRV_PCM_STREAM_PLAYBACK && 2430 stream == SNDRV_PCM_STREAM_PLAYBACK &&
2434 fp->rates != SNDRV_PCM_RATE_48000 && 2431 fp->rates != SNDRV_PCM_RATE_48000 &&
@@ -2532,8 +2529,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2532 /* some quirks for attributes here */ 2529 /* some quirks for attributes here */
2533 2530
2534 /* workaround for AudioTrak Optoplay */ 2531 /* workaround for AudioTrak Optoplay */
2535 if (le16_to_cpu(dev->descriptor.idVendor) == 0x0a92 && 2532 if (chip->usb_id == USB_ID(0x0a92, 0x0053)) {
2536 le16_to_cpu(dev->descriptor.idProduct) == 0x0053) {
2537 /* Optoplay sets the sample rate attribute although 2533 /* Optoplay sets the sample rate attribute although
2538 * it seems not supporting it in fact. 2534 * it seems not supporting it in fact.
2539 */ 2535 */
@@ -2541,8 +2537,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2541 } 2537 }
2542 2538
2543 /* workaround for M-Audio Audiophile USB */ 2539 /* workaround for M-Audio Audiophile USB */
2544 if (le16_to_cpu(dev->descriptor.idVendor) == 0x0763 && 2540 if (chip->usb_id == USB_ID(0x0763, 0x2003)) {
2545 le16_to_cpu(dev->descriptor.idProduct) == 0x2003) {
2546 /* doesn't set the sample rate attribute, but supports it */ 2541 /* doesn't set the sample rate attribute, but supports it */
2547 fp->attributes |= EP_CS_ATTR_SAMPLE_RATE; 2542 fp->attributes |= EP_CS_ATTR_SAMPLE_RATE;
2548 } 2543 }
@@ -2551,11 +2546,9 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2551 * plantronics headset and Griffin iMic have set adaptive-in 2546 * plantronics headset and Griffin iMic have set adaptive-in
2552 * although it's really not... 2547 * although it's really not...
2553 */ 2548 */
2554 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x047f && 2549 if (chip->usb_id == USB_ID(0x047f, 0x0ca1) ||
2555 le16_to_cpu(dev->descriptor.idProduct) == 0x0ca1) ||
2556 /* Griffin iMic (note that there is an older model 77d:223) */ 2550 /* Griffin iMic (note that there is an older model 77d:223) */
2557 (le16_to_cpu(dev->descriptor.idVendor) == 0x077d && 2551 chip->usb_id == USB_ID(0x077d, 0x07af)) {
2558 le16_to_cpu(dev->descriptor.idProduct) == 0x07af)) {
2559 fp->ep_attr &= ~EP_ATTR_MASK; 2552 fp->ep_attr &= ~EP_ATTR_MASK;
2560 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 2553 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
2561 fp->ep_attr |= EP_ATTR_ADAPTIVE; 2554 fp->ep_attr |= EP_ATTR_ADAPTIVE;
@@ -2564,7 +2557,7 @@ static int parse_audio_endpoints(snd_usb_audio_t *chip, int iface_no)
2564 } 2557 }
2565 2558
2566 /* ok, let's parse further... */ 2559 /* ok, let's parse further... */
2567 if (parse_audio_format(dev, fp, format, fmt, stream) < 0) { 2560 if (parse_audio_format(chip, fp, format, fmt, stream) < 0) {
2568 kfree(fp->rate_table); 2561 kfree(fp->rate_table);
2569 kfree(fp); 2562 kfree(fp);
2570 continue; 2563 continue;
@@ -2799,7 +2792,7 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip,
2799 .type = QUIRK_MIDI_FIXED_ENDPOINT, 2792 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2800 .data = &ua25_ep 2793 .data = &ua25_ep
2801 }; 2794 };
2802 if (le16_to_cpu(chip->dev->descriptor.idProduct) == 0x002b) 2795 if (chip->usb_id == USB_ID(0x0582, 0x002b))
2803 return snd_usb_create_midi_interface(chip, iface, 2796 return snd_usb_create_midi_interface(chip, iface,
2804 &ua700_quirk); 2797 &ua700_quirk);
2805 else 2798 else
@@ -3018,8 +3011,8 @@ static void proc_audio_usbid_read(snd_info_entry_t *entry, snd_info_buffer_t *bu
3018 snd_usb_audio_t *chip = entry->private_data; 3011 snd_usb_audio_t *chip = entry->private_data;
3019 if (! chip->shutdown) 3012 if (! chip->shutdown)
3020 snd_iprintf(buffer, "%04x:%04x\n", 3013 snd_iprintf(buffer, "%04x:%04x\n",
3021 le16_to_cpu(chip->dev->descriptor.idVendor), 3014 USB_ID_VENDOR(chip->usb_id),
3022 le16_to_cpu(chip->dev->descriptor.idProduct)); 3015 USB_ID_PRODUCT(chip->usb_id));
3023} 3016}
3024 3017
3025static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) 3018static void snd_usb_audio_create_proc(snd_usb_audio_t *chip)
@@ -3089,6 +3082,8 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3089 chip->index = idx; 3082 chip->index = idx;
3090 chip->dev = dev; 3083 chip->dev = dev;
3091 chip->card = card; 3084 chip->card = card;
3085 chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
3086 le16_to_cpu(dev->descriptor.idProduct));
3092 INIT_LIST_HEAD(&chip->pcm_list); 3087 INIT_LIST_HEAD(&chip->pcm_list);
3093 INIT_LIST_HEAD(&chip->midi_list); 3088 INIT_LIST_HEAD(&chip->midi_list);
3094 INIT_LIST_HEAD(&chip->mixer_list); 3089 INIT_LIST_HEAD(&chip->mixer_list);
@@ -3101,8 +3096,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3101 3096
3102 strcpy(card->driver, "USB-Audio"); 3097 strcpy(card->driver, "USB-Audio");
3103 sprintf(component, "USB%04x:%04x", 3098 sprintf(component, "USB%04x:%04x",
3104 le16_to_cpu(dev->descriptor.idVendor), 3099 USB_ID_VENDOR(chip->usb_id), USB_ID_PRODUCT(chip->usb_id));
3105 le16_to_cpu(dev->descriptor.idProduct));
3106 snd_component_add(card, component); 3100 snd_component_add(card, component);
3107 3101
3108 /* retrieve the device string as shortname */ 3102 /* retrieve the device string as shortname */
@@ -3114,8 +3108,8 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3114 card->shortname, sizeof(card->shortname)) <= 0) { 3108 card->shortname, sizeof(card->shortname)) <= 0) {
3115 /* no name available from anywhere, so use ID */ 3109 /* no name available from anywhere, so use ID */
3116 sprintf(card->shortname, "USB Device %#04x:%#04x", 3110 sprintf(card->shortname, "USB Device %#04x:%#04x",
3117 le16_to_cpu(dev->descriptor.idVendor), 3111 USB_ID_VENDOR(chip->usb_id),
3118 le16_to_cpu(dev->descriptor.idProduct)); 3112 USB_ID_PRODUCT(chip->usb_id));
3119 } 3113 }
3120 } 3114 }
3121 3115
@@ -3173,17 +3167,19 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3173 snd_usb_audio_t *chip; 3167 snd_usb_audio_t *chip;
3174 struct usb_host_interface *alts; 3168 struct usb_host_interface *alts;
3175 int ifnum; 3169 int ifnum;
3170 u32 id;
3176 3171
3177 alts = &intf->altsetting[0]; 3172 alts = &intf->altsetting[0];
3178 ifnum = get_iface_desc(alts)->bInterfaceNumber; 3173 ifnum = get_iface_desc(alts)->bInterfaceNumber;
3174 id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
3175 le16_to_cpu(dev->descriptor.idProduct));
3179 3176
3180 if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum) 3177 if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
3181 goto __err_val; 3178 goto __err_val;
3182 3179
3183 /* SB Extigy needs special boot-up sequence */ 3180 /* SB Extigy needs special boot-up sequence */
3184 /* if more models come, this will go to the quirk list. */ 3181 /* if more models come, this will go to the quirk list. */
3185 if (le16_to_cpu(dev->descriptor.idVendor) == 0x041e && 3182 if (id == USB_ID(0x041e, 0x3000)) {
3186 le16_to_cpu(dev->descriptor.idProduct) == 0x3000) {
3187 if (snd_usb_extigy_boot_quirk(dev, intf) < 0) 3183 if (snd_usb_extigy_boot_quirk(dev, intf) < 0)
3188 goto __err_val; 3184 goto __err_val;
3189 config = dev->actconfig; 3185 config = dev->actconfig;
@@ -3217,8 +3213,8 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
3217 } 3213 }
3218 for (i = 0; i < SNDRV_CARDS; i++) 3214 for (i = 0; i < SNDRV_CARDS; i++)
3219 if (enable[i] && ! usb_chip[i] && 3215 if (enable[i] && ! usb_chip[i] &&
3220 (vid[i] == -1 || vid[i] == le16_to_cpu(dev->descriptor.idVendor)) && 3216 (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) &&
3221 (pid[i] == -1 || pid[i] == le16_to_cpu(dev->descriptor.idProduct))) { 3217 (pid[i] == -1 || pid[i] == USB_ID_PRODUCT(id))) {
3222 if (snd_usb_audio_create(dev, i, quirk, &chip) < 0) { 3218 if (snd_usb_audio_create(dev, i, quirk, &chip) < 0) {
3223 goto __error; 3219 goto __error;
3224 } 3220 }