diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/caiaq/Makefile | 4 | ||||
-rw-r--r-- | sound/usb/caiaq/audio.c (renamed from sound/usb/caiaq/caiaq-audio.c) | 24 | ||||
-rw-r--r-- | sound/usb/caiaq/audio.h (renamed from sound/usb/caiaq/caiaq-audio.h) | 0 | ||||
-rw-r--r-- | sound/usb/caiaq/control.c (renamed from sound/usb/caiaq/caiaq-control.c) | 10 | ||||
-rw-r--r-- | sound/usb/caiaq/control.h (renamed from sound/usb/caiaq/caiaq-control.h) | 0 | ||||
-rw-r--r-- | sound/usb/caiaq/device.c (renamed from sound/usb/caiaq/caiaq-device.c) | 25 | ||||
-rw-r--r-- | sound/usb/caiaq/device.h (renamed from sound/usb/caiaq/caiaq-device.h) | 0 | ||||
-rw-r--r-- | sound/usb/caiaq/input.c (renamed from sound/usb/caiaq/caiaq-input.c) | 11 | ||||
-rw-r--r-- | sound/usb/caiaq/input.h (renamed from sound/usb/caiaq/caiaq-input.h) | 0 | ||||
-rw-r--r-- | sound/usb/caiaq/midi.c (renamed from sound/usb/caiaq/caiaq-midi.c) | 13 | ||||
-rw-r--r-- | sound/usb/caiaq/midi.h (renamed from sound/usb/caiaq/caiaq-midi.h) | 0 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 22 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 13 | ||||
-rw-r--r-- | sound/usb/usx2y/usb_stream.c | 67 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 3 |
15 files changed, 81 insertions, 111 deletions
diff --git a/sound/usb/caiaq/Makefile b/sound/usb/caiaq/Makefile index 23dadd5a11cd..388999653aaa 100644 --- a/sound/usb/caiaq/Makefile +++ b/sound/usb/caiaq/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | snd-usb-caiaq-y := caiaq-device.o caiaq-audio.o caiaq-midi.o caiaq-control.o | 1 | snd-usb-caiaq-y := device.o audio.o midi.o control.o |
2 | snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += caiaq-input.o | 2 | snd-usb-caiaq-$(CONFIG_SND_USB_CAIAQ_INPUT) += input.o |
3 | 3 | ||
4 | obj-$(CONFIG_SND_USB_CAIAQ) += snd-usb-caiaq.o | 4 | obj-$(CONFIG_SND_USB_CAIAQ) += snd-usb-caiaq.o |
diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/audio.c index 08d51e0c9fea..b13ce767ac72 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -16,20 +16,14 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/spinlock.h> | ||
19 | #include <linux/init.h> | 20 | #include <linux/init.h> |
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/usb.h> | 21 | #include <linux/usb.h> |
24 | #include <linux/spinlock.h> | ||
25 | #include <sound/core.h> | 22 | #include <sound/core.h> |
26 | #include <sound/initval.h> | ||
27 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
28 | #include <sound/rawmidi.h> | ||
29 | #include <linux/input.h> | ||
30 | 24 | ||
31 | #include "caiaq-device.h" | 25 | #include "device.h" |
32 | #include "caiaq-audio.h" | 26 | #include "audio.h" |
33 | 27 | ||
34 | #define N_URBS 32 | 28 | #define N_URBS 32 |
35 | #define CLOCK_DRIFT_TOLERANCE 5 | 29 | #define CLOCK_DRIFT_TOLERANCE 5 |
@@ -201,11 +195,14 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
201 | 195 | ||
202 | debug("%s(%p)\n", __func__, substream); | 196 | debug("%s(%p)\n", __func__, substream); |
203 | 197 | ||
204 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 198 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
199 | dev->period_out_count[index] = BYTES_PER_SAMPLE + 1; | ||
205 | dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1; | 200 | dev->audio_out_buf_pos[index] = BYTES_PER_SAMPLE + 1; |
206 | else | 201 | } else { |
202 | dev->period_in_count[index] = BYTES_PER_SAMPLE; | ||
207 | dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE; | 203 | dev->audio_in_buf_pos[index] = BYTES_PER_SAMPLE; |
208 | 204 | } | |
205 | |||
209 | if (dev->streaming) | 206 | if (dev->streaming) |
210 | return 0; | 207 | return 0; |
211 | 208 | ||
@@ -306,8 +303,7 @@ static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, | |||
306 | if (!sub) | 303 | if (!sub) |
307 | continue; | 304 | continue; |
308 | 305 | ||
309 | pb = frames_to_bytes(sub->runtime, | 306 | pb = snd_pcm_lib_period_bytes(sub); |
310 | sub->runtime->period_size); | ||
311 | cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 307 | cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
312 | &dev->period_out_count[stream] : | 308 | &dev->period_out_count[stream] : |
313 | &dev->period_in_count[stream]; | 309 | &dev->period_in_count[stream]; |
diff --git a/sound/usb/caiaq/caiaq-audio.h b/sound/usb/caiaq/audio.h index 8ab1f8d9529e..8ab1f8d9529e 100644 --- a/sound/usb/caiaq/caiaq-audio.h +++ b/sound/usb/caiaq/audio.h | |||
diff --git a/sound/usb/caiaq/caiaq-control.c b/sound/usb/caiaq/control.c index e92c2bbf4fe9..537102ba6b9d 100644 --- a/sound/usb/caiaq/caiaq-control.c +++ b/sound/usb/caiaq/control.c | |||
@@ -18,17 +18,13 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/usb.h> | 21 | #include <linux/usb.h> |
22 | #include <sound/control.h> | ||
23 | #include <sound/core.h> | 23 | #include <sound/core.h> |
24 | #include <sound/initval.h> | ||
25 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
26 | #include <sound/rawmidi.h> | ||
27 | #include <sound/control.h> | ||
28 | #include <linux/input.h> | ||
29 | 25 | ||
30 | #include "caiaq-device.h" | 26 | #include "device.h" |
31 | #include "caiaq-control.h" | 27 | #include "control.h" |
32 | 28 | ||
33 | #define CNT_INTVAL 0x10000 | 29 | #define CNT_INTVAL 0x10000 |
34 | 30 | ||
diff --git a/sound/usb/caiaq/caiaq-control.h b/sound/usb/caiaq/control.h index 2e7ab1aa4fb3..2e7ab1aa4fb3 100644 --- a/sound/usb/caiaq/caiaq-control.h +++ b/sound/usb/caiaq/control.h | |||
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/device.c index cf573a982fdc..515de1cd2a3e 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -19,30 +19,23 @@ | |||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
25 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/module.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
27 | #include <linux/input.h> | ||
28 | #include <linux/spinlock.h> | ||
29 | #include <sound/core.h> | ||
30 | #include <sound/initval.h> | 27 | #include <sound/initval.h> |
28 | #include <sound/core.h> | ||
31 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
32 | #include <sound/rawmidi.h> | ||
33 | #include <sound/control.h> | ||
34 | |||
35 | #include "caiaq-device.h" | ||
36 | #include "caiaq-audio.h" | ||
37 | #include "caiaq-midi.h" | ||
38 | #include "caiaq-control.h" | ||
39 | 30 | ||
40 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 31 | #include "device.h" |
41 | #include "caiaq-input.h" | 32 | #include "audio.h" |
42 | #endif | 33 | #include "midi.h" |
34 | #include "control.h" | ||
35 | #include "input.h" | ||
43 | 36 | ||
44 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 37 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
45 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13"); | 38 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.14"); |
46 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
47 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 40 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
48 | "{Native Instruments, RigKontrol3}," | 41 | "{Native Instruments, RigKontrol3}," |
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/device.h index 4cce1ad7493d..4cce1ad7493d 100644 --- a/sound/usb/caiaq/caiaq-device.h +++ b/sound/usb/caiaq/device.h | |||
diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/input.c index f743847a5e5a..a48d309bd94c 100644 --- a/sound/usb/caiaq/caiaq-input.c +++ b/sound/usb/caiaq/input.c | |||
@@ -17,17 +17,12 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/usb.h> | 20 | #include <linux/usb.h> |
24 | #include <linux/usb/input.h> | 21 | #include <linux/usb/input.h> |
25 | #include <linux/spinlock.h> | ||
26 | #include <sound/core.h> | ||
27 | #include <sound/rawmidi.h> | ||
28 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
29 | #include "caiaq-device.h" | 23 | |
30 | #include "caiaq-input.h" | 24 | #include "device.h" |
25 | #include "input.h" | ||
31 | 26 | ||
32 | static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; | 27 | static unsigned short keycode_ak1[] = { KEY_C, KEY_B, KEY_A }; |
33 | static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, | 28 | static unsigned short keycode_rk2[] = { KEY_1, KEY_2, KEY_3, KEY_4, |
diff --git a/sound/usb/caiaq/caiaq-input.h b/sound/usb/caiaq/input.h index ced535577864..ced535577864 100644 --- a/sound/usb/caiaq/caiaq-input.h +++ b/sound/usb/caiaq/input.h | |||
diff --git a/sound/usb/caiaq/caiaq-midi.c b/sound/usb/caiaq/midi.c index f19fd360c936..8fa8cd88d763 100644 --- a/sound/usb/caiaq/caiaq-midi.c +++ b/sound/usb/caiaq/midi.c | |||
@@ -16,20 +16,13 @@ | |||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/interrupt.h> | ||
23 | #include <linux/usb.h> | 19 | #include <linux/usb.h> |
24 | #include <linux/input.h> | ||
25 | #include <linux/spinlock.h> | ||
26 | #include <sound/core.h> | ||
27 | #include <sound/rawmidi.h> | 20 | #include <sound/rawmidi.h> |
21 | #include <sound/core.h> | ||
28 | #include <sound/pcm.h> | 22 | #include <sound/pcm.h> |
29 | 23 | ||
30 | #include "caiaq-device.h" | 24 | #include "device.h" |
31 | #include "caiaq-midi.h" | 25 | #include "midi.h" |
32 | |||
33 | 26 | ||
34 | static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) | 27 | static int snd_usb_caiaq_midi_input_open(struct snd_rawmidi_substream *substream) |
35 | { | 28 | { |
diff --git a/sound/usb/caiaq/caiaq-midi.h b/sound/usb/caiaq/midi.h index 9d16db027fc3..9d16db027fc3 100644 --- a/sound/usb/caiaq/caiaq-midi.h +++ b/sound/usb/caiaq/midi.h | |||
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 98276aafefe6..a5aae9d67f31 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -349,14 +349,10 @@ static int usb_stream_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, | |||
349 | if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS) | 349 | if (cmd != SNDRV_USB_STREAM_IOCTL_SET_PARAMS) |
350 | return -ENOTTY; | 350 | return -ENOTTY; |
351 | 351 | ||
352 | cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); | 352 | cfg = memdup_user((void *)arg, sizeof(*cfg)); |
353 | if (!cfg) | 353 | if (IS_ERR(cfg)) |
354 | return -ENOMEM; | 354 | return PTR_ERR(cfg); |
355 | 355 | ||
356 | if (copy_from_user(cfg, (void *)arg, sizeof(*cfg))) { | ||
357 | err = -EFAULT; | ||
358 | goto free; | ||
359 | } | ||
360 | if (cfg->version != USB_STREAM_INTERFACE_VERSION) { | 356 | if (cfg->version != USB_STREAM_INTERFACE_VERSION) { |
361 | err = -ENXIO; | 357 | err = -ENXIO; |
362 | goto free; | 358 | goto free; |
@@ -478,6 +474,14 @@ static bool us122l_create_card(struct snd_card *card) | |||
478 | return true; | 474 | return true; |
479 | } | 475 | } |
480 | 476 | ||
477 | static void snd_us122l_free(struct snd_card *card) | ||
478 | { | ||
479 | struct us122l *us122l = US122L(card); | ||
480 | int index = us122l->chip.index; | ||
481 | if (index >= 0 && index < SNDRV_CARDS) | ||
482 | snd_us122l_card_used[index] = 0; | ||
483 | } | ||
484 | |||
481 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | 485 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) |
482 | { | 486 | { |
483 | int dev; | 487 | int dev; |
@@ -494,7 +498,7 @@ static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) | |||
494 | if (err < 0) | 498 | if (err < 0) |
495 | return err; | 499 | return err; |
496 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 500 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; |
497 | 501 | card->private_free = snd_us122l_free; | |
498 | US122L(card)->chip.dev = device; | 502 | US122L(card)->chip.dev = device; |
499 | US122L(card)->chip.card = card; | 503 | US122L(card)->chip.card = card; |
500 | mutex_init(&US122L(card)->mutex); | 504 | mutex_init(&US122L(card)->mutex); |
@@ -588,7 +592,7 @@ static void snd_us122l_disconnect(struct usb_interface *intf) | |||
588 | } | 592 | } |
589 | 593 | ||
590 | usb_put_intf(intf); | 594 | usb_put_intf(intf); |
591 | usb_put_dev(US122L(card)->chip.dev); | 595 | usb_put_dev(us122l->chip.dev); |
592 | 596 | ||
593 | while (atomic_read(&us122l->mmap_count)) | 597 | while (atomic_read(&us122l->mmap_count)) |
594 | msleep(500); | 598 | msleep(500); |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 4af8740db717..f3d8f71265dd 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -203,13 +203,12 @@ static int snd_usX2Y_hwdep_dsp_load(struct snd_hwdep *hw, | |||
203 | 203 | ||
204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { | 204 | if (access_ok(VERIFY_READ, dsp->image, dsp->length)) { |
205 | struct usb_device* dev = priv->chip.dev; | 205 | struct usb_device* dev = priv->chip.dev; |
206 | char *buf = kmalloc(dsp->length, GFP_KERNEL); | 206 | char *buf; |
207 | if (!buf) | 207 | |
208 | return -ENOMEM; | 208 | buf = memdup_user(dsp->image, dsp->length); |
209 | if (copy_from_user(buf, dsp->image, dsp->length)) { | 209 | if (IS_ERR(buf)) |
210 | kfree(buf); | 210 | return PTR_ERR(buf); |
211 | return -EFAULT; | 211 | |
212 | } | ||
213 | err = usb_set_interface(dev, 0, 1); | 212 | err = usb_set_interface(dev, 0, 1); |
214 | if (err) | 213 | if (err) |
215 | snd_printk(KERN_ERR "usb_set_interface error \n"); | 214 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 24393dafcb6e..12ae0340adc0 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c | |||
@@ -33,32 +33,26 @@ static unsigned usb_stream_next_packet_size(struct usb_stream_kernel *sk) | |||
33 | static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) | 33 | static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) |
34 | { | 34 | { |
35 | struct usb_stream *s = sk->s; | 35 | struct usb_stream *s = sk->s; |
36 | unsigned l = 0; | 36 | int pack, lb = 0; |
37 | int pack; | 37 | |
38 | 38 | for (pack = 0; pack < sk->n_o_ps; pack++) { | |
39 | urb->iso_frame_desc[0].offset = 0; | 39 | int l = usb_stream_next_packet_size(sk); |
40 | urb->iso_frame_desc[0].length = usb_stream_next_packet_size(sk); | 40 | if (s->idle_outsize + lb + l > s->period_size) |
41 | sk->out_phase = sk->out_phase_peeked; | ||
42 | urb->transfer_buffer_length = urb->iso_frame_desc[0].length; | ||
43 | |||
44 | for (pack = 1; pack < sk->n_o_ps; pack++) { | ||
45 | l = usb_stream_next_packet_size(sk); | ||
46 | if (s->idle_outsize + urb->transfer_buffer_length + l > | ||
47 | s->period_size) | ||
48 | goto check; | 41 | goto check; |
49 | 42 | ||
50 | sk->out_phase = sk->out_phase_peeked; | 43 | sk->out_phase = sk->out_phase_peeked; |
51 | urb->iso_frame_desc[pack].offset = urb->transfer_buffer_length; | 44 | urb->iso_frame_desc[pack].offset = lb; |
52 | urb->iso_frame_desc[pack].length = l; | 45 | urb->iso_frame_desc[pack].length = l; |
53 | urb->transfer_buffer_length += l; | 46 | lb += l; |
54 | } | 47 | } |
55 | snd_printdd(KERN_DEBUG "%i\n", urb->transfer_buffer_length); | 48 | snd_printdd(KERN_DEBUG "%i\n", lb); |
56 | 49 | ||
57 | check: | 50 | check: |
58 | urb->number_of_packets = pack; | 51 | urb->number_of_packets = pack; |
59 | s->idle_outsize += urb->transfer_buffer_length - s->period_size; | 52 | urb->transfer_buffer_length = lb; |
53 | s->idle_outsize += lb - s->period_size; | ||
60 | snd_printdd(KERN_DEBUG "idle=%i ul=%i ps=%i\n", s->idle_outsize, | 54 | snd_printdd(KERN_DEBUG "idle=%i ul=%i ps=%i\n", s->idle_outsize, |
61 | urb->transfer_buffer_length, s->period_size); | 55 | lb, s->period_size); |
62 | } | 56 | } |
63 | 57 | ||
64 | static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, | 58 | static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, |
@@ -282,21 +276,20 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, | |||
282 | struct usb_stream *s = sk->s; | 276 | struct usb_stream *s = sk->s; |
283 | struct urb *io; | 277 | struct urb *io; |
284 | struct usb_iso_packet_descriptor *id, *od; | 278 | struct usb_iso_packet_descriptor *id, *od; |
285 | int p, l = 0; | 279 | int p = 0, lb = 0, l = 0; |
286 | 280 | ||
287 | io = sk->idle_outurb; | 281 | io = sk->idle_outurb; |
288 | od = io->iso_frame_desc; | 282 | od = io->iso_frame_desc; |
289 | io->transfer_buffer_length = 0; | ||
290 | 283 | ||
291 | for (p = 0; s->sync_packet < 0; ++p, ++s->sync_packet) { | 284 | for (; s->sync_packet < 0; ++p, ++s->sync_packet) { |
292 | struct urb *ii = sk->completed_inurb; | 285 | struct urb *ii = sk->completed_inurb; |
293 | id = ii->iso_frame_desc + | 286 | id = ii->iso_frame_desc + |
294 | ii->number_of_packets + s->sync_packet; | 287 | ii->number_of_packets + s->sync_packet; |
295 | l = id->actual_length; | 288 | l = id->actual_length; |
296 | 289 | ||
297 | od[p].length = l; | 290 | od[p].length = l; |
298 | od[p].offset = io->transfer_buffer_length; | 291 | od[p].offset = lb; |
299 | io->transfer_buffer_length += l; | 292 | lb += l; |
300 | } | 293 | } |
301 | 294 | ||
302 | for (; | 295 | for (; |
@@ -304,38 +297,38 @@ static int usb_stream_prepare_playback(struct usb_stream_kernel *sk, | |||
304 | ++p, ++s->sync_packet) { | 297 | ++p, ++s->sync_packet) { |
305 | l = inurb->iso_frame_desc[s->sync_packet].actual_length; | 298 | l = inurb->iso_frame_desc[s->sync_packet].actual_length; |
306 | 299 | ||
307 | if (s->idle_outsize + io->transfer_buffer_length + l > | 300 | if (s->idle_outsize + lb + l > s->period_size) |
308 | s->period_size) | ||
309 | goto check_ok; | 301 | goto check_ok; |
310 | 302 | ||
311 | od[p].length = l; | 303 | od[p].length = l; |
312 | od[p].offset = io->transfer_buffer_length; | 304 | od[p].offset = lb; |
313 | io->transfer_buffer_length += l; | 305 | lb += l; |
314 | } | 306 | } |
315 | 307 | ||
316 | check_ok: | 308 | check_ok: |
317 | s->sync_packet -= inurb->number_of_packets; | 309 | s->sync_packet -= inurb->number_of_packets; |
318 | if (s->sync_packet < -2 || s->sync_packet > 0) { | 310 | if (unlikely(s->sync_packet < -2 || s->sync_packet > 0)) { |
319 | snd_printk(KERN_WARNING "invalid sync_packet = %i;" | 311 | snd_printk(KERN_WARNING "invalid sync_packet = %i;" |
320 | " p=%i nop=%i %i %x %x %x > %x\n", | 312 | " p=%i nop=%i %i %x %x %x > %x\n", |
321 | s->sync_packet, p, inurb->number_of_packets, | 313 | s->sync_packet, p, inurb->number_of_packets, |
322 | s->idle_outsize + io->transfer_buffer_length + l, | 314 | s->idle_outsize + lb + l, |
323 | s->idle_outsize, io->transfer_buffer_length, l, | 315 | s->idle_outsize, lb, l, |
324 | s->period_size); | 316 | s->period_size); |
325 | return -1; | 317 | return -1; |
326 | } | 318 | } |
327 | if (io->transfer_buffer_length % s->cfg.frame_size) { | 319 | if (unlikely(lb % s->cfg.frame_size)) { |
328 | snd_printk(KERN_WARNING"invalid outsize = %i\n", | 320 | snd_printk(KERN_WARNING"invalid outsize = %i\n", |
329 | io->transfer_buffer_length); | 321 | lb); |
330 | return -1; | 322 | return -1; |
331 | } | 323 | } |
332 | s->idle_outsize += io->transfer_buffer_length - s->period_size; | 324 | s->idle_outsize += lb - s->period_size; |
333 | io->number_of_packets = p; | 325 | io->number_of_packets = p; |
334 | if (s->idle_outsize > 0) { | 326 | io->transfer_buffer_length = lb; |
335 | snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); | 327 | if (s->idle_outsize <= 0) |
336 | return -1; | 328 | return 0; |
337 | } | 329 | |
338 | return 0; | 330 | snd_printk(KERN_WARNING "idle=%i\n", s->idle_outsize); |
331 | return -1; | ||
339 | } | 332 | } |
340 | 333 | ||
341 | static void prepare_inurb(int number_of_packets, struct urb *iu) | 334 | static void prepare_inurb(int number_of_packets, struct urb *iu) |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 9a608fa85155..dd1ab6177840 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -870,7 +870,8 @@ static struct snd_pcm_hardware snd_usX2Y_2c = | |||
870 | { | 870 | { |
871 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 871 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
872 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 872 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
873 | SNDRV_PCM_INFO_MMAP_VALID), | 873 | SNDRV_PCM_INFO_MMAP_VALID | |
874 | SNDRV_PCM_INFO_BATCH), | ||
874 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, | 875 | .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, |
875 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, | 876 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, |
876 | .rate_min = 44100, | 877 | .rate_min = 44100, |