diff options
Diffstat (limited to 'sound/usb/usx2y')
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 13 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 13 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2yaudio.c | 184 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 31 |
4 files changed, 112 insertions, 129 deletions
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 8abe08611df6..fc0d534ec7fc 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -67,15 +67,15 @@ static struct vm_operations_struct us428ctls_vm_ops = { | |||
67 | static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) | 67 | static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) |
68 | { | 68 | { |
69 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); | 69 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); |
70 | usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; | 70 | usX2Ydev_t *us428 = hw->private_data; |
71 | 71 | ||
72 | // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? | 72 | // FIXME this hwdep interface is used twice: fpga download and mmap for controlling Lights etc. Maybe better using 2 hwdep devs? |
73 | // so as long as the device isn't fully initialised yet we return -EBUSY here. | 73 | // so as long as the device isn't fully initialised yet we return -EBUSY here. |
74 | if (!(((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT)) | 74 | if (!(us428->chip_status & USX2Y_STAT_CHIP_INIT)) |
75 | return -EBUSY; | 75 | return -EBUSY; |
76 | 76 | ||
77 | /* if userspace tries to mmap beyond end of our buffer, fail */ | 77 | /* if userspace tries to mmap beyond end of our buffer, fail */ |
78 | if (size > ((PAGE_SIZE - 1 + sizeof(us428ctls_sharedmem_t)) / PAGE_SIZE) * PAGE_SIZE) { | 78 | if (size > PAGE_ALIGN(sizeof(us428ctls_sharedmem_t))) { |
79 | snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); | 79 | snd_printd( "%lu > %lu\n", size, (unsigned long)sizeof(us428ctls_sharedmem_t)); |
80 | return -EINVAL; | 80 | return -EINVAL; |
81 | } | 81 | } |
@@ -96,7 +96,7 @@ static int snd_us428ctls_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_are | |||
96 | static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) | 96 | static unsigned int snd_us428ctls_poll(snd_hwdep_t *hw, struct file *file, poll_table *wait) |
97 | { | 97 | { |
98 | unsigned int mask = 0; | 98 | unsigned int mask = 0; |
99 | usX2Ydev_t *us428 = (usX2Ydev_t*)hw->private_data; | 99 | usX2Ydev_t *us428 = hw->private_data; |
100 | us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; | 100 | us428ctls_sharedmem_t *shm = us428->us428ctls_sharedmem; |
101 | if (us428->chip_status & USX2Y_STAT_CHIP_HUP) | 101 | if (us428->chip_status & USX2Y_STAT_CHIP_HUP) |
102 | return POLLHUP; | 102 | return POLLHUP; |
@@ -127,9 +127,10 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i | |||
127 | [USX2Y_TYPE_224] = "us224", | 127 | [USX2Y_TYPE_224] = "us224", |
128 | [USX2Y_TYPE_428] = "us428", | 128 | [USX2Y_TYPE_428] = "us428", |
129 | }; | 129 | }; |
130 | usX2Ydev_t *us428 = hw->private_data; | ||
130 | int id = -1; | 131 | int id = -1; |
131 | 132 | ||
132 | switch (le16_to_cpu(((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct)) { | 133 | switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) { |
133 | case USB_ID_US122: | 134 | case USB_ID_US122: |
134 | id = USX2Y_TYPE_122; | 135 | id = USX2Y_TYPE_122; |
135 | break; | 136 | break; |
@@ -144,7 +145,7 @@ static int snd_usX2Y_hwdep_dsp_status(snd_hwdep_t *hw, snd_hwdep_dsp_status_t *i | |||
144 | return -ENODEV; | 145 | return -ENODEV; |
145 | strcpy(info->id, type_ids[id]); | 146 | strcpy(info->id, type_ids[id]); |
146 | info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code | 147 | info->num_dsps = 2; // 0: Prepad Data, 1: FPGA Code |
147 | if (((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT) | 148 | if (us428->chip_status & USX2Y_STAT_CHIP_INIT) |
148 | info->chip_ready = 1; | 149 | info->chip_ready = 1; |
149 | info->version = USX2Y_DRIVER_VERSION; | 150 | info->version = USX2Y_DRIVER_VERSION; |
150 | return 0; | 151 | return 0; |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index cf77313c609d..412c2e52d867 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -285,7 +285,6 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y) | |||
285 | 285 | ||
286 | int usX2Y_In04_init(usX2Ydev_t* usX2Y) | 286 | int usX2Y_In04_init(usX2Ydev_t* usX2Y) |
287 | { | 287 | { |
288 | int err = 0; | ||
289 | if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) | 288 | if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) |
290 | return -ENOMEM; | 289 | return -ENOMEM; |
291 | 290 | ||
@@ -299,8 +298,7 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y) | |||
299 | usX2Y->In04Buf, 21, | 298 | usX2Y->In04Buf, 21, |
300 | i_usX2Y_In04Int, usX2Y, | 299 | i_usX2Y_In04Int, usX2Y, |
301 | 10); | 300 | 10); |
302 | err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); | 301 | return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); |
303 | return err; | ||
304 | } | 302 | } |
305 | 303 | ||
306 | static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S) | 304 | static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S) |
@@ -432,20 +430,21 @@ static void snd_usX2Y_card_private_free(snd_card_t *card) | |||
432 | static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr) | 430 | static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr) |
433 | { | 431 | { |
434 | if (ptr) { | 432 | if (ptr) { |
435 | usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr); | 433 | snd_card_t *card = ptr; |
436 | struct list_head* p; | 434 | usX2Ydev_t* usX2Y = usX2Y(card); |
435 | struct list_head *p; | ||
437 | usX2Y->chip.shutdown = 1; | 436 | usX2Y->chip.shutdown = 1; |
438 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; | 437 | usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; |
439 | usX2Y_unlinkSeq(&usX2Y->AS04); | 438 | usX2Y_unlinkSeq(&usX2Y->AS04); |
440 | usb_kill_urb(usX2Y->In04urb); | 439 | usb_kill_urb(usX2Y->In04urb); |
441 | snd_card_disconnect((snd_card_t*)ptr); | 440 | snd_card_disconnect(card); |
442 | /* release the midi resources */ | 441 | /* release the midi resources */ |
443 | list_for_each(p, &usX2Y->chip.midi_list) { | 442 | list_for_each(p, &usX2Y->chip.midi_list) { |
444 | snd_usbmidi_disconnect(p); | 443 | snd_usbmidi_disconnect(p); |
445 | } | 444 | } |
446 | if (usX2Y->us428ctls_sharedmem) | 445 | if (usX2Y->us428ctls_sharedmem) |
447 | wake_up(&usX2Y->us428ctls_wait_queue_head); | 446 | wake_up(&usX2Y->us428ctls_wait_queue_head); |
448 | snd_card_free((snd_card_t*)ptr); | 447 | snd_card_free(card); |
449 | } | 448 | } |
450 | } | 449 | } |
451 | 450 | ||
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index c5989cb7db3f..e1dbfbba8fa9 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -205,47 +205,42 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr | |||
205 | static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame) | 205 | static inline int usX2Y_usbframe_complete(snd_usX2Y_substream_t *capsubs, snd_usX2Y_substream_t *playbacksubs, int frame) |
206 | { | 206 | { |
207 | int err, state; | 207 | int err, state; |
208 | { | 208 | struct urb *urb = playbacksubs->completed_urb; |
209 | struct urb *urb = playbacksubs->completed_urb; | 209 | |
210 | 210 | state = atomic_read(&playbacksubs->state); | |
211 | state = atomic_read(&playbacksubs->state); | 211 | if (NULL != urb) { |
212 | if (NULL != urb) { | 212 | if (state == state_RUNNING) |
213 | if (state == state_RUNNING) | 213 | usX2Y_urb_play_retire(playbacksubs, urb); |
214 | usX2Y_urb_play_retire(playbacksubs, urb); | 214 | else |
215 | else | 215 | if (state >= state_PRERUNNING) |
216 | if (state >= state_PRERUNNING) { | ||
217 | atomic_inc(&playbacksubs->state); | ||
218 | } | ||
219 | } else { | ||
220 | switch (state) { | ||
221 | case state_STARTING1: | ||
222 | urb = playbacksubs->urb[0]; | ||
223 | atomic_inc(&playbacksubs->state); | 216 | atomic_inc(&playbacksubs->state); |
224 | break; | 217 | } else { |
225 | case state_STARTING2: | 218 | switch (state) { |
226 | urb = playbacksubs->urb[1]; | 219 | case state_STARTING1: |
227 | atomic_inc(&playbacksubs->state); | 220 | urb = playbacksubs->urb[0]; |
228 | break; | 221 | atomic_inc(&playbacksubs->state); |
229 | } | 222 | break; |
230 | } | 223 | case state_STARTING2: |
231 | if (urb) { | 224 | urb = playbacksubs->urb[1]; |
232 | if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || | 225 | atomic_inc(&playbacksubs->state); |
233 | (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { | 226 | break; |
234 | return err; | ||
235 | } | ||
236 | } | 227 | } |
237 | |||
238 | playbacksubs->completed_urb = NULL; | ||
239 | } | 228 | } |
229 | if (urb) { | ||
230 | if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || | ||
231 | (err = usX2Y_urb_submit(playbacksubs, urb, frame))) | ||
232 | return err; | ||
233 | } | ||
234 | |||
235 | playbacksubs->completed_urb = NULL; | ||
236 | |||
240 | state = atomic_read(&capsubs->state); | 237 | state = atomic_read(&capsubs->state); |
241 | if (state >= state_PREPARED) { | 238 | if (state >= state_PREPARED) { |
242 | if (state == state_RUNNING) { | 239 | if (state == state_RUNNING) { |
243 | if ((err = usX2Y_urb_capt_retire(capsubs))) | 240 | if ((err = usX2Y_urb_capt_retire(capsubs))) |
244 | return err; | 241 | return err; |
245 | } else | 242 | } else if (state >= state_PRERUNNING) |
246 | if (state >= state_PRERUNNING) { | 243 | atomic_inc(&capsubs->state); |
247 | atomic_inc(&capsubs->state); | ||
248 | } | ||
249 | if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) | 244 | if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) |
250 | return err; | 245 | return err; |
251 | } | 246 | } |
@@ -429,7 +424,7 @@ static int usX2Y_urbs_allocate(snd_usX2Y_substream_t *subs) | |||
429 | } | 424 | } |
430 | /* allocate and initialize data urbs */ | 425 | /* allocate and initialize data urbs */ |
431 | for (i = 0; i < NRURBS; i++) { | 426 | for (i = 0; i < NRURBS; i++) { |
432 | struct urb** purb = subs->urb + i; | 427 | struct urb **purb = subs->urb + i; |
433 | if (*purb) { | 428 | if (*purb) { |
434 | usb_kill_urb(*purb); | 429 | usb_kill_urb(*purb); |
435 | continue; | 430 | continue; |
@@ -480,47 +475,45 @@ static int usX2Y_urbs_start(snd_usX2Y_substream_t *subs) | |||
480 | goto start; | 475 | goto start; |
481 | } | 476 | } |
482 | usX2Y->wait_iso_frame = -1; | 477 | usX2Y->wait_iso_frame = -1; |
478 | |||
483 | start: | 479 | start: |
484 | { | 480 | usX2Y_subs_startup(subs); |
485 | usX2Y_subs_startup(subs); | 481 | for (i = 0; i < NRURBS; i++) { |
486 | for (i = 0; i < NRURBS; i++) { | 482 | struct urb *urb = subs->urb[i]; |
487 | struct urb *urb = subs->urb[i]; | 483 | if (usb_pipein(urb->pipe)) { |
488 | if (usb_pipein(urb->pipe)) { | 484 | unsigned long pack; |
489 | unsigned long pack; | 485 | if (0 == i) |
490 | if (0 == i) | 486 | atomic_set(&subs->state, state_STARTING3); |
491 | atomic_set(&subs->state, state_STARTING3); | 487 | urb->dev = usX2Y->chip.dev; |
492 | urb->dev = usX2Y->chip.dev; | 488 | urb->transfer_flags = URB_ISO_ASAP; |
493 | urb->transfer_flags = URB_ISO_ASAP; | 489 | for (pack = 0; pack < nr_of_packs(); pack++) { |
494 | for (pack = 0; pack < nr_of_packs(); pack++) { | 490 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; |
495 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; | 491 | urb->iso_frame_desc[pack].length = subs->maxpacksize; |
496 | urb->iso_frame_desc[pack].length = subs->maxpacksize; | 492 | } |
497 | } | 493 | urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); |
498 | urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); | 494 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
499 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { | 495 | snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); |
500 | snd_printk (KERN_ERR "cannot submit datapipe for urb %d, err = %d\n", i, err); | 496 | err = -EPIPE; |
501 | err = -EPIPE; | 497 | goto cleanup; |
502 | goto cleanup; | ||
503 | } else { | ||
504 | if (0 > usX2Y->wait_iso_frame) | ||
505 | usX2Y->wait_iso_frame = urb->start_frame; | ||
506 | } | ||
507 | urb->transfer_flags = 0; | ||
508 | } else { | 498 | } else { |
509 | atomic_set(&subs->state, state_STARTING1); | 499 | if (0 > usX2Y->wait_iso_frame) |
510 | break; | 500 | usX2Y->wait_iso_frame = urb->start_frame; |
511 | } | 501 | } |
502 | urb->transfer_flags = 0; | ||
503 | } else { | ||
504 | atomic_set(&subs->state, state_STARTING1); | ||
505 | break; | ||
512 | } | 506 | } |
513 | err = 0; | 507 | } |
514 | wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); | 508 | err = 0; |
515 | if (atomic_read(&subs->state) != state_PREPARED) { | 509 | wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); |
516 | err = -EPIPE; | 510 | if (atomic_read(&subs->state) != state_PREPARED) |
517 | } | 511 | err = -EPIPE; |
518 | 512 | ||
519 | cleanup: | 513 | cleanup: |
520 | if (err) { | 514 | if (err) { |
521 | usX2Y_subs_startup_finish(usX2Y); | 515 | usX2Y_subs_startup_finish(usX2Y); |
522 | usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything | 516 | usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything |
523 | } | ||
524 | } | 517 | } |
525 | return err; | 518 | return err; |
526 | } | 519 | } |
@@ -667,13 +660,12 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) | |||
667 | struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; | 660 | struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; |
668 | 661 | ||
669 | if (usX2Y->rate != rate) { | 662 | if (usX2Y->rate != rate) { |
670 | us = kmalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); | 663 | us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); |
671 | if (NULL == us) { | 664 | if (NULL == us) { |
672 | err = -ENOMEM; | 665 | err = -ENOMEM; |
673 | goto cleanup; | 666 | goto cleanup; |
674 | } | 667 | } |
675 | memset(us, 0, sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS); | 668 | usbdata = kmalloc(sizeof(int) * NOOF_SETRATE_URBS, GFP_KERNEL); |
676 | usbdata = kmalloc(sizeof(int)*NOOF_SETRATE_URBS, GFP_KERNEL); | ||
677 | if (NULL == usbdata) { | 669 | if (NULL == usbdata) { |
678 | err = -ENOMEM; | 670 | err = -ENOMEM; |
679 | goto cleanup; | 671 | goto cleanup; |
@@ -713,9 +705,8 @@ static int usX2Y_rate_set(usX2Ydev_t *usX2Y, int rate) | |||
713 | usX2Y->US04 = NULL; | 705 | usX2Y->US04 = NULL; |
714 | kfree(usbdata); | 706 | kfree(usbdata); |
715 | kfree(us); | 707 | kfree(us); |
716 | if (!err) { | 708 | if (!err) |
717 | usX2Y->rate = rate; | 709 | usX2Y->rate = rate; |
718 | } | ||
719 | } | 710 | } |
720 | } | 711 | } |
721 | 712 | ||
@@ -759,30 +750,29 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, | |||
759 | int err = 0; | 750 | int err = 0; |
760 | unsigned int rate = params_rate(hw_params); | 751 | unsigned int rate = params_rate(hw_params); |
761 | snd_pcm_format_t format = params_format(hw_params); | 752 | snd_pcm_format_t format = params_format(hw_params); |
762 | snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); | ||
763 | |||
764 | { // all pcm substreams off one usX2Y have to operate at the same rate & format | ||
765 | snd_card_t *card = substream->pstr->pcm->card; | 753 | snd_card_t *card = substream->pstr->pcm->card; |
766 | struct list_head *list; | 754 | struct list_head *list; |
767 | list_for_each(list, &card->devices) { | 755 | |
768 | snd_device_t *dev; | 756 | snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); |
769 | snd_pcm_t *pcm; | 757 | // all pcm substreams off one usX2Y have to operate at the same rate & format |
770 | int s; | 758 | list_for_each(list, &card->devices) { |
771 | dev = snd_device(list); | 759 | snd_device_t *dev; |
772 | if (dev->type != SNDRV_DEV_PCM) | 760 | snd_pcm_t *pcm; |
773 | continue; | 761 | int s; |
774 | pcm = dev->device_data; | 762 | dev = snd_device(list); |
775 | for (s = 0; s < 2; ++s) { | 763 | if (dev->type != SNDRV_DEV_PCM) |
776 | snd_pcm_substream_t *test_substream; | 764 | continue; |
777 | test_substream = pcm->streams[s].substream; | 765 | pcm = dev->device_data; |
778 | if (test_substream && test_substream != substream && | 766 | for (s = 0; s < 2; ++s) { |
779 | test_substream->runtime && | 767 | snd_pcm_substream_t *test_substream; |
780 | ((test_substream->runtime->format && | 768 | test_substream = pcm->streams[s].substream; |
781 | test_substream->runtime->format != format) || | 769 | if (test_substream && test_substream != substream && |
782 | (test_substream->runtime->rate && | 770 | test_substream->runtime && |
783 | test_substream->runtime->rate != rate))) | 771 | ((test_substream->runtime->format && |
784 | return -EINVAL; | 772 | test_substream->runtime->format != format) || |
785 | } | 773 | (test_substream->runtime->rate && |
774 | test_substream->runtime->rate != rate))) | ||
775 | return -EINVAL; | ||
786 | } | 776 | } |
787 | } | 777 | } |
788 | if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { | 778 | if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index 4bbf52bd6025..c5379280fab7 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -177,10 +177,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, | |||
177 | if (NULL != urb) { | 177 | if (NULL != urb) { |
178 | if (state == state_RUNNING) | 178 | if (state == state_RUNNING) |
179 | usX2Y_urb_play_retire(playbacksubs, urb); | 179 | usX2Y_urb_play_retire(playbacksubs, urb); |
180 | else | 180 | else if (state >= state_PRERUNNING) |
181 | if (state >= state_PRERUNNING) { | 181 | atomic_inc(&playbacksubs->state); |
182 | atomic_inc(&playbacksubs->state); | ||
183 | } | ||
184 | } else { | 182 | } else { |
185 | switch (state) { | 183 | switch (state) { |
186 | case state_STARTING1: | 184 | case state_STARTING1: |
@@ -207,10 +205,8 @@ static inline int usX2Y_usbpcm_usbframe_complete(snd_usX2Y_substream_t *capsubs, | |||
207 | if (state == state_RUNNING) { | 205 | if (state == state_RUNNING) { |
208 | if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs))) | 206 | if ((err = usX2Y_usbpcm_urb_capt_retire(capsubs))) |
209 | return err; | 207 | return err; |
210 | } else { | 208 | } else if (state >= state_PRERUNNING) |
211 | if (state >= state_PRERUNNING) | 209 | atomic_inc(&capsubs->state); |
212 | atomic_inc(&capsubs->state); | ||
213 | } | ||
214 | usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); | 210 | usX2Y_usbpcm_urb_capt_iso_advance(capsubs, capsubs->completed_urb); |
215 | if (NULL != capsubs2) | 211 | if (NULL != capsubs2) |
216 | usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); | 212 | usX2Y_usbpcm_urb_capt_iso_advance(NULL, capsubs2->completed_urb); |
@@ -330,7 +326,7 @@ static int usX2Y_usbpcm_urbs_allocate(snd_usX2Y_substream_t *subs) | |||
330 | 326 | ||
331 | /* allocate and initialize data urbs */ | 327 | /* allocate and initialize data urbs */ |
332 | for (i = 0; i < NRURBS; i++) { | 328 | for (i = 0; i < NRURBS; i++) { |
333 | struct urb** purb = subs->urb + i; | 329 | struct urb **purb = subs->urb + i; |
334 | if (*purb) { | 330 | if (*purb) { |
335 | usb_kill_urb(*purb); | 331 | usb_kill_urb(*purb); |
336 | continue; | 332 | continue; |
@@ -582,10 +578,9 @@ static int snd_usX2Y_usbpcm_close(snd_pcm_substream_t *substream) | |||
582 | { | 578 | { |
583 | snd_pcm_runtime_t *runtime = substream->runtime; | 579 | snd_pcm_runtime_t *runtime = substream->runtime; |
584 | snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; | 580 | snd_usX2Y_substream_t *subs = (snd_usX2Y_substream_t *)runtime->private_data; |
585 | int err = 0; | 581 | |
586 | snd_printd("\n"); | ||
587 | subs->pcm_substream = NULL; | 582 | subs->pcm_substream = NULL; |
588 | return err; | 583 | return 0; |
589 | } | 584 | } |
590 | 585 | ||
591 | 586 | ||
@@ -710,9 +705,9 @@ static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { | |||
710 | static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) | 705 | static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct vm_area_struct *area) |
711 | { | 706 | { |
712 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); | 707 | unsigned long size = (unsigned long)(area->vm_end - area->vm_start); |
713 | usX2Ydev_t *usX2Y = (usX2Ydev_t*)hw->private_data; | 708 | usX2Ydev_t *usX2Y = hw->private_data; |
714 | 709 | ||
715 | if (!(((usX2Ydev_t*)hw->private_data)->chip_status & USX2Y_STAT_CHIP_INIT)) | 710 | if (!(usX2Y->chip_status & USX2Y_STAT_CHIP_INIT)) |
716 | return -EBUSY; | 711 | return -EBUSY; |
717 | 712 | ||
718 | /* if userspace tries to mmap beyond end of our buffer, fail */ | 713 | /* if userspace tries to mmap beyond end of our buffer, fail */ |
@@ -726,7 +721,6 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct | |||
726 | } | 721 | } |
727 | area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; | 722 | area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops; |
728 | area->vm_flags |= VM_RESERVED; | 723 | area->vm_flags |= VM_RESERVED; |
729 | snd_printd("vm_flags=0x%lX\n", area->vm_flags); | ||
730 | area->vm_private_data = hw->private_data; | 724 | area->vm_private_data = hw->private_data; |
731 | return 0; | 725 | return 0; |
732 | } | 726 | } |
@@ -734,7 +728,7 @@ static int snd_usX2Y_hwdep_pcm_mmap(snd_hwdep_t * hw, struct file *filp, struct | |||
734 | 728 | ||
735 | static void snd_usX2Y_hwdep_pcm_private_free(snd_hwdep_t *hwdep) | 729 | static void snd_usX2Y_hwdep_pcm_private_free(snd_hwdep_t *hwdep) |
736 | { | 730 | { |
737 | usX2Ydev_t *usX2Y = (usX2Ydev_t *)hwdep->private_data; | 731 | usX2Ydev_t *usX2Y = hwdep->private_data; |
738 | if (NULL != usX2Y->hwdep_pcm_shm) | 732 | if (NULL != usX2Y->hwdep_pcm_shm) |
739 | snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); | 733 | snd_free_pages(usX2Y->hwdep_pcm_shm, sizeof(snd_usX2Y_hwdep_pcm_shm_t)); |
740 | } | 734 | } |
@@ -749,10 +743,9 @@ int usX2Y_hwdep_pcm_new(snd_card_t* card) | |||
749 | if (1 != nr_of_packs()) | 743 | if (1 != nr_of_packs()) |
750 | return 0; | 744 | return 0; |
751 | 745 | ||
752 | if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0) { | 746 | if ((err = snd_hwdep_new(card, SND_USX2Y_USBPCM_ID, 1, &hw)) < 0) |
753 | snd_printd("\n"); | ||
754 | return err; | 747 | return err; |
755 | } | 748 | |
756 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM; | 749 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y_PCM; |
757 | hw->private_data = usX2Y(card); | 750 | hw->private_data = usX2Y(card); |
758 | hw->private_free = snd_usX2Y_hwdep_pcm_private_free; | 751 | hw->private_free = snd_usX2Y_hwdep_pcm_private_free; |