diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/usbaudio.c | 104 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 6 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 123 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 38 | ||||
-rw-r--r-- | sound/usb/usbmixer_maps.c | 13 |
5 files changed, 139 insertions, 145 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 | */ |
2187 | static int is_big_endian_format(struct usb_device *dev, struct audioformat *fp) | 2187 | static 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 | */ |
2211 | static int parse_audio_format_i_type(struct usb_device *dev, struct audioformat *fp, | 2209 | static 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 | */ |
2294 | static int parse_audio_format_rates(struct usb_device *dev, struct audioformat *fp, | 2292 | static 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 | */ |
2347 | static int parse_audio_format_i(struct usb_device *dev, struct audioformat *fp, | 2345 | static 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 | */ |
2376 | static int parse_audio_format_ii(struct usb_device *dev, struct audioformat *fp, | 2374 | static 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 | ||
2403 | static int parse_audio_format(struct usb_device *dev, struct audioformat *fp, | 2401 | static 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 | ||
3025 | static void snd_usb_audio_create_proc(snd_usb_audio_t *chip) | 3018 | static 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 | } |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 41d842dab3e8..aedb42aaa749 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -118,6 +118,11 @@ | |||
118 | /* maximum number of endpoints per interface */ | 118 | /* maximum number of endpoints per interface */ |
119 | #define MIDI_MAX_ENDPOINTS 2 | 119 | #define MIDI_MAX_ENDPOINTS 2 |
120 | 120 | ||
121 | /* handling of USB vendor/product ID pairs as 32-bit numbers */ | ||
122 | #define USB_ID(vendor, product) (((vendor) << 16) | (product)) | ||
123 | #define USB_ID_VENDOR(id) ((id) >> 16) | ||
124 | #define USB_ID_PRODUCT(id) ((u16)(id)) | ||
125 | |||
121 | /* | 126 | /* |
122 | */ | 127 | */ |
123 | 128 | ||
@@ -127,6 +132,7 @@ struct snd_usb_audio { | |||
127 | int index; | 132 | int index; |
128 | struct usb_device *dev; | 133 | struct usb_device *dev; |
129 | snd_card_t *card; | 134 | snd_card_t *card; |
135 | u32 usb_id; | ||
130 | int shutdown; | 136 | int shutdown; |
131 | int num_interfaces; | 137 | int num_interfaces; |
132 | 138 | ||
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 304a13451ec9..bee70068dce0 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -955,88 +955,87 @@ static snd_rawmidi_substream_t* snd_usbmidi_find_substream(snd_usb_midi_t* umidi | |||
955 | * such as internal control or synthesizer ports. | 955 | * such as internal control or synthesizer ports. |
956 | */ | 956 | */ |
957 | static struct { | 957 | static struct { |
958 | __u16 vendor; | 958 | u32 id; |
959 | __u16 product; | ||
960 | int port; | 959 | int port; |
961 | const char *name_format; | 960 | const char *name_format; |
962 | } snd_usbmidi_port_names[] = { | 961 | } snd_usbmidi_port_names[] = { |
963 | /* Roland UA-100 */ | 962 | /* Roland UA-100 */ |
964 | {0x0582, 0x0000, 2, "%s Control"}, | 963 | { USB_ID(0x0582, 0x0000), 2, "%s Control" }, |
965 | /* Roland SC-8850 */ | 964 | /* Roland SC-8850 */ |
966 | {0x0582, 0x0003, 0, "%s Part A"}, | 965 | { USB_ID(0x0582, 0x0003), 0, "%s Part A" }, |
967 | {0x0582, 0x0003, 1, "%s Part B"}, | 966 | { USB_ID(0x0582, 0x0003), 1, "%s Part B" }, |
968 | {0x0582, 0x0003, 2, "%s Part C"}, | 967 | { USB_ID(0x0582, 0x0003), 2, "%s Part C" }, |
969 | {0x0582, 0x0003, 3, "%s Part D"}, | 968 | { USB_ID(0x0582, 0x0003), 3, "%s Part D" }, |
970 | {0x0582, 0x0003, 4, "%s MIDI 1"}, | 969 | { USB_ID(0x0582, 0x0003), 4, "%s MIDI 1" }, |
971 | {0x0582, 0x0003, 5, "%s MIDI 2"}, | 970 | { USB_ID(0x0582, 0x0003), 5, "%s MIDI 2" }, |
972 | /* Roland U-8 */ | 971 | /* Roland U-8 */ |
973 | {0x0582, 0x0004, 0, "%s MIDI"}, | 972 | { USB_ID(0x0582, 0x0004), 0, "%s MIDI" }, |
974 | {0x0582, 0x0004, 1, "%s Control"}, | 973 | { USB_ID(0x0582, 0x0004), 1, "%s Control" }, |
975 | /* Roland SC-8820 */ | 974 | /* Roland SC-8820 */ |
976 | {0x0582, 0x0007, 0, "%s Part A"}, | 975 | { USB_ID(0x0582, 0x0007), 0, "%s Part A" }, |
977 | {0x0582, 0x0007, 1, "%s Part B"}, | 976 | { USB_ID(0x0582, 0x0007), 1, "%s Part B" }, |
978 | {0x0582, 0x0007, 2, "%s MIDI"}, | 977 | { USB_ID(0x0582, 0x0007), 2, "%s MIDI" }, |
979 | /* Roland SK-500 */ | 978 | /* Roland SK-500 */ |
980 | {0x0582, 0x000b, 0, "%s Part A"}, | 979 | { USB_ID(0x0582, 0x000b), 0, "%s Part A" }, |
981 | {0x0582, 0x000b, 1, "%s Part B"}, | 980 | { USB_ID(0x0582, 0x000b), 1, "%s Part B" }, |
982 | {0x0582, 0x000b, 2, "%s MIDI"}, | 981 | { USB_ID(0x0582, 0x000b), 2, "%s MIDI" }, |
983 | /* Roland SC-D70 */ | 982 | /* Roland SC-D70 */ |
984 | {0x0582, 0x000c, 0, "%s Part A"}, | 983 | { USB_ID(0x0582, 0x000c), 0, "%s Part A" }, |
985 | {0x0582, 0x000c, 1, "%s Part B"}, | 984 | { USB_ID(0x0582, 0x000c), 1, "%s Part B" }, |
986 | {0x0582, 0x000c, 2, "%s MIDI"}, | 985 | { USB_ID(0x0582, 0x000c), 2, "%s MIDI" }, |
987 | /* Edirol UM-880 */ | 986 | /* Edirol UM-880 */ |
988 | {0x0582, 0x0014, 8, "%s Control"}, | 987 | { USB_ID(0x0582, 0x0014), 8, "%s Control" }, |
989 | /* Edirol SD-90 */ | 988 | /* Edirol SD-90 */ |
990 | {0x0582, 0x0016, 0, "%s Part A"}, | 989 | { USB_ID(0x0582, 0x0016), 0, "%s Part A" }, |
991 | {0x0582, 0x0016, 1, "%s Part B"}, | 990 | { USB_ID(0x0582, 0x0016), 1, "%s Part B" }, |
992 | {0x0582, 0x0016, 2, "%s MIDI 1"}, | 991 | { USB_ID(0x0582, 0x0016), 2, "%s MIDI 1" }, |
993 | {0x0582, 0x0016, 3, "%s MIDI 2"}, | 992 | { USB_ID(0x0582, 0x0016), 3, "%s MIDI 2" }, |
994 | /* Edirol UM-550 */ | 993 | /* Edirol UM-550 */ |
995 | {0x0582, 0x0023, 5, "%s Control"}, | 994 | { USB_ID(0x0582, 0x0023), 5, "%s Control" }, |
996 | /* Edirol SD-20 */ | 995 | /* Edirol SD-20 */ |
997 | {0x0582, 0x0027, 0, "%s Part A"}, | 996 | { USB_ID(0x0582, 0x0027), 0, "%s Part A" }, |
998 | {0x0582, 0x0027, 1, "%s Part B"}, | 997 | { USB_ID(0x0582, 0x0027), 1, "%s Part B" }, |
999 | {0x0582, 0x0027, 2, "%s MIDI"}, | 998 | { USB_ID(0x0582, 0x0027), 2, "%s MIDI" }, |
1000 | /* Edirol SD-80 */ | 999 | /* Edirol SD-80 */ |
1001 | {0x0582, 0x0029, 0, "%s Part A"}, | 1000 | { USB_ID(0x0582, 0x0029), 0, "%s Part A" }, |
1002 | {0x0582, 0x0029, 1, "%s Part B"}, | 1001 | { USB_ID(0x0582, 0x0029), 1, "%s Part B" }, |
1003 | {0x0582, 0x0029, 2, "%s MIDI 1"}, | 1002 | { USB_ID(0x0582, 0x0029), 2, "%s MIDI 1" }, |
1004 | {0x0582, 0x0029, 3, "%s MIDI 2"}, | 1003 | { USB_ID(0x0582, 0x0029), 3, "%s MIDI 2" }, |
1005 | /* Edirol UA-700 */ | 1004 | /* Edirol UA-700 */ |
1006 | {0x0582, 0x002b, 0, "%s MIDI"}, | 1005 | { USB_ID(0x0582, 0x002b), 0, "%s MIDI" }, |
1007 | {0x0582, 0x002b, 1, "%s Control"}, | 1006 | { USB_ID(0x0582, 0x002b), 1, "%s Control" }, |
1008 | /* Roland VariOS */ | 1007 | /* Roland VariOS */ |
1009 | {0x0582, 0x002f, 0, "%s MIDI"}, | 1008 | { USB_ID(0x0582, 0x002f), 0, "%s MIDI" }, |
1010 | {0x0582, 0x002f, 1, "%s External MIDI"}, | 1009 | { USB_ID(0x0582, 0x002f), 1, "%s External MIDI" }, |
1011 | {0x0582, 0x002f, 2, "%s Sync"}, | 1010 | { USB_ID(0x0582, 0x002f), 2, "%s Sync" }, |
1012 | /* Edirol PCR */ | 1011 | /* Edirol PCR */ |
1013 | {0x0582, 0x0033, 0, "%s MIDI"}, | 1012 | { USB_ID(0x0582, 0x0033), 0, "%s MIDI" }, |
1014 | {0x0582, 0x0033, 1, "%s 1"}, | 1013 | { USB_ID(0x0582, 0x0033), 1, "%s 1" }, |
1015 | {0x0582, 0x0033, 2, "%s 2"}, | 1014 | { USB_ID(0x0582, 0x0033), 2, "%s 2" }, |
1016 | /* BOSS GS-10 */ | 1015 | /* BOSS GS-10 */ |
1017 | {0x0582, 0x003b, 0, "%s MIDI"}, | 1016 | { USB_ID(0x0582, 0x003b), 0, "%s MIDI" }, |
1018 | {0x0582, 0x003b, 1, "%s Control"}, | 1017 | { USB_ID(0x0582, 0x003b), 1, "%s Control" }, |
1019 | /* Edirol UA-1000 */ | 1018 | /* Edirol UA-1000 */ |
1020 | {0x0582, 0x0044, 0, "%s MIDI"}, | 1019 | { USB_ID(0x0582, 0x0044), 0, "%s MIDI" }, |
1021 | {0x0582, 0x0044, 1, "%s Control"}, | 1020 | { USB_ID(0x0582, 0x0044), 1, "%s Control" }, |
1022 | /* Edirol UR-80 */ | 1021 | /* Edirol UR-80 */ |
1023 | {0x0582, 0x0048, 0, "%s MIDI"}, | 1022 | { USB_ID(0x0582, 0x0048), 0, "%s MIDI" }, |
1024 | {0x0582, 0x0048, 1, "%s 1"}, | 1023 | { USB_ID(0x0582, 0x0048), 1, "%s 1" }, |
1025 | {0x0582, 0x0048, 2, "%s 2"}, | 1024 | { USB_ID(0x0582, 0x0048), 2, "%s 2" }, |
1026 | /* Edirol PCR-A */ | 1025 | /* Edirol PCR-A */ |
1027 | {0x0582, 0x004d, 0, "%s MIDI"}, | 1026 | { USB_ID(0x0582, 0x004d), 0, "%s MIDI" }, |
1028 | {0x0582, 0x004d, 1, "%s 1"}, | 1027 | { USB_ID(0x0582, 0x004d), 1, "%s 1" }, |
1029 | {0x0582, 0x004d, 2, "%s 2"}, | 1028 | { USB_ID(0x0582, 0x004d), 2, "%s 2" }, |
1030 | /* M-Audio MidiSport 8x8 */ | 1029 | /* M-Audio MidiSport 8x8 */ |
1031 | {0x0763, 0x1031, 8, "%s Control"}, | 1030 | { USB_ID(0x0763, 0x1031), 8, "%s Control" }, |
1032 | {0x0763, 0x1033, 8, "%s Control"}, | 1031 | { USB_ID(0x0763, 0x1033), 8, "%s Control" }, |
1033 | /* MOTU Fastlane */ | 1032 | /* MOTU Fastlane */ |
1034 | {0x07fd, 0x0001, 0, "%s MIDI A"}, | 1033 | { USB_ID(0x07fd, 0x0001), 0, "%s MIDI A" }, |
1035 | {0x07fd, 0x0001, 1, "%s MIDI B"}, | 1034 | { USB_ID(0x07fd, 0x0001), 1, "%s MIDI B" }, |
1036 | /* Emagic Unitor8/AMT8/MT4 */ | 1035 | /* Emagic Unitor8/AMT8/MT4 */ |
1037 | {0x086a, 0x0001, 8, "%s Broadcast"}, | 1036 | { USB_ID(0x086a, 0x0001), 8, "%s Broadcast" }, |
1038 | {0x086a, 0x0002, 8, "%s Broadcast"}, | 1037 | { USB_ID(0x086a, 0x0002), 8, "%s Broadcast" }, |
1039 | {0x086a, 0x0003, 4, "%s Broadcast"}, | 1038 | { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, |
1040 | }; | 1039 | }; |
1041 | 1040 | ||
1042 | static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, | 1041 | static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, |
@@ -1044,7 +1043,6 @@ static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, | |||
1044 | snd_rawmidi_substream_t** rsubstream) | 1043 | snd_rawmidi_substream_t** rsubstream) |
1045 | { | 1044 | { |
1046 | int i; | 1045 | int i; |
1047 | __u16 vendor, product; | ||
1048 | const char *name_format; | 1046 | const char *name_format; |
1049 | 1047 | ||
1050 | snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number); | 1048 | snd_rawmidi_substream_t* substream = snd_usbmidi_find_substream(umidi, stream, number); |
@@ -1055,11 +1053,8 @@ static void snd_usbmidi_init_substream(snd_usb_midi_t* umidi, | |||
1055 | 1053 | ||
1056 | /* TODO: read port name from jack descriptor */ | 1054 | /* TODO: read port name from jack descriptor */ |
1057 | name_format = "%s MIDI %d"; | 1055 | name_format = "%s MIDI %d"; |
1058 | vendor = le16_to_cpu(umidi->chip->dev->descriptor.idVendor); | ||
1059 | product = le16_to_cpu(umidi->chip->dev->descriptor.idProduct); | ||
1060 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_names); ++i) { | 1056 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_names); ++i) { |
1061 | if (snd_usbmidi_port_names[i].vendor == vendor && | 1057 | if (snd_usbmidi_port_names[i].id == umidi->chip->usb_id && |
1062 | snd_usbmidi_port_names[i].product == product && | ||
1063 | snd_usbmidi_port_names[i].port == number) { | 1058 | snd_usbmidi_port_names[i].port == number) { |
1064 | name_format = snd_usbmidi_port_names[i].name_format; | 1059 | name_format = snd_usbmidi_port_names[i].name_format; |
1065 | break; | 1060 | break; |
@@ -1226,7 +1221,7 @@ static int snd_usbmidi_detect_endpoints(snd_usb_midi_t* umidi, | |||
1226 | struct usb_endpoint_descriptor* epd; | 1221 | struct usb_endpoint_descriptor* epd; |
1227 | int i, out_eps = 0, in_eps = 0; | 1222 | int i, out_eps = 0, in_eps = 0; |
1228 | 1223 | ||
1229 | if (le16_to_cpu(umidi->chip->dev->descriptor.idVendor) == 0x0582) | 1224 | if (USB_ID_VENDOR(umidi->chip->usb_id) == 0x0582) |
1230 | snd_usbmidi_switch_roland_altsetting(umidi); | 1225 | snd_usbmidi_switch_roland_altsetting(umidi); |
1231 | 1226 | ||
1232 | if (endpoint[0].out_ep || endpoint[0].in_ep) | 1227 | if (endpoint[0].out_ep || endpoint[0].in_ep) |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 7ea42d43d7ff..bfaec4fc1851 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -89,8 +89,6 @@ struct usb_mixer_build { | |||
89 | struct usb_mixer_interface *mixer; | 89 | struct usb_mixer_interface *mixer; |
90 | unsigned char *buffer; | 90 | unsigned char *buffer; |
91 | unsigned int buflen; | 91 | unsigned int buflen; |
92 | unsigned short vendor; | ||
93 | unsigned short product; | ||
94 | DECLARE_BITMAP(unitbitmap, 256); | 92 | DECLARE_BITMAP(unitbitmap, 256); |
95 | usb_audio_term_t oterm; | 93 | usb_audio_term_t oterm; |
96 | const struct usbmix_name_map *map; | 94 | const struct usbmix_name_map *map; |
@@ -906,11 +904,16 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, | |||
906 | /* note that detection between firmware 2.1.1.7 (N101) and later 2.1.1.21 */ | 904 | /* note that detection between firmware 2.1.1.7 (N101) and later 2.1.1.21 */ |
907 | /* is not very clear from datasheets */ | 905 | /* is not very clear from datasheets */ |
908 | /* I hope that the min value is -15360 for newer firmware --jk */ | 906 | /* I hope that the min value is -15360 for newer firmware --jk */ |
909 | if (((state->vendor == 0x471 && (state->product == 0x104 || state->product == 0x105 || state->product == 0x101)) || | 907 | switch (state->chip->usb_id) { |
910 | (state->vendor == 0x672 && state->product == 0x1041)) && !strcmp(kctl->id.name, "PCM Playback Volume") && | 908 | case USB_ID(0x0471, 0x0101): |
911 | cval->min == -15616) { | 909 | case USB_ID(0x0471, 0x0104): |
912 | snd_printk("USB Audio: using volume control quirk for the UDA1321/N101 chip\n"); | 910 | case USB_ID(0x0471, 0x0105): |
913 | cval->max = -256; | 911 | case USB_ID(0x0672, 0x1041): |
912 | if (!strcmp(kctl->id.name, "PCM Playback Volume") && | ||
913 | cval->min == -15616) { | ||
914 | snd_printk("using volume control quirk for the UDA1321/N101 chip\n"); | ||
915 | cval->max = -256; | ||
916 | } | ||
914 | } | 917 | } |
915 | 918 | ||
916 | snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", | 919 | snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", |
@@ -1574,7 +1577,6 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
1574 | mixer_build_t state; | 1577 | mixer_build_t state; |
1575 | int err; | 1578 | int err; |
1576 | const struct usbmix_ctl_map *map; | 1579 | const struct usbmix_ctl_map *map; |
1577 | struct usb_device_descriptor *dev = &mixer->chip->dev->descriptor; | ||
1578 | struct usb_host_interface *hostif; | 1580 | struct usb_host_interface *hostif; |
1579 | 1581 | ||
1580 | hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0]; | 1582 | hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0]; |
@@ -1583,12 +1585,10 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
1583 | state.mixer = mixer; | 1585 | state.mixer = mixer; |
1584 | state.buffer = hostif->extra; | 1586 | state.buffer = hostif->extra; |
1585 | state.buflen = hostif->extralen; | 1587 | state.buflen = hostif->extralen; |
1586 | state.vendor = le16_to_cpu(dev->idVendor); | ||
1587 | state.product = le16_to_cpu(dev->idProduct); | ||
1588 | 1588 | ||
1589 | /* check the mapping table */ | 1589 | /* check the mapping table */ |
1590 | for (map = usbmix_ctl_maps; map->vendor; map++) { | 1590 | for (map = usbmix_ctl_maps; map->id; map++) { |
1591 | if (map->vendor == state.vendor && map->product == state.product) { | 1591 | if (map->id == state.chip->usb_id) { |
1592 | state.map = map->map; | 1592 | state.map = map->map; |
1593 | state.selector_map = map->selector_map; | 1593 | state.selector_map = map->selector_map; |
1594 | mixer->ignore_ctl_error = map->ignore_ctl_error; | 1594 | mixer->ignore_ctl_error = map->ignore_ctl_error; |
@@ -1766,12 +1766,12 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | |||
1766 | snd_hwdep_t *hwdep; | 1766 | snd_hwdep_t *hwdep; |
1767 | int err, len; | 1767 | int err, len; |
1768 | 1768 | ||
1769 | switch (le16_to_cpu(mixer->chip->dev->descriptor.idProduct)) { | 1769 | switch (mixer->chip->usb_id) { |
1770 | case 0x3000: | 1770 | case USB_ID(0x041e, 0x3000): |
1771 | mixer->rc_type = RC_EXTIGY; | 1771 | mixer->rc_type = RC_EXTIGY; |
1772 | len = 2; | 1772 | len = 2; |
1773 | break; | 1773 | break; |
1774 | case 0x3020: | 1774 | case USB_ID(0x041e, 0x3020): |
1775 | mixer->rc_type = RC_AUDIGY2NX; | 1775 | mixer->rc_type = RC_AUDIGY2NX; |
1776 | len = 6; | 1776 | len = 6; |
1777 | break; | 1777 | break; |
@@ -1844,11 +1844,9 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) | |||
1844 | return err; | 1844 | return err; |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x041e) { | 1847 | if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) { |
1848 | if ((err = snd_usb_soundblaster_remote_init(mixer)) < 0) { | 1848 | snd_usb_mixer_free(mixer); |
1849 | snd_usb_mixer_free(mixer); | 1849 | return err; |
1850 | return err; | ||
1851 | } | ||
1852 | } | 1850 | } |
1853 | 1851 | ||
1854 | err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops); | 1852 | err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops); |
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index adb0abb3ee85..f05500b05ec0 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c | |||
@@ -33,8 +33,7 @@ struct usbmix_selector_map { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | struct usbmix_ctl_map { | 35 | struct usbmix_ctl_map { |
36 | int vendor; | 36 | u32 id; |
37 | int product; | ||
38 | const struct usbmix_name_map *map; | 37 | const struct usbmix_name_map *map; |
39 | const struct usbmix_selector_map *selector_map; | 38 | const struct usbmix_selector_map *selector_map; |
40 | int ignore_ctl_error; | 39 | int ignore_ctl_error; |
@@ -225,26 +224,26 @@ static struct usbmix_name_map justlink_map[] = { | |||
225 | 224 | ||
226 | static struct usbmix_ctl_map usbmix_ctl_maps[] = { | 225 | static struct usbmix_ctl_map usbmix_ctl_maps[] = { |
227 | { | 226 | { |
228 | .vendor = 0x41e, .product = 0x3000, | 227 | .id = USB_ID(0x041e, 0x3000), |
229 | .map = extigy_map, | 228 | .map = extigy_map, |
230 | .ignore_ctl_error = 1, | 229 | .ignore_ctl_error = 1, |
231 | }, | 230 | }, |
232 | { | 231 | { |
233 | .vendor = 0x41e, .product = 0x3010, | 232 | .id = USB_ID(0x041e, 0x3010), |
234 | .map = mp3plus_map, | 233 | .map = mp3plus_map, |
235 | }, | 234 | }, |
236 | { | 235 | { |
237 | .vendor = 0x41e, .product = 0x3020, | 236 | .id = USB_ID(0x041e, 0x3020), |
238 | .map = audigy2nx_map, | 237 | .map = audigy2nx_map, |
239 | .selector_map = audigy2nx_selectors, | 238 | .selector_map = audigy2nx_selectors, |
240 | }, | 239 | }, |
241 | { | 240 | { |
242 | .vendor = 0x8bb, .product = 0x2702, | 241 | .id = USB_ID(0x08bb, 0x2702), |
243 | .map = linex_map, | 242 | .map = linex_map, |
244 | .ignore_ctl_error = 1, | 243 | .ignore_ctl_error = 1, |
245 | }, | 244 | }, |
246 | { | 245 | { |
247 | .vendor = 0xc45, .product = 0x1158, | 246 | .id = USB_ID(0x0c45, 0x1158), |
248 | .map = justlink_map, | 247 | .map = justlink_map, |
249 | }, | 248 | }, |
250 | { 0 } /* terminator */ | 249 | { 0 } /* terminator */ |