aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-03-11 08:48:09 -0500
committerTakashi Iwai <tiwai@suse.de>2011-03-11 08:48:09 -0500
commitcc99a0861fa1c72335dc91a2e06d0b431911d55e (patch)
treeb5bba9600470f8a5e417519b7c2d5fd13d079c3b /sound/usb
parentbc3a8a01def4fb0ec0ef8a20d097277b9c6b2a1f (diff)
parent382225e62bdb8059b7f915b133426425516dd300 (diff)
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/caiaq/audio.c2
-rw-r--r--sound/usb/caiaq/midi.c2
-rw-r--r--sound/usb/card.c4
-rw-r--r--sound/usb/mixer.c4
-rw-r--r--sound/usb/pcm.c7
-rw-r--r--sound/usb/quirks-table.h7
-rw-r--r--sound/usb/quirks.c3
-rw-r--r--sound/usb/usbaudio.h1
8 files changed, 23 insertions, 7 deletions
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index e411cd323d57..d0d493ca28ae 100644
--- a/sound/usb/caiaq/audio.c
+++ b/sound/usb/caiaq/audio.c
@@ -785,7 +785,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev)
785 } 785 }
786 786
787 dev->pcm->private_data = dev; 787 dev->pcm->private_data = dev;
788 strcpy(dev->pcm->name, dev->product_name); 788 strlcpy(dev->pcm->name, dev->product_name, sizeof(dev->pcm->name));
789 789
790 memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); 790 memset(dev->sub_playback, 0, sizeof(dev->sub_playback));
791 memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); 791 memset(dev->sub_capture, 0, sizeof(dev->sub_capture));
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c
index 2f218c77fff2..a1a47088fd0c 100644
--- a/sound/usb/caiaq/midi.c
+++ b/sound/usb/caiaq/midi.c
@@ -136,7 +136,7 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device)
136 if (ret < 0) 136 if (ret < 0)
137 return ret; 137 return ret;
138 138
139 strcpy(rmidi->name, device->product_name); 139 strlcpy(rmidi->name, device->product_name, sizeof(rmidi->name));
140 140
141 rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; 141 rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX;
142 rmidi->private_data = device; 142 rmidi->private_data = device;
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 800f7cb4f251..c0f8270bc199 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
323 return -ENOMEM; 323 return -ENOMEM;
324 } 324 }
325 325
326 mutex_init(&chip->shutdown_mutex);
326 chip->index = idx; 327 chip->index = idx;
327 chip->dev = dev; 328 chip->dev = dev;
328 chip->card = card; 329 chip->card = card;
@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
531 chip = ptr; 532 chip = ptr;
532 card = chip->card; 533 card = chip->card;
533 mutex_lock(&register_mutex); 534 mutex_lock(&register_mutex);
535 mutex_lock(&chip->shutdown_mutex);
534 chip->shutdown = 1; 536 chip->shutdown = 1;
535 chip->num_interfaces--; 537 chip->num_interfaces--;
536 if (chip->num_interfaces <= 0) { 538 if (chip->num_interfaces <= 0) {
@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
548 snd_usb_mixer_disconnect(p); 550 snd_usb_mixer_disconnect(p);
549 } 551 }
550 usb_chip[chip->index] = NULL; 552 usb_chip[chip->index] = NULL;
553 mutex_unlock(&chip->shutdown_mutex);
551 mutex_unlock(&register_mutex); 554 mutex_unlock(&register_mutex);
552 snd_card_free_when_closed(card); 555 snd_card_free_when_closed(card);
553 } else { 556 } else {
557 mutex_unlock(&chip->shutdown_mutex);
554 mutex_unlock(&register_mutex); 558 mutex_unlock(&register_mutex);
555 } 559 }
556} 560}
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 844cf786e81c..675a4f1b5de1 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -95,7 +95,7 @@ enum {
95}; 95};
96 96
97 97
98/*E-mu 0202(0404) eXtension Unit(XU) control*/ 98/*E-mu 0202/0404/0204 eXtension Unit(XU) control*/
99enum { 99enum {
100 USB_XU_CLOCK_RATE = 0xe301, 100 USB_XU_CLOCK_RATE = 0xe301,
101 USB_XU_CLOCK_SOURCE = 0xe302, 101 USB_XU_CLOCK_SOURCE = 0xe302,
@@ -1583,7 +1583,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, void *raw
1583 cval->initialized = 1; 1583 cval->initialized = 1;
1584 } else { 1584 } else {
1585 if (type == USB_XU_CLOCK_RATE) { 1585 if (type == USB_XU_CLOCK_RATE) {
1586 /* E-Mu USB 0404/0202/TrackerPre 1586 /* E-Mu USB 0404/0202/TrackerPre/0204
1587 * samplerate control quirk 1587 * samplerate control quirk
1588 */ 1588 */
1589 cval->min = 0; 1589 cval->min = 0;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 4132522ac90f..e3f680526cb5 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
361 } 361 }
362 362
363 if (changed) { 363 if (changed) {
364 mutex_lock(&subs->stream->chip->shutdown_mutex);
364 /* format changed */ 365 /* format changed */
365 snd_usb_release_substream_urbs(subs, 0); 366 snd_usb_release_substream_urbs(subs, 0);
366 /* influenced: period_bytes, channels, rate, format, */ 367 /* influenced: period_bytes, channels, rate, format, */
@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
368 params_rate(hw_params), 369 params_rate(hw_params),
369 snd_pcm_format_physical_width(params_format(hw_params)) * 370 snd_pcm_format_physical_width(params_format(hw_params)) *
370 params_channels(hw_params)); 371 params_channels(hw_params));
372 mutex_unlock(&subs->stream->chip->shutdown_mutex);
371 } 373 }
372 374
373 return ret; 375 return ret;
@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
385 subs->cur_audiofmt = NULL; 387 subs->cur_audiofmt = NULL;
386 subs->cur_rate = 0; 388 subs->cur_rate = 0;
387 subs->period_bytes = 0; 389 subs->period_bytes = 0;
388 if (!subs->stream->chip->shutdown) 390 mutex_lock(&subs->stream->chip->shutdown_mutex);
389 snd_usb_release_substream_urbs(subs, 0); 391 snd_usb_release_substream_urbs(subs, 0);
392 mutex_unlock(&subs->stream->chip->shutdown_mutex);
390 return snd_pcm_lib_free_vmalloc_buffer(substream); 393 return snd_pcm_lib_free_vmalloc_buffer(substream);
391} 394}
392 395
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index e1e245d0e5ec..c0dcfca9b5b5 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -79,6 +79,13 @@
79 .idProduct = 0x3f0a, 79 .idProduct = 0x3f0a,
80 .bInterfaceClass = USB_CLASS_AUDIO, 80 .bInterfaceClass = USB_CLASS_AUDIO,
81}, 81},
82{
83 /* E-Mu 0204 USB */
84 .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
85 .idVendor = 0x041e,
86 .idProduct = 0x3f19,
87 .bInterfaceClass = USB_CLASS_AUDIO,
88},
82 89
83/* 90/*
84 * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface 91 * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index ca860e611263..355759bad581 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -566,7 +566,7 @@ int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat
566} 566}
567 567
568/* 568/*
569 * For E-Mu 0404USB/0202USB/TrackerPre sample rate should be set for device, 569 * For E-Mu 0404USB/0202USB/TrackerPre/0204 sample rate should be set for device,
570 * not for interface. 570 * not for interface.
571 */ 571 */
572 572
@@ -623,6 +623,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
623 case USB_ID(0x041e, 0x3f02): /* E-Mu 0202 USB */ 623 case USB_ID(0x041e, 0x3f02): /* E-Mu 0202 USB */
624 case USB_ID(0x041e, 0x3f04): /* E-Mu 0404 USB */ 624 case USB_ID(0x041e, 0x3f04): /* E-Mu 0404 USB */
625 case USB_ID(0x041e, 0x3f0a): /* E-Mu Tracker Pre */ 625 case USB_ID(0x041e, 0x3f0a): /* E-Mu Tracker Pre */
626 case USB_ID(0x041e, 0x3f19): /* E-Mu 0204 USB */
626 set_format_emu_quirk(subs, fmt); 627 set_format_emu_quirk(subs, fmt);
627 break; 628 break;
628 } 629 }
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index db3eb21627ee..6e66fffe87f5 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -36,6 +36,7 @@ struct snd_usb_audio {
36 struct snd_card *card; 36 struct snd_card *card;
37 u32 usb_id; 37 u32 usb_id;
38 int shutdown; 38 int shutdown;
39 struct mutex shutdown_mutex;
39 unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ 40 unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
40 int num_interfaces; 41 int num_interfaces;
41 int num_suspended_intf; 42 int num_suspended_intf;