Lines Matching refs:usx2y
28 #include "usx2y.h"
63 struct usx2ydev *usx2y = subs->usx2y;
73 len = urb->iso_frame_desc[i].actual_length / usx2y->stride;
82 int blen = cnt * usx2y->stride;
83 memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp, blen);
84 memcpy(runtime->dma_area, cp + blen, len * usx2y->stride - blen);
86 memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp,
87 len * usx2y->stride);
118 struct usx2ydev *usx2y = subs->usx2y;
124 counts = cap_urb->iso_frame_desc[pack].actual_length / usx2y->stride;
146 subs->hwptr * usx2y->stride, len * usx2y->stride);
147 memcpy(subs->tmpbuf + len * usx2y->stride,
148 runtime->dma_area, (count - len) * usx2y->stride);
153 urb->transfer_buffer = runtime->dma_area + subs->hwptr * usx2y->stride;
159 urb->transfer_buffer_length = count * usx2y->stride;
171 int len = urb->actual_length / subs->usx2y->stride;
190 urb->dev = subs->usx2y->dev; /* we need to set this at each time */
247 static void usx2y_clients_stop(struct usx2ydev *usx2y)
252 struct snd_usx2y_substream *subs = usx2y->subs[s];
259 struct snd_usx2y_substream *subs = usx2y->subs[s];
271 usx2y->prepare_subs = NULL;
272 wake_up(&usx2y->prepare_wait_queue);
275 static void usx2y_error_urb_status(struct usx2ydev *usx2y,
280 usx2y_clients_stop(usx2y);
286 struct usx2ydev *usx2y = subs->usx2y;
290 usb_get_current_frame_number(usx2y->dev),
296 usx2y_error_urb_status(usx2y, subs, urb);
303 struct snd_usx2y_substream *capsubs = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE],
304 *playbacksubs = usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK];
310 usx2y->wait_iso_frame += nr_of_packs();
313 usx2y_clients_stop(usx2y);
319 static void usx2y_urbs_set_complete(struct usx2ydev * usx2y,
324 struct snd_usx2y_substream *subs = usx2y->subs[s];
334 static void usx2y_subs_startup_finish(struct usx2ydev * usx2y)
336 usx2y_urbs_set_complete(usx2y, i_usx2y_urb_complete);
337 usx2y->prepare_subs = NULL;
343 struct usx2ydev *usx2y = subs->usx2y;
344 struct snd_usx2y_substream *prepare_subs = usx2y->prepare_subs;
347 usx2y_subs_startup_finish(usx2y);
349 wake_up(&usx2y->prepare_wait_queue);
385 subs != subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]);
397 int is_playback = subs == subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK];
398 struct usb_device *dev = subs->usx2y->dev;
445 struct usx2ydev *usx2y = subs->usx2y;
446 usx2y->prepare_subs = subs;
449 usx2y_urbs_set_complete(usx2y, i_usx2y_subs_startup);
455 struct usx2ydev *usx2y = subs->usx2y;
461 struct snd_usx2y_substream *subs = usx2y->subs[i];
474 urb->dev = usx2y->dev;
486 usx2y->wait_iso_frame = urb->start_frame;
494 wait_event(usx2y->prepare_wait_queue, NULL == usx2y->prepare_subs);
500 usx2y_subs_startup_finish(usx2y);
501 usx2y_clients_stop(usx2y); // something is completely wroong > stop evrything
525 atomic_read(&subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= STATE_PREPARED) {
632 struct usx2ydev *usx2y = urb->context;
636 if (0 == --usx2y->us04->len)
637 wake_up(&usx2y->in04_wait_queue);
640 static int usx2y_rate_set(struct usx2ydev *usx2y, int rate)
647 if (usx2y->rate != rate) {
666 usb_fill_bulk_urb(us->urb[i], usx2y->dev, usb_sndbulkpipe(usx2y->dev, 4),
667 usbdata + i, 2, i_usx2y_04int, usx2y);
674 usx2y->us04 = us;
675 wait_event_timeout(usx2y->in04_wait_queue, 0 == us->len, HZ);
676 usx2y->us04 = NULL;
693 usx2y->us04 = NULL;
697 usx2y->rate = rate;
705 static int usx2y_format_set(struct usx2ydev *usx2y, snd_pcm_format_t format)
711 usx2y->stride = 6;
714 usx2y->stride = 4;
716 list_for_each(p, &usx2y->midi_list) {
719 usb_kill_urb(usx2y->in04_urb);
720 if ((err = usb_set_interface(usx2y->dev, 0, alternate))) {
724 usx2y->in04_urb->dev = usx2y->dev;
725 err = usb_submit_urb(usx2y->in04_urb, GFP_KERNEL);
726 list_for_each(p, &usx2y->midi_list) {
729 usx2y->format = format;
730 usx2y->rate = 0;
742 struct usx2ydev *dev = usx2y(card);
745 mutex_lock(&usx2y(card)->pcm_mutex);
747 /* all pcm substreams off one usx2y have to operate at the same
770 mutex_unlock(&usx2y(card)->pcm_mutex);
781 mutex_lock(&subs->usx2y->pcm_mutex);
785 struct snd_usx2y_substream *cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
796 struct snd_usx2y_substream *playback_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK];
802 mutex_unlock(&subs->usx2y->pcm_mutex);
814 struct usx2ydev *usx2y = subs->usx2y;
815 struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE];
819 mutex_lock(&usx2y->pcm_mutex);
824 if (usx2y->format != runtime->format)
825 if ((err = usx2y_format_set(usx2y, runtime->format)) < 0)
827 if (usx2y->rate != runtime->rate)
828 if ((err = usx2y_rate_set(usx2y, runtime->rate)) < 0)
839 mutex_unlock(&usx2y->pcm_mutex);
871 if (subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS)
931 usx2y(card)->subs + 2 * usx2y(card)->pcm_devs;
939 usx2y_substream[i]->usx2y = usx2y(card);
946 err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usx2y(card)->pcm_devs,
962 sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usx2y(card)->pcm_devs);
975 usx2y(card)->pcm_devs++;
987 INIT_LIST_HEAD(&usx2y(card)->pcm_list);
991 if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) == USB_ID_US428)
994 if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) != USB_ID_US122)
995 err = usx2y_rate_set(usx2y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122.