diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 168 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 4 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 10 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 2 | ||||
-rw-r--r-- | sound/usb/usbmixer_maps.c | 20 | ||||
-rw-r--r-- | sound/usb/usbquirks.h | 103 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 2 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.h | 2 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 8 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 12 |
10 files changed, 257 insertions, 74 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index d5013383fad7..4e614ac39f21 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/usb.h> | 47 | #include <linux/usb.h> |
48 | #include <linux/vmalloc.h> | 48 | #include <linux/vmalloc.h> |
49 | #include <linux/moduleparam.h> | 49 | #include <linux/moduleparam.h> |
50 | #include <linux/mutex.h> | ||
50 | #include <sound/core.h> | 51 | #include <sound/core.h> |
51 | #include <sound/info.h> | 52 | #include <sound/info.h> |
52 | #include <sound/pcm.h> | 53 | #include <sound/pcm.h> |
@@ -69,6 +70,7 @@ static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Vendor ID for | |||
69 | static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */ | 70 | static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */ |
70 | static int nrpacks = 4; /* max. number of packets per urb */ | 71 | static int nrpacks = 4; /* max. number of packets per urb */ |
71 | static int async_unlink = 1; | 72 | static int async_unlink = 1; |
73 | static int device_setup[SNDRV_CARDS]; /* device parameter for this card*/ | ||
72 | 74 | ||
73 | module_param_array(index, int, NULL, 0444); | 75 | module_param_array(index, int, NULL, 0444); |
74 | MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); | 76 | MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); |
@@ -84,6 +86,8 @@ module_param(nrpacks, int, 0644); | |||
84 | MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB."); | 86 | MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB."); |
85 | module_param(async_unlink, bool, 0444); | 87 | module_param(async_unlink, bool, 0444); |
86 | MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); | 88 | MODULE_PARM_DESC(async_unlink, "Use async unlink mode."); |
89 | module_param_array(device_setup, int, NULL, 0444); | ||
90 | MODULE_PARM_DESC(device_setup, "Specific device setup (if needed)."); | ||
87 | 91 | ||
88 | 92 | ||
89 | /* | 93 | /* |
@@ -202,7 +206,7 @@ struct snd_usb_stream { | |||
202 | * the all interfaces on the same card as one sound device. | 206 | * the all interfaces on the same card as one sound device. |
203 | */ | 207 | */ |
204 | 208 | ||
205 | static DECLARE_MUTEX(register_mutex); | 209 | static DEFINE_MUTEX(register_mutex); |
206 | static struct snd_usb_audio *usb_chip[SNDRV_CARDS]; | 210 | static struct snd_usb_audio *usb_chip[SNDRV_CARDS]; |
207 | 211 | ||
208 | 212 | ||
@@ -475,6 +479,18 @@ static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs, | |||
475 | return 0; | 479 | return 0; |
476 | } | 480 | } |
477 | 481 | ||
482 | /* determine the number of frames in the next packet */ | ||
483 | static int snd_usb_audio_next_packet_size(struct snd_usb_substream *subs) | ||
484 | { | ||
485 | if (subs->fill_max) | ||
486 | return subs->maxframesize; | ||
487 | else { | ||
488 | subs->phase = (subs->phase & 0xffff) | ||
489 | + (subs->freqm << subs->datainterval); | ||
490 | return min(subs->phase >> 16, subs->maxframesize); | ||
491 | } | ||
492 | } | ||
493 | |||
478 | /* | 494 | /* |
479 | * Prepare urb for streaming before playback starts. | 495 | * Prepare urb for streaming before playback starts. |
480 | * | 496 | * |
@@ -492,16 +508,7 @@ static int prepare_startup_playback_urb(struct snd_usb_substream *subs, | |||
492 | urb->dev = ctx->subs->dev; | 508 | urb->dev = ctx->subs->dev; |
493 | urb->number_of_packets = subs->packs_per_ms; | 509 | urb->number_of_packets = subs->packs_per_ms; |
494 | for (i = 0; i < subs->packs_per_ms; ++i) { | 510 | for (i = 0; i < subs->packs_per_ms; ++i) { |
495 | /* calculate the size of a packet */ | 511 | counts = snd_usb_audio_next_packet_size(subs); |
496 | if (subs->fill_max) | ||
497 | counts = subs->maxframesize; /* fixed */ | ||
498 | else { | ||
499 | subs->phase = (subs->phase & 0xffff) | ||
500 | + (subs->freqm << subs->datainterval); | ||
501 | counts = subs->phase >> 16; | ||
502 | if (counts > subs->maxframesize) | ||
503 | counts = subs->maxframesize; | ||
504 | } | ||
505 | urb->iso_frame_desc[i].offset = offs * stride; | 512 | urb->iso_frame_desc[i].offset = offs * stride; |
506 | urb->iso_frame_desc[i].length = counts * stride; | 513 | urb->iso_frame_desc[i].length = counts * stride; |
507 | offs += counts; | 514 | offs += counts; |
@@ -538,16 +545,7 @@ static int prepare_playback_urb(struct snd_usb_substream *subs, | |||
538 | urb->number_of_packets = 0; | 545 | urb->number_of_packets = 0; |
539 | spin_lock_irqsave(&subs->lock, flags); | 546 | spin_lock_irqsave(&subs->lock, flags); |
540 | for (i = 0; i < ctx->packets; i++) { | 547 | for (i = 0; i < ctx->packets; i++) { |
541 | /* calculate the size of a packet */ | 548 | counts = snd_usb_audio_next_packet_size(subs); |
542 | if (subs->fill_max) | ||
543 | counts = subs->maxframesize; /* fixed */ | ||
544 | else { | ||
545 | subs->phase = (subs->phase & 0xffff) | ||
546 | + (subs->freqm << subs->datainterval); | ||
547 | counts = subs->phase >> 16; | ||
548 | if (counts > subs->maxframesize) | ||
549 | counts = subs->maxframesize; | ||
550 | } | ||
551 | /* set up descriptor */ | 549 | /* set up descriptor */ |
552 | urb->iso_frame_desc[i].offset = offs * stride; | 550 | urb->iso_frame_desc[i].offset = offs * stride; |
553 | urb->iso_frame_desc[i].length = counts * stride; | 551 | urb->iso_frame_desc[i].length = counts * stride; |
@@ -725,10 +723,9 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s | |||
725 | static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) | 723 | static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) |
726 | { | 724 | { |
727 | struct snd_pcm_runtime *runtime = subs->runtime; | 725 | struct snd_pcm_runtime *runtime = subs->runtime; |
728 | if (runtime->dma_area) { | 726 | |
729 | vfree(runtime->dma_area); | 727 | vfree(runtime->dma_area); |
730 | runtime->dma_area = NULL; | 728 | runtime->dma_area = NULL; |
731 | } | ||
732 | return 0; | 729 | return 0; |
733 | } | 730 | } |
734 | 731 | ||
@@ -779,6 +776,35 @@ static int deactivate_urbs(struct snd_usb_substream *subs, int force, int can_sl | |||
779 | } | 776 | } |
780 | 777 | ||
781 | 778 | ||
779 | static const char *usb_error_string(int err) | ||
780 | { | ||
781 | switch (err) { | ||
782 | case -ENODEV: | ||
783 | return "no device"; | ||
784 | case -ENOENT: | ||
785 | return "endpoint not enabled"; | ||
786 | case -EPIPE: | ||
787 | return "endpoint stalled"; | ||
788 | case -ENOSPC: | ||
789 | return "not enough bandwidth"; | ||
790 | case -ESHUTDOWN: | ||
791 | return "device disabled"; | ||
792 | case -EHOSTUNREACH: | ||
793 | return "device suspended"; | ||
794 | #ifndef CONFIG_USB_EHCI_SPLIT_ISO | ||
795 | case -ENOSYS: | ||
796 | return "enable CONFIG_USB_EHCI_SPLIT_ISO to play through a hub"; | ||
797 | #endif | ||
798 | case -EINVAL: | ||
799 | case -EAGAIN: | ||
800 | case -EFBIG: | ||
801 | case -EMSGSIZE: | ||
802 | return "internal error"; | ||
803 | default: | ||
804 | return "unknown error"; | ||
805 | } | ||
806 | } | ||
807 | |||
782 | /* | 808 | /* |
783 | * set up and start data/sync urbs | 809 | * set up and start data/sync urbs |
784 | */ | 810 | */ |
@@ -811,16 +837,22 @@ static int start_urbs(struct snd_usb_substream *subs, struct snd_pcm_runtime *ru | |||
811 | subs->unlink_mask = 0; | 837 | subs->unlink_mask = 0; |
812 | subs->running = 1; | 838 | subs->running = 1; |
813 | for (i = 0; i < subs->nurbs; i++) { | 839 | for (i = 0; i < subs->nurbs; i++) { |
814 | if ((err = usb_submit_urb(subs->dataurb[i].urb, GFP_ATOMIC)) < 0) { | 840 | err = usb_submit_urb(subs->dataurb[i].urb, GFP_ATOMIC); |
815 | snd_printk(KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); | 841 | if (err < 0) { |
842 | snd_printk(KERN_ERR "cannot submit datapipe " | ||
843 | "for urb %d, error %d: %s\n", | ||
844 | i, err, usb_error_string(err)); | ||
816 | goto __error; | 845 | goto __error; |
817 | } | 846 | } |
818 | set_bit(i, &subs->active_mask); | 847 | set_bit(i, &subs->active_mask); |
819 | } | 848 | } |
820 | if (subs->syncpipe) { | 849 | if (subs->syncpipe) { |
821 | for (i = 0; i < SYNC_URBS; i++) { | 850 | for (i = 0; i < SYNC_URBS; i++) { |
822 | if ((err = usb_submit_urb(subs->syncurb[i].urb, GFP_ATOMIC)) < 0) { | 851 | err = usb_submit_urb(subs->syncurb[i].urb, GFP_ATOMIC); |
823 | snd_printk(KERN_ERR "cannot submit syncpipe for urb %d, err = %d\n", i, err); | 852 | if (err < 0) { |
853 | snd_printk(KERN_ERR "cannot submit syncpipe " | ||
854 | "for urb %d, error %d: %s\n", | ||
855 | i, err, usb_error_string(err)); | ||
824 | goto __error; | 856 | goto __error; |
825 | } | 857 | } |
826 | set_bit(i + 16, &subs->active_mask); | 858 | set_bit(i + 16, &subs->active_mask); |
@@ -1390,8 +1422,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
1390 | channels = params_channels(hw_params); | 1422 | channels = params_channels(hw_params); |
1391 | fmt = find_format(subs, format, rate, channels); | 1423 | fmt = find_format(subs, format, rate, channels); |
1392 | if (! fmt) { | 1424 | if (! fmt) { |
1393 | snd_printd(KERN_DEBUG "cannot set format: format = %s, rate = %d, channels = %d\n", | 1425 | snd_printd(KERN_DEBUG "cannot set format: format = 0x%x, rate = %d, channels = %d\n", |
1394 | snd_pcm_format_name(format), rate, channels); | 1426 | format, rate, channels); |
1395 | return -EINVAL; | 1427 | return -EINVAL; |
1396 | } | 1428 | } |
1397 | 1429 | ||
@@ -2017,6 +2049,8 @@ static struct usb_driver usb_audio_driver = { | |||
2017 | }; | 2049 | }; |
2018 | 2050 | ||
2019 | 2051 | ||
2052 | #if defined(CONFIG_PROCFS) && defined(CONFIG_SND_VERBOSE_PROCFS) | ||
2053 | |||
2020 | /* | 2054 | /* |
2021 | * proc interface for list the supported pcm formats | 2055 | * proc interface for list the supported pcm formats |
2022 | */ | 2056 | */ |
@@ -2032,7 +2066,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
2032 | fp = list_entry(p, struct audioformat, list); | 2066 | fp = list_entry(p, struct audioformat, list); |
2033 | snd_iprintf(buffer, " Interface %d\n", fp->iface); | 2067 | snd_iprintf(buffer, " Interface %d\n", fp->iface); |
2034 | snd_iprintf(buffer, " Altset %d\n", fp->altsetting); | 2068 | snd_iprintf(buffer, " Altset %d\n", fp->altsetting); |
2035 | snd_iprintf(buffer, " Format: %s\n", snd_pcm_format_name(fp->format)); | 2069 | snd_iprintf(buffer, " Format: 0x%x\n", fp->format); |
2036 | snd_iprintf(buffer, " Channels: %d\n", fp->channels); | 2070 | snd_iprintf(buffer, " Channels: %d\n", fp->channels); |
2037 | snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", | 2071 | snd_iprintf(buffer, " Endpoint: %d %s (%s)\n", |
2038 | fp->endpoint & USB_ENDPOINT_NUMBER_MASK, | 2072 | fp->endpoint & USB_ENDPOINT_NUMBER_MASK, |
@@ -2107,6 +2141,13 @@ static void proc_pcm_format_add(struct snd_usb_stream *stream) | |||
2107 | snd_info_set_text_ops(entry, stream, 1024, proc_pcm_format_read); | 2141 | snd_info_set_text_ops(entry, stream, 1024, proc_pcm_format_read); |
2108 | } | 2142 | } |
2109 | 2143 | ||
2144 | #else | ||
2145 | |||
2146 | static inline void proc_pcm_format_add(struct snd_usb_stream *stream) | ||
2147 | { | ||
2148 | } | ||
2149 | |||
2150 | #endif | ||
2110 | 2151 | ||
2111 | /* | 2152 | /* |
2112 | * initialize the substream instance. | 2153 | * initialize the substream instance. |
@@ -2509,6 +2550,8 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp | |||
2509 | return 0; | 2550 | return 0; |
2510 | } | 2551 | } |
2511 | 2552 | ||
2553 | static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | ||
2554 | int iface, int altno); | ||
2512 | static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | 2555 | static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) |
2513 | { | 2556 | { |
2514 | struct usb_device *dev; | 2557 | struct usb_device *dev; |
@@ -2543,6 +2586,12 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2543 | stream = (get_endpoint(alts, 0)->bEndpointAddress & USB_DIR_IN) ? | 2586 | stream = (get_endpoint(alts, 0)->bEndpointAddress & USB_DIR_IN) ? |
2544 | SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; | 2587 | SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; |
2545 | altno = altsd->bAlternateSetting; | 2588 | altno = altsd->bAlternateSetting; |
2589 | |||
2590 | /* audiophile usb: skip altsets incompatible with device_setup | ||
2591 | */ | ||
2592 | if (chip->usb_id == USB_ID(0x0763, 0x2003) && | ||
2593 | audiophile_skip_setting_quirk(chip, iface_no, altno)) | ||
2594 | continue; | ||
2546 | 2595 | ||
2547 | /* get audio formats */ | 2596 | /* get audio formats */ |
2548 | fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, AS_GENERAL); | 2597 | fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, AS_GENERAL); |
@@ -2637,7 +2686,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2637 | continue; | 2686 | continue; |
2638 | } | 2687 | } |
2639 | 2688 | ||
2640 | snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint 0x%x\n", dev->devnum, iface_no, i, fp->endpoint); | 2689 | snd_printdd(KERN_INFO "%d:%u:%d: add audio endpoint 0x%x\n", dev->devnum, iface_no, altno, fp->endpoint); |
2641 | err = add_audio_endpoint(chip, stream, fp); | 2690 | err = add_audio_endpoint(chip, stream, fp); |
2642 | if (err < 0) { | 2691 | if (err < 0) { |
2643 | kfree(fp->rate_table); | 2692 | kfree(fp->rate_table); |
@@ -3045,6 +3094,45 @@ static int snd_usb_audigy2nx_boot_quirk(struct usb_device *dev) | |||
3045 | return 0; | 3094 | return 0; |
3046 | } | 3095 | } |
3047 | 3096 | ||
3097 | /* | ||
3098 | * Setup quirks | ||
3099 | */ | ||
3100 | #define AUDIOPHILE_SET 0x01 /* if set, parse device_setup */ | ||
3101 | #define AUDIOPHILE_SET_DTS 0x02 /* if set, enable DTS Digital Output */ | ||
3102 | #define AUDIOPHILE_SET_96K 0x04 /* 48-96KHz rate if set, 8-48KHz otherwise */ | ||
3103 | #define AUDIOPHILE_SET_24B 0x08 /* 24bits sample if set, 16bits otherwise */ | ||
3104 | #define AUDIOPHILE_SET_DI 0x10 /* if set, enable Digital Input */ | ||
3105 | #define AUDIOPHILE_SET_MASK 0x1F /* bit mask for setup value */ | ||
3106 | #define AUDIOPHILE_SET_24B_48K_DI 0x19 /* value for 24bits+48KHz+Digital Input */ | ||
3107 | #define AUDIOPHILE_SET_24B_48K_NOTDI 0x09 /* value for 24bits+48KHz+No Digital Input */ | ||
3108 | #define AUDIOPHILE_SET_16B_48K_DI 0x11 /* value for 16bits+48KHz+Digital Input */ | ||
3109 | #define AUDIOPHILE_SET_16B_48K_NOTDI 0x01 /* value for 16bits+48KHz+No Digital Input */ | ||
3110 | |||
3111 | static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, | ||
3112 | int iface, int altno) | ||
3113 | { | ||
3114 | if (device_setup[chip->index] & AUDIOPHILE_SET) { | ||
3115 | if ((device_setup[chip->index] & AUDIOPHILE_SET_DTS) | ||
3116 | && altno != 6) | ||
3117 | return 1; /* skip this altsetting */ | ||
3118 | if ((device_setup[chip->index] & AUDIOPHILE_SET_96K) | ||
3119 | && altno != 1) | ||
3120 | return 1; /* skip this altsetting */ | ||
3121 | if ((device_setup[chip->index] & AUDIOPHILE_SET_MASK) == | ||
3122 | AUDIOPHILE_SET_24B_48K_DI && altno != 2) | ||
3123 | return 1; /* skip this altsetting */ | ||
3124 | if ((device_setup[chip->index] & AUDIOPHILE_SET_MASK) == | ||
3125 | AUDIOPHILE_SET_24B_48K_NOTDI && altno != 3) | ||
3126 | return 1; /* skip this altsetting */ | ||
3127 | if ((device_setup[chip->index] & AUDIOPHILE_SET_MASK) == | ||
3128 | AUDIOPHILE_SET_16B_48K_DI && altno != 4) | ||
3129 | return 1; /* skip this altsetting */ | ||
3130 | if ((device_setup[chip->index] & AUDIOPHILE_SET_MASK) == | ||
3131 | AUDIOPHILE_SET_16B_48K_NOTDI && altno != 5) | ||
3132 | return 1; /* skip this altsetting */ | ||
3133 | } | ||
3134 | return 0; /* keep this altsetting */ | ||
3135 | } | ||
3048 | 3136 | ||
3049 | /* | 3137 | /* |
3050 | * audio-interface quirks | 3138 | * audio-interface quirks |
@@ -3070,7 +3158,7 @@ static int snd_usb_create_quirk(struct snd_usb_audio *chip, | |||
3070 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, | 3158 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, |
3071 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, | 3159 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, |
3072 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, | 3160 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, |
3073 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, | 3161 | [QUIRK_MIDI_CME] = snd_usb_create_midi_interface, |
3074 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, | 3162 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3075 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3163 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3076 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, | 3164 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, |
@@ -3282,7 +3370,7 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
3282 | 3370 | ||
3283 | /* check whether it's already registered */ | 3371 | /* check whether it's already registered */ |
3284 | chip = NULL; | 3372 | chip = NULL; |
3285 | down(®ister_mutex); | 3373 | mutex_lock(®ister_mutex); |
3286 | for (i = 0; i < SNDRV_CARDS; i++) { | 3374 | for (i = 0; i < SNDRV_CARDS; i++) { |
3287 | if (usb_chip[i] && usb_chip[i]->dev == dev) { | 3375 | if (usb_chip[i] && usb_chip[i]->dev == dev) { |
3288 | if (usb_chip[i]->shutdown) { | 3376 | if (usb_chip[i]->shutdown) { |
@@ -3335,13 +3423,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
3335 | 3423 | ||
3336 | usb_chip[chip->index] = chip; | 3424 | usb_chip[chip->index] = chip; |
3337 | chip->num_interfaces++; | 3425 | chip->num_interfaces++; |
3338 | up(®ister_mutex); | 3426 | mutex_unlock(®ister_mutex); |
3339 | return chip; | 3427 | return chip; |
3340 | 3428 | ||
3341 | __error: | 3429 | __error: |
3342 | if (chip && !chip->num_interfaces) | 3430 | if (chip && !chip->num_interfaces) |
3343 | snd_card_free(chip->card); | 3431 | snd_card_free(chip->card); |
3344 | up(®ister_mutex); | 3432 | mutex_unlock(®ister_mutex); |
3345 | __err_val: | 3433 | __err_val: |
3346 | return NULL; | 3434 | return NULL; |
3347 | } | 3435 | } |
@@ -3361,7 +3449,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
3361 | 3449 | ||
3362 | chip = ptr; | 3450 | chip = ptr; |
3363 | card = chip->card; | 3451 | card = chip->card; |
3364 | down(®ister_mutex); | 3452 | mutex_lock(®ister_mutex); |
3365 | chip->shutdown = 1; | 3453 | chip->shutdown = 1; |
3366 | chip->num_interfaces--; | 3454 | chip->num_interfaces--; |
3367 | if (chip->num_interfaces <= 0) { | 3455 | if (chip->num_interfaces <= 0) { |
@@ -3379,10 +3467,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
3379 | snd_usb_mixer_disconnect(p); | 3467 | snd_usb_mixer_disconnect(p); |
3380 | } | 3468 | } |
3381 | usb_chip[chip->index] = NULL; | 3469 | usb_chip[chip->index] = NULL; |
3382 | up(®ister_mutex); | 3470 | mutex_unlock(®ister_mutex); |
3383 | snd_card_free(card); | 3471 | snd_card_free(card); |
3384 | } else { | 3472 | } else { |
3385 | up(®ister_mutex); | 3473 | mutex_unlock(®ister_mutex); |
3386 | } | 3474 | } |
3387 | } | 3475 | } |
3388 | 3476 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index ecd724bfe5a5..88733524d0fb 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -161,7 +161,7 @@ enum quirk_type { | |||
161 | QUIRK_MIDI_NOVATION, | 161 | QUIRK_MIDI_NOVATION, |
162 | QUIRK_MIDI_RAW, | 162 | QUIRK_MIDI_RAW, |
163 | QUIRK_MIDI_EMAGIC, | 163 | QUIRK_MIDI_EMAGIC, |
164 | QUIRK_MIDI_MIDITECH, | 164 | QUIRK_MIDI_CME, |
165 | QUIRK_AUDIO_STANDARD_INTERFACE, | 165 | QUIRK_AUDIO_STANDARD_INTERFACE, |
166 | QUIRK_AUDIO_FIXED_ENDPOINT, | 166 | QUIRK_AUDIO_FIXED_ENDPOINT, |
167 | QUIRK_AUDIO_EDIROL_UA700_UA25, | 167 | QUIRK_AUDIO_EDIROL_UA700_UA25, |
@@ -209,7 +209,7 @@ struct snd_usb_midi_endpoint_info { | |||
209 | /* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info | 209 | /* for QUIRK_MIDI_EMAGIC, data points to a snd_usb_midi_endpoint_info |
210 | * structure (out_cables and in_cables only) */ | 210 | * structure (out_cables and in_cables only) */ |
211 | 211 | ||
212 | /* for QUIRK_MIDI_MIDITECH, data is NULL */ | 212 | /* for QUIRK_MIDI_CME, data is NULL */ |
213 | 213 | ||
214 | /* | 214 | /* |
215 | */ | 215 | */ |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index f15b021c3ce8..2b9d940c8064 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -871,10 +871,10 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi, | |||
871 | 871 | ||
872 | static unsigned int snd_usbmidi_count_bits(unsigned int x) | 872 | static unsigned int snd_usbmidi_count_bits(unsigned int x) |
873 | { | 873 | { |
874 | unsigned int bits = 0; | 874 | unsigned int bits; |
875 | 875 | ||
876 | for (; x; x >>= 1) | 876 | for (bits = 0; x; ++bits) |
877 | bits += x & 1; | 877 | x &= x - 1; |
878 | return bits; | 878 | return bits; |
879 | } | 879 | } |
880 | 880 | ||
@@ -1082,6 +1082,8 @@ static struct { | |||
1082 | { USB_ID(0x0582, 0x004d), 0, "%s MIDI" }, | 1082 | { USB_ID(0x0582, 0x004d), 0, "%s MIDI" }, |
1083 | { USB_ID(0x0582, 0x004d), 1, "%s 1" }, | 1083 | { USB_ID(0x0582, 0x004d), 1, "%s 1" }, |
1084 | { USB_ID(0x0582, 0x004d), 2, "%s 2" }, | 1084 | { USB_ID(0x0582, 0x004d), 2, "%s 2" }, |
1085 | /* Edirol UM-3EX */ | ||
1086 | { USB_ID(0x0582, 0x009a), 3, "%s Control" }, | ||
1085 | /* M-Audio MidiSport 8x8 */ | 1087 | /* M-Audio MidiSport 8x8 */ |
1086 | { USB_ID(0x0763, 0x1031), 8, "%s Control" }, | 1088 | { USB_ID(0x0763, 0x1031), 8, "%s Control" }, |
1087 | { USB_ID(0x0763, 0x1033), 8, "%s Control" }, | 1089 | { USB_ID(0x0763, 0x1033), 8, "%s Control" }, |
@@ -1574,7 +1576,7 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip, | |||
1574 | sizeof(struct snd_usb_midi_endpoint_info)); | 1576 | sizeof(struct snd_usb_midi_endpoint_info)); |
1575 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1577 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1576 | break; | 1578 | break; |
1577 | case QUIRK_MIDI_MIDITECH: | 1579 | case QUIRK_MIDI_CME: |
1578 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1580 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1579 | break; | 1581 | break; |
1580 | default: | 1582 | default: |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 678dac2d4dba..8d08b34a1cb5 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -434,7 +434,6 @@ static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol * | |||
434 | kctl->id.index++; | 434 | kctl->id.index++; |
435 | if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) { | 435 | if ((err = snd_ctl_add(state->chip->card, kctl)) < 0) { |
436 | snd_printd(KERN_ERR "cannot add control (err = %d)\n", err); | 436 | snd_printd(KERN_ERR "cannot add control (err = %d)\n", err); |
437 | snd_ctl_free_one(kctl); | ||
438 | return err; | 437 | return err; |
439 | } | 438 | } |
440 | cval->elem_id = &kctl->id; | 439 | cval->elem_id = &kctl->id; |
@@ -1469,6 +1468,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi | |||
1469 | kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval); | 1468 | kctl = snd_ctl_new1(&mixer_selectunit_ctl, cval); |
1470 | if (! kctl) { | 1469 | if (! kctl) { |
1471 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); | 1470 | snd_printk(KERN_ERR "cannot malloc kcontrol\n"); |
1471 | kfree(namelist); | ||
1472 | kfree(cval); | 1472 | kfree(cval); |
1473 | return -ENOMEM; | 1473 | return -ENOMEM; |
1474 | } | 1474 | } |
diff --git a/sound/usb/usbmixer_maps.c b/sound/usb/usbmixer_maps.c index c1264434e50a..37accb68652d 100644 --- a/sound/usb/usbmixer_maps.c +++ b/sound/usb/usbmixer_maps.c | |||
@@ -195,6 +195,22 @@ static struct usbmix_name_map linex_map[] = { | |||
195 | { 0 } /* terminator */ | 195 | { 0 } /* terminator */ |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static struct usbmix_name_map maya44_map[] = { | ||
199 | /* 1: IT line */ | ||
200 | { 2, "Line Playback" }, /* FU */ | ||
201 | /* 3: IT line */ | ||
202 | { 4, "Line Playback" }, /* FU */ | ||
203 | /* 5: IT pcm playback */ | ||
204 | /* 6: MU */ | ||
205 | { 7, "Master Playback" }, /* FU */ | ||
206 | /* 8: OT speaker */ | ||
207 | /* 9: IT line */ | ||
208 | { 10, "Line Capture" }, /* FU */ | ||
209 | /* 11: MU */ | ||
210 | /* 12: OT pcm capture */ | ||
211 | { } | ||
212 | }; | ||
213 | |||
198 | /* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk> | 214 | /* Section "justlink_map" below added by James Courtier-Dutton <James@superbug.demon.co.uk> |
199 | * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK | 215 | * sourced from Maplin Electronics (http://www.maplin.co.uk), part number A56AK |
200 | * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.) | 216 | * Part has 2 connectors that act as a single output. (TOSLINK Optical for digital out, and 3.5mm Jack for Analogue out.) |
@@ -253,6 +269,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { | |||
253 | .ignore_ctl_error = 1, | 269 | .ignore_ctl_error = 1, |
254 | }, | 270 | }, |
255 | { | 271 | { |
272 | .id = USB_ID(0x0a92, 0x0091), | ||
273 | .map = maya44_map, | ||
274 | }, | ||
275 | { | ||
256 | .id = USB_ID(0x0c45, 0x1158), | 276 | .id = USB_ID(0x0c45, 0x1158), |
257 | .map = justlink_map, | 277 | .map = justlink_map, |
258 | }, | 278 | }, |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 6190ada00e38..0992a0923f1a 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -82,6 +82,7 @@ YAMAHA_DEVICE(0x1012, "TYROS"), | |||
82 | YAMAHA_DEVICE(0x1013, "PF-500"), | 82 | YAMAHA_DEVICE(0x1013, "PF-500"), |
83 | YAMAHA_DEVICE(0x1014, "S90"), | 83 | YAMAHA_DEVICE(0x1014, "S90"), |
84 | YAMAHA_DEVICE(0x1015, "MOTIF-R"), | 84 | YAMAHA_DEVICE(0x1015, "MOTIF-R"), |
85 | YAMAHA_DEVICE(0x1016, "MDP-5"), | ||
85 | YAMAHA_DEVICE(0x1017, "CVP-204"), | 86 | YAMAHA_DEVICE(0x1017, "CVP-204"), |
86 | YAMAHA_DEVICE(0x1018, "CVP-206"), | 87 | YAMAHA_DEVICE(0x1018, "CVP-206"), |
87 | YAMAHA_DEVICE(0x1019, "CVP-208"), | 88 | YAMAHA_DEVICE(0x1019, "CVP-208"), |
@@ -90,6 +91,7 @@ YAMAHA_DEVICE(0x101b, "PSR-1100"), | |||
90 | YAMAHA_DEVICE(0x101c, "PSR-2100"), | 91 | YAMAHA_DEVICE(0x101c, "PSR-2100"), |
91 | YAMAHA_DEVICE(0x101d, "CLP-175"), | 92 | YAMAHA_DEVICE(0x101d, "CLP-175"), |
92 | YAMAHA_DEVICE(0x101e, "PSR-K1"), | 93 | YAMAHA_DEVICE(0x101e, "PSR-K1"), |
94 | YAMAHA_DEVICE(0x101f, "EZ-J24"), | ||
93 | YAMAHA_DEVICE(0x1020, "EZ-250i"), | 95 | YAMAHA_DEVICE(0x1020, "EZ-250i"), |
94 | YAMAHA_DEVICE(0x1021, "MOTIF ES 6"), | 96 | YAMAHA_DEVICE(0x1021, "MOTIF ES 6"), |
95 | YAMAHA_DEVICE(0x1022, "MOTIF ES 7"), | 97 | YAMAHA_DEVICE(0x1022, "MOTIF ES 7"), |
@@ -294,7 +296,8 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
294 | } | 296 | } |
295 | }, | 297 | }, |
296 | { | 298 | { |
297 | /* a later revision uses ID 0x0099 */ | 299 | /* Has ID 0x0099 when not in "Advanced Driver" mode. |
300 | * The UM-2EX has only one input, but we cannot detect this. */ | ||
298 | USB_DEVICE(0x0582, 0x0005), | 301 | USB_DEVICE(0x0582, 0x0005), |
299 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 302 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
300 | .vendor_name = "EDIROL", | 303 | .vendor_name = "EDIROL", |
@@ -385,7 +388,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
385 | } | 388 | } |
386 | }, | 389 | }, |
387 | { | 390 | { |
388 | /* a later revision uses ID 0x009d */ | 391 | /* has ID 0x009d when not in "Advanced Driver" mode */ |
389 | USB_DEVICE(0x0582, 0x0009), | 392 | USB_DEVICE(0x0582, 0x0009), |
390 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 393 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
391 | .vendor_name = "EDIROL", | 394 | .vendor_name = "EDIROL", |
@@ -1090,6 +1093,53 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1090 | } | 1093 | } |
1091 | } | 1094 | } |
1092 | }, | 1095 | }, |
1096 | /* TODO: add Edirol UA-101 support */ | ||
1097 | { | ||
1098 | /* has ID 0x0081 when not in "Advanced Driver" mode */ | ||
1099 | USB_DEVICE(0x0582, 0x0080), | ||
1100 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1101 | .vendor_name = "Roland", | ||
1102 | .product_name = "G-70", | ||
1103 | .ifnum = 0, | ||
1104 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1105 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1106 | .out_cables = 0x0001, | ||
1107 | .in_cables = 0x0001 | ||
1108 | } | ||
1109 | } | ||
1110 | }, | ||
1111 | /* TODO: add Roland V-SYNTH XT support */ | ||
1112 | /* TODO: add BOSS GT-PRO support */ | ||
1113 | { | ||
1114 | /* has ID 0x008c when not in "Advanced Driver" mode */ | ||
1115 | USB_DEVICE(0x0582, 0x008b), | ||
1116 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1117 | .vendor_name = "EDIROL", | ||
1118 | .product_name = "PC-50", | ||
1119 | .ifnum = 0, | ||
1120 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1121 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1122 | .out_cables = 0x0001, | ||
1123 | .in_cables = 0x0001 | ||
1124 | } | ||
1125 | } | ||
1126 | }, | ||
1127 | /* TODO: add Edirol PC-80 support */ | ||
1128 | /* TODO: add Edirol UA-1EX support */ | ||
1129 | { | ||
1130 | USB_DEVICE(0x0582, 0x009a), | ||
1131 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1132 | .vendor_name = "EDIROL", | ||
1133 | .product_name = "UM-3EX", | ||
1134 | .ifnum = 0, | ||
1135 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1136 | .data = & (const struct snd_usb_midi_endpoint_info) { | ||
1137 | .out_cables = 0x000f, | ||
1138 | .in_cables = 0x000f | ||
1139 | } | ||
1140 | } | ||
1141 | }, | ||
1142 | /* TODO: add Edirol MD-P1 support */ | ||
1093 | 1143 | ||
1094 | /* Guillemot devices */ | 1144 | /* Guillemot devices */ |
1095 | { | 1145 | { |
@@ -1111,15 +1161,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1111 | } | 1161 | } |
1112 | } | 1162 | } |
1113 | }, | 1163 | }, |
1114 | /* TODO: add Edirol UA-101 support */ | ||
1115 | /* TODO: add Roland G-70 support */ | ||
1116 | /* TODO: add Roland V-SYNTH XT support */ | ||
1117 | /* TODO: add BOSS GT-PRO support */ | ||
1118 | /* TODO: add Edirol PC-50 support */ | ||
1119 | /* TODO: add Edirol PC-80 support */ | ||
1120 | /* TODO: add Edirol UA-1EX support */ | ||
1121 | /* TODO: add Edirol UM-3 support */ | ||
1122 | /* TODO: add Edirol MD-P1 support */ | ||
1123 | 1164 | ||
1124 | /* Midiman/M-Audio devices */ | 1165 | /* Midiman/M-Audio devices */ |
1125 | { | 1166 | { |
@@ -1367,6 +1408,27 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1367 | } | 1408 | } |
1368 | }, | 1409 | }, |
1369 | 1410 | ||
1411 | /* Casio devices */ | ||
1412 | { | ||
1413 | USB_DEVICE(0x07cf, 0x6801), | ||
1414 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1415 | .vendor_name = "Casio", | ||
1416 | .product_name = "PL-40R", | ||
1417 | .ifnum = 0, | ||
1418 | .type = QUIRK_MIDI_YAMAHA | ||
1419 | } | ||
1420 | }, | ||
1421 | { | ||
1422 | /* this ID is used by several devices without a product ID */ | ||
1423 | USB_DEVICE(0x07cf, 0x6802), | ||
1424 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1425 | .vendor_name = "Casio", | ||
1426 | .product_name = "Keyboard", | ||
1427 | .ifnum = 0, | ||
1428 | .type = QUIRK_MIDI_YAMAHA | ||
1429 | } | ||
1430 | }, | ||
1431 | |||
1370 | /* Mark of the Unicorn devices */ | 1432 | /* Mark of the Unicorn devices */ |
1371 | { | 1433 | { |
1372 | /* thanks to Robert A. Lerche <ral 'at' msbit.com> */ | 1434 | /* thanks to Robert A. Lerche <ral 'at' msbit.com> */ |
@@ -1468,6 +1530,15 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1468 | .type = QUIRK_MIDI_STANDARD_INTERFACE | 1530 | .type = QUIRK_MIDI_STANDARD_INTERFACE |
1469 | } | 1531 | } |
1470 | }, | 1532 | }, |
1533 | { | ||
1534 | USB_DEVICE(0x0ccd, 0x0035), | ||
1535 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
1536 | .vendor_name = "Miditech", | ||
1537 | .product_name = "Play'n Roll", | ||
1538 | .ifnum = 0, | ||
1539 | .type = QUIRK_MIDI_CME | ||
1540 | } | ||
1541 | }, | ||
1471 | 1542 | ||
1472 | /* Novation EMS devices */ | 1543 | /* Novation EMS devices */ |
1473 | { | 1544 | { |
@@ -1498,22 +1569,24 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1498 | } | 1569 | } |
1499 | }, | 1570 | }, |
1500 | 1571 | ||
1572 | /* Miditech devices */ | ||
1501 | { | 1573 | { |
1502 | USB_DEVICE(0x4752, 0x0011), | 1574 | USB_DEVICE(0x4752, 0x0011), |
1503 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1575 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
1504 | .vendor_name = "Miditech", | 1576 | .vendor_name = "Miditech", |
1505 | .product_name = "Midistart-2", | 1577 | .product_name = "Midistart-2", |
1506 | .ifnum = 0, | 1578 | .ifnum = 0, |
1507 | .type = QUIRK_MIDI_MIDITECH | 1579 | .type = QUIRK_MIDI_CME |
1508 | } | 1580 | } |
1509 | }, | 1581 | }, |
1582 | |||
1583 | /* Central Music devices */ | ||
1510 | { | 1584 | { |
1585 | /* this ID used by both Miditech MidiStudio-2 and CME UF-x */ | ||
1511 | USB_DEVICE(0x7104, 0x2202), | 1586 | USB_DEVICE(0x7104, 0x2202), |
1512 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1587 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
1513 | .vendor_name = "Miditech", | ||
1514 | .product_name = "MidiStudio-2", | ||
1515 | .ifnum = 0, | 1588 | .ifnum = 0, |
1516 | .type = QUIRK_MIDI_MIDITECH | 1589 | .type = QUIRK_MIDI_CME |
1517 | } | 1590 | } |
1518 | }, | 1591 | }, |
1519 | 1592 | ||
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index e0abb56bbe49..cfec38d7839b 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -351,7 +351,7 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device) | |||
351 | usX2Y(card)->chip.dev = device; | 351 | usX2Y(card)->chip.dev = device; |
352 | usX2Y(card)->chip.card = card; | 352 | usX2Y(card)->chip.card = card; |
353 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); | 353 | init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); |
354 | init_MUTEX (&usX2Y(card)->prepare_mutex); | 354 | mutex_init(&usX2Y(card)->prepare_mutex); |
355 | INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); | 355 | INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); |
356 | strcpy(card->driver, "USB "NAME_ALLCAPS""); | 356 | strcpy(card->driver, "USB "NAME_ALLCAPS""); |
357 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); | 357 | sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); |
diff --git a/sound/usb/usx2y/usbusx2y.h b/sound/usb/usx2y/usbusx2y.h index 435c1feda9df..456b5fdbc339 100644 --- a/sound/usb/usx2y/usbusx2y.h +++ b/sound/usb/usx2y/usbusx2y.h | |||
@@ -34,7 +34,7 @@ struct usX2Ydev { | |||
34 | unsigned int rate, | 34 | unsigned int rate, |
35 | format; | 35 | format; |
36 | int chip_status; | 36 | int chip_status; |
37 | struct semaphore prepare_mutex; | 37 | struct mutex prepare_mutex; |
38 | struct us428ctls_sharedmem *us428ctls_sharedmem; | 38 | struct us428ctls_sharedmem *us428ctls_sharedmem; |
39 | int wait_iso_frame; | 39 | int wait_iso_frame; |
40 | wait_queue_head_t us428ctls_wait_queue_head; | 40 | wait_queue_head_t us428ctls_wait_queue_head; |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index a6bbc7a6348f..f6bd0dee563c 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -811,7 +811,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) | |||
811 | { | 811 | { |
812 | struct snd_pcm_runtime *runtime = substream->runtime; | 812 | struct snd_pcm_runtime *runtime = substream->runtime; |
813 | struct snd_usX2Y_substream *subs = runtime->private_data; | 813 | struct snd_usX2Y_substream *subs = runtime->private_data; |
814 | down(&subs->usX2Y->prepare_mutex); | 814 | mutex_lock(&subs->usX2Y->prepare_mutex); |
815 | snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); | 815 | snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); |
816 | 816 | ||
817 | if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { | 817 | if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { |
@@ -832,7 +832,7 @@ static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) | |||
832 | usX2Y_urbs_release(subs); | 832 | usX2Y_urbs_release(subs); |
833 | } | 833 | } |
834 | } | 834 | } |
835 | up(&subs->usX2Y->prepare_mutex); | 835 | mutex_unlock(&subs->usX2Y->prepare_mutex); |
836 | return snd_pcm_lib_free_pages(substream); | 836 | return snd_pcm_lib_free_pages(substream); |
837 | } | 837 | } |
838 | /* | 838 | /* |
@@ -849,7 +849,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) | |||
849 | int err = 0; | 849 | int err = 0; |
850 | snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); | 850 | snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); |
851 | 851 | ||
852 | down(&usX2Y->prepare_mutex); | 852 | mutex_lock(&usX2Y->prepare_mutex); |
853 | usX2Y_subs_prepare(subs); | 853 | usX2Y_subs_prepare(subs); |
854 | // Start hardware streams | 854 | // Start hardware streams |
855 | // SyncStream first.... | 855 | // SyncStream first.... |
@@ -869,7 +869,7 @@ static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) | |||
869 | err = usX2Y_urbs_start(subs); | 869 | err = usX2Y_urbs_start(subs); |
870 | 870 | ||
871 | up_prepare_mutex: | 871 | up_prepare_mutex: |
872 | up(&usX2Y->prepare_mutex); | 872 | mutex_unlock(&usX2Y->prepare_mutex); |
873 | return err; | 873 | return err; |
874 | } | 874 | } |
875 | 875 | ||
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 796a7dcef09d..315855082fe1 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -366,7 +366,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) | |||
366 | struct snd_pcm_runtime *runtime = substream->runtime; | 366 | struct snd_pcm_runtime *runtime = substream->runtime; |
367 | struct snd_usX2Y_substream *subs = runtime->private_data, | 367 | struct snd_usX2Y_substream *subs = runtime->private_data, |
368 | *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; | 368 | *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; |
369 | down(&subs->usX2Y->prepare_mutex); | 369 | mutex_lock(&subs->usX2Y->prepare_mutex); |
370 | snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); | 370 | snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); |
371 | 371 | ||
372 | if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { | 372 | if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { |
@@ -395,7 +395,7 @@ static int snd_usX2Y_usbpcm_hw_free(struct snd_pcm_substream *substream) | |||
395 | usX2Y_usbpcm_urbs_release(cap_subs2); | 395 | usX2Y_usbpcm_urbs_release(cap_subs2); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | up(&subs->usX2Y->prepare_mutex); | 398 | mutex_unlock(&subs->usX2Y->prepare_mutex); |
399 | return snd_pcm_lib_free_pages(substream); | 399 | return snd_pcm_lib_free_pages(substream); |
400 | } | 400 | } |
401 | 401 | ||
@@ -503,7 +503,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream) | |||
503 | memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); | 503 | memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); |
504 | } | 504 | } |
505 | 505 | ||
506 | down(&usX2Y->prepare_mutex); | 506 | mutex_lock(&usX2Y->prepare_mutex); |
507 | usX2Y_subs_prepare(subs); | 507 | usX2Y_subs_prepare(subs); |
508 | // Start hardware streams | 508 | // Start hardware streams |
509 | // SyncStream first.... | 509 | // SyncStream first.... |
@@ -544,7 +544,7 @@ static int snd_usX2Y_usbpcm_prepare(struct snd_pcm_substream *substream) | |||
544 | usX2Y->hwdep_pcm_shm->capture_iso_start = -1; | 544 | usX2Y->hwdep_pcm_shm->capture_iso_start = -1; |
545 | 545 | ||
546 | up_prepare_mutex: | 546 | up_prepare_mutex: |
547 | up(&usX2Y->prepare_mutex); | 547 | mutex_unlock(&usX2Y->prepare_mutex); |
548 | return err; | 548 | return err; |
549 | } | 549 | } |
550 | 550 | ||
@@ -621,7 +621,7 @@ static int usX2Y_pcms_lock_check(struct snd_card *card) | |||
621 | if (dev->type != SNDRV_DEV_PCM) | 621 | if (dev->type != SNDRV_DEV_PCM) |
622 | continue; | 622 | continue; |
623 | pcm = dev->device_data; | 623 | pcm = dev->device_data; |
624 | down(&pcm->open_mutex); | 624 | mutex_lock(&pcm->open_mutex); |
625 | } | 625 | } |
626 | list_for_each(list, &card->devices) { | 626 | list_for_each(list, &card->devices) { |
627 | int s; | 627 | int s; |
@@ -650,7 +650,7 @@ static void usX2Y_pcms_unlock(struct snd_card *card) | |||
650 | if (dev->type != SNDRV_DEV_PCM) | 650 | if (dev->type != SNDRV_DEV_PCM) |
651 | continue; | 651 | continue; |
652 | pcm = dev->device_data; | 652 | pcm = dev->device_data; |
653 | up(&pcm->open_mutex); | 653 | mutex_unlock(&pcm->open_mutex); |
654 | } | 654 | } |
655 | } | 655 | } |
656 | 656 | ||