1 /******************************************************************************
5 * Audio driver for EasyCAP USB2.0 Video Capture Device DC60 *
8 ******************************************************************************/
11 * Copyright (C) 2010 R.M. Thomas <rmthomas@sciolus.org>
14 * This is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * The software is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this software; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 /*****************************************************************************/
33 #ifndef CONFIG_EASYCAP_OSS
34 /*--------------------------------------------------------------------------*/
36 * PARAMETERS USED WHEN REGISTERING THE AUDIO INTERFACE
38 /*--------------------------------------------------------------------------*/
39 static const struct snd_pcm_hardware alsa_hardware = {
40 .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
42 SNDRV_PCM_INFO_INTERLEAVED |
43 SNDRV_PCM_INFO_MMAP_VALID,
44 .formats = SNDRV_PCM_FMTBIT_S16_LE,
45 .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000,
50 .buffer_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT *
52 .period_bytes_min = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT,
53 .period_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT * 2,
54 .periods_min = AUDIO_FRAGMENT_MANY,
55 .periods_max = AUDIO_FRAGMENT_MANY * 2,
59 /*****************************************************************************/
60 /*---------------------------------------------------------------------------*/
62 * ON COMPLETION OF AN AUDIO URB ITS DATA IS COPIED TO THE DAM BUFFER
63 * PROVIDED peasycap->audio_idle IS ZERO. REGARDLESS OF THIS BEING TRUE,
64 * IT IS RESUBMITTED PROVIDED peasycap->audio_isoc_streaming IS NOT ZERO.
66 /*---------------------------------------------------------------------------*/
68 easycap_alsa_complete(struct urb *purb)
70 struct easycap *peasycap;
71 struct snd_pcm_substream *pss;
72 struct snd_pcm_runtime *prt;
73 int dma_bytes, fragment_bytes;
77 int i, j, more, much, rc;
80 __s16 oldaudio, newaudio, delta;
86 SAY("ERROR: purb is NULL\n");
89 peasycap = purb->context;
90 if (NULL == peasycap) {
91 SAY("ERROR: peasycap is NULL\n");
94 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
95 SAY("ERROR: bad peasycap\n");
99 if (peasycap->audio_idle) {
100 JOM(16, "%i=audio_idle %i=audio_isoc_streaming\n",
101 peasycap->audio_idle, peasycap->audio_isoc_streaming);
102 if (peasycap->audio_isoc_streaming)
105 /*---------------------------------------------------------------------------*/
106 pss = peasycap->psubstream;
112 dma_bytes = (int)prt->dma_bytes;
115 fragment_bytes = 4 * ((int)prt->period_size);
116 if (0 == fragment_bytes)
118 /* -------------------------------------------------------------------------*/
120 if ((-ESHUTDOWN == purb->status) || (-ENOENT == purb->status)) {
121 JOM(16, "urb status -ESHUTDOWN or -ENOENT\n");
124 SAM("ERROR: non-zero urb status: -%s: %d\n",
125 strerror(purb->status), purb->status);
128 /*---------------------------------------------------------------------------*/
130 * PROCEED HERE WHEN NO ERROR
132 /*---------------------------------------------------------------------------*/
134 #if defined(UPSAMPLE)
135 oldaudio = peasycap->oldaudio;
138 for (i = 0; i < purb->number_of_packets; i++) {
139 if (purb->iso_frame_desc[i].status < 0) {
141 strerror(purb->iso_frame_desc[i].status),
142 purb->iso_frame_desc[i].status);
144 if (!purb->iso_frame_desc[i].status) {
145 more = purb->iso_frame_desc[i].actual_length;
147 peasycap->audio_mt++;
149 if (peasycap->audio_mt) {
150 JOM(12, "%4i empty audio urb frames\n",
152 peasycap->audio_mt = 0;
155 p1 = (__u8 *)(purb->transfer_buffer +
156 purb->iso_frame_desc[i].offset);
158 /*---------------------------------------------------------------------------*/
160 * COPY more BYTES FROM ISOC BUFFER TO THE DMA BUFFER,
161 * CONVERTING 8-BIT MONO TO 16-BIT SIGNED LITTLE-ENDIAN SAMPLES IF NECESSARY
163 /*---------------------------------------------------------------------------*/
166 SAM("MISTAKE: more is negative\n");
169 much = dma_bytes - peasycap->dma_fill;
171 SAM("MISTAKE: much is negative\n");
175 peasycap->dma_fill = 0;
176 peasycap->dma_next = fragment_bytes;
177 JOM(8, "wrapped dma buffer\n");
179 if (false == peasycap->microphone) {
182 memcpy(prt->dma_area +
188 #if defined(UPSAMPLE)
190 JOM(8, "MISTAKE? much"
191 " is not divisible by 16\n");
196 p2 = (__u8 *)(prt->dma_area +
199 for (j = 0; j < (much/16); j++) {
200 newaudio = ((int) *p1) - 128;
204 delta = (newaudio - oldaudio)
206 s16 = oldaudio + delta;
208 for (k = 0; k < 4; k++) {
209 *p2 = (0x00FF & s16);
210 *(p2 + 1) = (0xFF00 &
213 *p2 = (0x00FF & s16);
214 *(p2 + 1) = (0xFF00 &
224 if (much > (2 * more))
226 p2 = (__u8 *)(prt->dma_area +
229 for (j = 0; j < (much / 2); j++) {
230 s16 = ((int) *p1) - 128;
233 *p2 = (0x00FF & s16);
234 *(p2 + 1) = (0xFF00 & s16) >>
241 peasycap->dma_fill += much;
242 if (peasycap->dma_fill >= peasycap->dma_next) {
243 isfragment = peasycap->dma_fill /
245 if (0 > isfragment) {
246 SAM("MISTAKE: isfragment is "
250 peasycap->dma_read = (isfragment
251 - 1) * fragment_bytes;
252 peasycap->dma_next = (isfragment
253 + 1) * fragment_bytes;
254 if (dma_bytes < peasycap->dma_next) {
258 if (0 <= peasycap->dma_read) {
259 JOM(8, "snd_pcm_period_elap"
263 snd_pcm_period_elapsed(pss);
269 JOM(12, "discarding audio samples because "
270 "%i=purb->iso_frame_desc[i].status\n",
271 purb->iso_frame_desc[i].status);
274 #if defined(UPSAMPLE)
275 peasycap->oldaudio = oldaudio;
279 /*---------------------------------------------------------------------------*/
283 /*---------------------------------------------------------------------------*/
285 if (peasycap->audio_isoc_streaming) {
286 rc = usb_submit_urb(purb, GFP_ATOMIC);
288 if ((-ENODEV != rc) && (-ENOENT != rc)) {
289 SAM("ERROR: while %i=audio_idle, "
290 "usb_submit_urb() failed "
291 "with rc: -%s :%d\n", peasycap->audio_idle,
294 if (0 < peasycap->audio_isoc_streaming)
295 (peasycap->audio_isoc_streaming)--;
300 /*****************************************************************************/
301 static int easycap_alsa_open(struct snd_pcm_substream *pss)
303 struct snd_pcm *psnd_pcm;
304 struct snd_card *psnd_card;
305 struct easycap *peasycap;
309 SAY("ERROR: pss is NULL\n");
313 if (NULL == psnd_pcm) {
314 SAY("ERROR: psnd_pcm is NULL\n");
317 psnd_card = psnd_pcm->card;
318 if (NULL == psnd_card) {
319 SAY("ERROR: psnd_card is NULL\n");
323 peasycap = psnd_card->private_data;
324 if (NULL == peasycap) {
325 SAY("ERROR: peasycap is NULL\n");
328 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
329 SAY("ERROR: bad peasycap\n");
332 if (peasycap->psnd_card != psnd_card) {
333 SAM("ERROR: bad peasycap->psnd_card\n");
336 if (NULL != peasycap->psubstream) {
337 SAM("ERROR: bad peasycap->psubstream\n");
340 pss->private_data = peasycap;
341 peasycap->psubstream = pss;
342 pss->runtime->hw = peasycap->alsa_hardware;
343 pss->runtime->private_data = peasycap;
344 pss->private_data = peasycap;
346 if (0 != easycap_sound_setup(peasycap)) {
347 JOM(4, "ending unsuccessfully\n");
350 JOM(4, "ending successfully\n");
353 /*****************************************************************************/
354 static int easycap_alsa_close(struct snd_pcm_substream *pss)
356 struct easycap *peasycap;
360 SAY("ERROR: pss is NULL\n");
363 peasycap = snd_pcm_substream_chip(pss);
364 if (NULL == peasycap) {
365 SAY("ERROR: peasycap is NULL\n");
368 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
369 SAY("ERROR: bad peasycap\n");
372 pss->private_data = NULL;
373 peasycap->psubstream = NULL;
374 JOT(4, "ending successfully\n");
377 /*****************************************************************************/
378 static int easycap_alsa_vmalloc(struct snd_pcm_substream *pss, size_t sz)
380 struct snd_pcm_runtime *prt;
384 SAY("ERROR: pss is NULL\n");
389 SAY("ERROR: substream.runtime is NULL\n");
393 if (prt->dma_bytes > sz)
395 vfree(prt->dma_area);
397 prt->dma_area = vmalloc(sz);
398 if (NULL == prt->dma_area)
403 /*****************************************************************************/
404 static int easycap_alsa_hw_params(struct snd_pcm_substream *pss,
405 struct snd_pcm_hw_params *phw)
409 JOT(4, "%i\n", (params_buffer_bytes(phw)));
411 SAY("ERROR: pss is NULL\n");
414 rc = easycap_alsa_vmalloc(pss, params_buffer_bytes(phw));
419 /*****************************************************************************/
420 static int easycap_alsa_hw_free(struct snd_pcm_substream *pss)
422 struct snd_pcm_runtime *prt;
426 SAY("ERROR: pss is NULL\n");
431 SAY("ERROR: substream.runtime is NULL\n");
434 if (NULL != prt->dma_area) {
435 JOT(8, "0x%08lX=prt->dma_area\n", (unsigned long int)prt->dma_area);
436 vfree(prt->dma_area);
437 prt->dma_area = NULL;
439 JOT(8, "dma_area already freed\n");
442 /*****************************************************************************/
443 static int easycap_alsa_prepare(struct snd_pcm_substream *pss)
445 struct easycap *peasycap;
446 struct snd_pcm_runtime *prt;
450 SAY("ERROR: pss is NULL\n");
454 peasycap = snd_pcm_substream_chip(pss);
455 if (NULL == peasycap) {
456 SAY("ERROR: peasycap is NULL\n");
459 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
460 SAY("ERROR: bad peasycap\n");
464 JOM(16, "ALSA decides %8i Hz=rate\n", (int)pss->runtime->rate);
465 JOM(16, "ALSA decides %8i =period_size\n", (int)pss->runtime->period_size);
466 JOM(16, "ALSA decides %8i =periods\n", (int)pss->runtime->periods);
467 JOM(16, "ALSA decides %8i =buffer_size\n", (int)pss->runtime->buffer_size);
468 JOM(16, "ALSA decides %8i =dma_bytes\n", (int)pss->runtime->dma_bytes);
469 JOM(16, "ALSA decides %8i =boundary\n", (int)pss->runtime->boundary);
470 JOM(16, "ALSA decides %8i =period_step\n", (int)pss->runtime->period_step);
471 JOM(16, "ALSA decides %8i =sample_bits\n", (int)pss->runtime->sample_bits);
472 JOM(16, "ALSA decides %8i =frame_bits\n", (int)pss->runtime->frame_bits);
473 JOM(16, "ALSA decides %8i =min_align\n", (int)pss->runtime->min_align);
474 JOM(12, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base);
475 JOM(12, "ALSA decides %8i =hw_ptr_interrupt\n",
476 (int)pss->runtime->hw_ptr_interrupt);
477 if (prt->dma_bytes != 4 * ((int)prt->period_size) * ((int)prt->periods)) {
478 SAY("MISTAKE: unexpected ALSA parameters\n");
483 /*****************************************************************************/
484 static int easycap_alsa_ack(struct snd_pcm_substream *pss)
488 /*****************************************************************************/
489 static int easycap_alsa_trigger(struct snd_pcm_substream *pss, int cmd)
491 struct easycap *peasycap;
494 JOT(4, "%i=cmd cf %i=START %i=STOP\n", cmd, SNDRV_PCM_TRIGGER_START,
495 SNDRV_PCM_TRIGGER_STOP);
497 SAY("ERROR: pss is NULL\n");
500 peasycap = snd_pcm_substream_chip(pss);
501 if (NULL == peasycap) {
502 SAY("ERROR: peasycap is NULL\n");
505 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
506 SAY("ERROR: bad peasycap\n");
511 case SNDRV_PCM_TRIGGER_START: {
512 peasycap->audio_idle = 0;
515 case SNDRV_PCM_TRIGGER_STOP: {
516 peasycap->audio_idle = 1;
524 /*****************************************************************************/
525 static snd_pcm_uframes_t easycap_alsa_pointer(struct snd_pcm_substream *pss)
527 struct easycap *peasycap;
528 snd_pcm_uframes_t offset;
532 SAY("ERROR: pss is NULL\n");
535 peasycap = snd_pcm_substream_chip(pss);
536 if (NULL == peasycap) {
537 SAY("ERROR: peasycap is NULL\n");
540 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
541 SAY("ERROR: bad peasycap\n");
544 if ((0 != peasycap->audio_eof) || (0 != peasycap->audio_idle)) {
545 JOM(8, "returning -EIO because "
546 "%i=audio_idle %i=audio_eof\n",
547 peasycap->audio_idle, peasycap->audio_eof);
550 /*---------------------------------------------------------------------------*/
551 if (0 > peasycap->dma_read) {
552 JOM(8, "returning -EBUSY\n");
555 offset = ((snd_pcm_uframes_t)peasycap->dma_read)/4;
556 JOM(8, "ALSA decides %8i =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base);
557 JOM(8, "ALSA decides %8i =hw_ptr_interrupt\n",
558 (int)pss->runtime->hw_ptr_interrupt);
559 JOM(8, "%7i=offset %7i=dma_read %7i=dma_next\n",
560 (int)offset, peasycap->dma_read, peasycap->dma_next);
563 /*****************************************************************************/
564 static struct page *easycap_alsa_page(struct snd_pcm_substream *pss,
565 unsigned long offset)
567 return vmalloc_to_page(pss->runtime->dma_area + offset);
569 /*****************************************************************************/
571 static struct snd_pcm_ops easycap_alsa_pcm_ops = {
572 .open = easycap_alsa_open,
573 .close = easycap_alsa_close,
574 .ioctl = snd_pcm_lib_ioctl,
575 .hw_params = easycap_alsa_hw_params,
576 .hw_free = easycap_alsa_hw_free,
577 .prepare = easycap_alsa_prepare,
578 .ack = easycap_alsa_ack,
579 .trigger = easycap_alsa_trigger,
580 .pointer = easycap_alsa_pointer,
581 .page = easycap_alsa_page,
584 /*****************************************************************************/
585 /*---------------------------------------------------------------------------*/
587 * THE FUNCTION snd_card_create() HAS THIS_MODULE AS AN ARGUMENT. THIS
588 * MEANS MODULE easycap. BEWARE.
590 /*---------------------------------------------------------------------------*/
591 int easycap_alsa_probe(struct easycap *peasycap)
594 struct snd_card *psnd_card;
595 struct snd_pcm *psnd_pcm;
597 if (NULL == peasycap) {
598 SAY("ERROR: peasycap is NULL\n");
601 if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
602 SAY("ERROR: bad peasycap\n");
605 if (0 > peasycap->minor) {
606 SAY("ERROR: no minor\n");
610 peasycap->alsa_hardware = alsa_hardware;
611 if (true == peasycap->microphone) {
612 peasycap->alsa_hardware.rates = SNDRV_PCM_RATE_32000;
613 peasycap->alsa_hardware.rate_min = 32000;
614 peasycap->alsa_hardware.rate_max = 32000;
616 peasycap->alsa_hardware.rates = SNDRV_PCM_RATE_48000;
617 peasycap->alsa_hardware.rate_min = 48000;
618 peasycap->alsa_hardware.rate_max = 48000;
621 if (0 != snd_card_create(SNDRV_DEFAULT_IDX1, "easycap_alsa",
624 SAY("ERROR: Cannot do ALSA snd_card_create()\n");
628 sprintf(&psnd_card->id[0], "EasyALSA%i", peasycap->minor);
629 strcpy(&psnd_card->driver[0], EASYCAP_DRIVER_DESCRIPTION);
630 strcpy(&psnd_card->shortname[0], "easycap_alsa");
631 sprintf(&psnd_card->longname[0], "%s", &psnd_card->shortname[0]);
633 psnd_card->dev = &peasycap->pusb_device->dev;
634 psnd_card->private_data = peasycap;
635 peasycap->psnd_card = psnd_card;
637 rc = snd_pcm_new(psnd_card, "easycap_pcm", 0, 0, 1, &psnd_pcm);
639 SAM("ERROR: Cannot do ALSA snd_pcm_new()\n");
640 snd_card_free(psnd_card);
644 snd_pcm_set_ops(psnd_pcm, SNDRV_PCM_STREAM_CAPTURE,
645 &easycap_alsa_pcm_ops);
646 psnd_pcm->info_flags = 0;
647 strcpy(&psnd_pcm->name[0], &psnd_card->id[0]);
648 psnd_pcm->private_data = peasycap;
649 peasycap->psnd_pcm = psnd_pcm;
650 peasycap->psubstream = NULL;
652 rc = snd_card_register(psnd_card);
654 SAM("ERROR: Cannot do ALSA snd_card_register()\n");
655 snd_card_free(psnd_card);
659 SAM("registered %s\n", &psnd_card->id[0]);
663 #endif /*! CONFIG_EASYCAP_OSS */
665 /*****************************************************************************/
666 /*****************************************************************************/
667 /*****************************************************************************/
668 /*****************************************************************************/
669 /*****************************************************************************/
670 /*****************************************************************************/
671 /*---------------------------------------------------------------------------*/
673 * COMMON AUDIO INITIALIZATION
675 /*---------------------------------------------------------------------------*/
677 easycap_sound_setup(struct easycap *peasycap)
681 JOM(4, "starting initialization\n");
683 if (NULL == peasycap) {
684 SAY("ERROR: peasycap is NULL.\n");
687 if (NULL == peasycap->pusb_device) {
688 SAM("ERROR: peasycap->pusb_device is NULL\n");
691 JOM(16, "0x%08lX=peasycap->pusb_device\n", (long int)peasycap->pusb_device);
693 rc = audio_setup(peasycap);
694 JOM(8, "audio_setup() returned %i\n", rc);
696 if (NULL == peasycap->pusb_device) {
697 SAM("ERROR: peasycap->pusb_device has become NULL\n");
700 /*---------------------------------------------------------------------------*/
701 if (NULL == peasycap->pusb_device) {
702 SAM("ERROR: peasycap->pusb_device has become NULL\n");
705 rc = usb_set_interface(peasycap->pusb_device, peasycap->audio_interface,
706 peasycap->audio_altsetting_on);
707 JOM(8, "usb_set_interface(.,%i,%i) returned %i\n", peasycap->audio_interface,
708 peasycap->audio_altsetting_on, rc);
710 rc = wakeup_device(peasycap->pusb_device);
711 JOM(8, "wakeup_device() returned %i\n", rc);
713 peasycap->audio_eof = 0;
714 peasycap->audio_idle = 0;
716 peasycap->timeval1.tv_sec = 0;
717 peasycap->timeval1.tv_usec = 0;
719 submit_audio_urbs(peasycap);
721 JOM(4, "finished initialization\n");
724 /*****************************************************************************/
725 /*---------------------------------------------------------------------------*/
727 * SUBMIT ALL AUDIO URBS.
729 /*---------------------------------------------------------------------------*/
731 submit_audio_urbs(struct easycap *peasycap)
733 struct data_urb *pdata_urb;
735 struct list_head *plist_head;
736 int j, isbad, nospc, m, rc;
739 if (NULL == peasycap) {
740 SAY("ERROR: peasycap is NULL\n");
743 if (NULL == peasycap->purb_audio_head) {
744 SAM("ERROR: peasycap->urb_audio_head uninitialized\n");
747 if (NULL == peasycap->pusb_device) {
748 SAM("ERROR: peasycap->pusb_device is NULL\n");
751 if (!peasycap->audio_isoc_streaming) {
752 JOM(4, "initial submission of all audio urbs\n");
753 rc = usb_set_interface(peasycap->pusb_device,
754 peasycap->audio_interface,
755 peasycap->audio_altsetting_on);
756 JOM(8, "usb_set_interface(.,%i,%i) returned %i\n",
757 peasycap->audio_interface,
758 peasycap->audio_altsetting_on, rc);
760 isbad = 0; nospc = 0; m = 0;
761 list_for_each(plist_head, (peasycap->purb_audio_head)) {
762 pdata_urb = list_entry(plist_head, struct data_urb, list_head);
763 if (NULL != pdata_urb) {
764 purb = pdata_urb->purb;
766 isbuf = pdata_urb->isbuf;
769 purb->dev = peasycap->pusb_device;
771 usb_rcvisocpipe(peasycap->pusb_device,
772 peasycap->audio_endpointnumber);
773 purb->transfer_flags = URB_ISO_ASAP;
774 purb->transfer_buffer =
775 peasycap->audio_isoc_buffer[isbuf].pgo;
776 purb->transfer_buffer_length =
777 peasycap->audio_isoc_buffer_size;
778 #ifdef CONFIG_EASYCAP_OSS
779 purb->complete = easyoss_complete;
780 #else /* CONFIG_EASYCAP_OSS */
781 purb->complete = easycap_alsa_complete;
782 #endif /* CONFIG_EASYCAP_OSS */
783 purb->context = peasycap;
784 purb->start_frame = 0;
785 purb->number_of_packets =
786 peasycap->audio_isoc_framesperdesc;
787 for (j = 0; j < peasycap->
788 audio_isoc_framesperdesc;
790 purb->iso_frame_desc[j].offset = j *
792 audio_isoc_maxframesize;
793 purb->iso_frame_desc[j].length =
795 audio_isoc_maxframesize;
798 rc = usb_submit_urb(purb, GFP_KERNEL);
801 SAM("ERROR: usb_submit_urb() failed"
802 " for urb with rc: -%s: %d\n",
815 SAM("-ENOSPC=usb_submit_urb() for %i urbs\n", nospc);
816 SAM("..... possibly inadequate USB bandwidth\n");
817 peasycap->audio_eof = 1;
820 JOM(4, "attempting cleanup instead of submitting\n");
821 list_for_each(plist_head, (peasycap->purb_audio_head)) {
822 pdata_urb = list_entry(plist_head, struct data_urb,
824 if (NULL != pdata_urb) {
825 purb = pdata_urb->purb;
830 peasycap->audio_isoc_streaming = 0;
832 peasycap->audio_isoc_streaming = m;
833 JOM(4, "submitted %i audio urbs\n", m);
836 JOM(4, "already streaming audio urbs\n");
840 /*****************************************************************************/
841 /*---------------------------------------------------------------------------*/
843 * KILL ALL AUDIO URBS.
845 /*---------------------------------------------------------------------------*/
847 kill_audio_urbs(struct easycap *peasycap)
850 struct list_head *plist_head;
851 struct data_urb *pdata_urb;
853 if (NULL == peasycap) {
854 SAY("ERROR: peasycap is NULL\n");
857 if (peasycap->audio_isoc_streaming) {
858 if (NULL != peasycap->purb_audio_head) {
859 peasycap->audio_isoc_streaming = 0;
860 JOM(4, "killing audio urbs\n");
862 list_for_each(plist_head, (peasycap->purb_audio_head)) {
863 pdata_urb = list_entry(plist_head, struct data_urb,
865 if (NULL != pdata_urb) {
866 if (NULL != pdata_urb->purb) {
867 usb_kill_urb(pdata_urb->purb);
872 JOM(4, "%i audio urbs killed\n", m);
874 SAM("ERROR: peasycap->purb_audio_head is NULL\n");
878 JOM(8, "%i=audio_isoc_streaming, no audio urbs killed\n",
879 peasycap->audio_isoc_streaming);
883 /*****************************************************************************/