• Home
  • Raw
  • Download

Lines Matching refs:subs

57 static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs)  in usx2y_urb_capt_retire()  argument
59 struct urb *urb = subs->completed_urb; in usx2y_urb_capt_retire()
60 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; in usx2y_urb_capt_retire()
62 int i, len, lens = 0, hwptr_done = subs->hwptr_done; in usx2y_urb_capt_retire()
63 struct usx2ydev *usx2y = subs->usx2y; in usx2y_urb_capt_retire()
94 subs->hwptr_done = hwptr_done; in usx2y_urb_capt_retire()
95 subs->transfer_done += lens; in usx2y_urb_capt_retire()
97 if (subs->transfer_done >= runtime->period_size) { in usx2y_urb_capt_retire()
98 subs->transfer_done -= runtime->period_size; in usx2y_urb_capt_retire()
99 snd_pcm_period_elapsed(subs->pcm_substream); in usx2y_urb_capt_retire()
113 static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs, in usx2y_urb_play_prepare() argument
118 struct usx2ydev *usx2y = subs->usx2y; in usx2y_urb_play_prepare()
119 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; in usx2y_urb_play_prepare()
137 if (atomic_read(&subs->state) >= STATE_PRERUNNING) in usx2y_urb_play_prepare()
138 if (subs->hwptr + count > runtime->buffer_size) { in usx2y_urb_play_prepare()
143 len = runtime->buffer_size - subs->hwptr; in usx2y_urb_play_prepare()
144 urb->transfer_buffer = subs->tmpbuf; in usx2y_urb_play_prepare()
145 memcpy(subs->tmpbuf, runtime->dma_area + in usx2y_urb_play_prepare()
146 subs->hwptr * usx2y->stride, len * usx2y->stride); in usx2y_urb_play_prepare()
147 memcpy(subs->tmpbuf + len * usx2y->stride, in usx2y_urb_play_prepare()
149 subs->hwptr += count; in usx2y_urb_play_prepare()
150 subs->hwptr -= runtime->buffer_size; in usx2y_urb_play_prepare()
153 urb->transfer_buffer = runtime->dma_area + subs->hwptr * usx2y->stride; in usx2y_urb_play_prepare()
154 if ((subs->hwptr += count) >= runtime->buffer_size) in usx2y_urb_play_prepare()
155 subs->hwptr -= runtime->buffer_size; in usx2y_urb_play_prepare()
158 urb->transfer_buffer = subs->tmpbuf; in usx2y_urb_play_prepare()
168 static void usx2y_urb_play_retire(struct snd_usx2y_substream *subs, struct urb *urb) in usx2y_urb_play_retire() argument
170 struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; in usx2y_urb_play_retire()
171 int len = urb->actual_length / subs->usx2y->stride; in usx2y_urb_play_retire()
173 subs->transfer_done += len; in usx2y_urb_play_retire()
174 subs->hwptr_done += len; in usx2y_urb_play_retire()
175 if (subs->hwptr_done >= runtime->buffer_size) in usx2y_urb_play_retire()
176 subs->hwptr_done -= runtime->buffer_size; in usx2y_urb_play_retire()
177 if (subs->transfer_done >= runtime->period_size) { in usx2y_urb_play_retire()
178 subs->transfer_done -= runtime->period_size; in usx2y_urb_play_retire()
179 snd_pcm_period_elapsed(subs->pcm_substream); in usx2y_urb_play_retire()
183 static int usx2y_urb_submit(struct snd_usx2y_substream *subs, struct urb *urb, int frame) in usx2y_urb_submit() argument
190 urb->dev = subs->usx2y->dev; /* we need to set this at each time */ in usx2y_urb_submit()
252 struct snd_usx2y_substream *subs = usx2y->subs[s]; in usx2y_clients_stop() local
253 if (subs) { in usx2y_clients_stop()
254 snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state)); in usx2y_clients_stop()
255 atomic_set(&subs->state, STATE_STOPPED); in usx2y_clients_stop()
259 struct snd_usx2y_substream *subs = usx2y->subs[s]; in usx2y_clients_stop() local
260 if (subs) { in usx2y_clients_stop()
261 if (atomic_read(&subs->state) >= STATE_PRERUNNING) in usx2y_clients_stop()
262 snd_pcm_stop_xrun(subs->pcm_substream); in usx2y_clients_stop()
264 struct urb *urb = subs->urb[u]; in usx2y_clients_stop()
276 struct snd_usx2y_substream *subs, struct urb *urb) in usx2y_error_urb_status() argument
278 snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); in usx2y_error_urb_status()
285 struct snd_usx2y_substream *subs = urb->context; in i_usx2y_urb_complete() local
286 struct usx2ydev *usx2y = subs->usx2y; in i_usx2y_urb_complete()
288 if (unlikely(atomic_read(&subs->state) < STATE_PREPARED)) { in i_usx2y_urb_complete()
291 subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", in i_usx2y_urb_complete()
296 usx2y_error_urb_status(usx2y, subs, urb); in i_usx2y_urb_complete()
300 subs->completed_urb = urb; in i_usx2y_urb_complete()
303 struct snd_usx2y_substream *capsubs = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE], in i_usx2y_urb_complete()
304 *playbacksubs = usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; in i_usx2y_urb_complete()
324 struct snd_usx2y_substream *subs = usx2y->subs[s]; in usx2y_urbs_set_complete() local
325 if (NULL != subs) in usx2y_urbs_set_complete()
327 struct urb * urb = subs->urb[u]; in usx2y_urbs_set_complete()
342 struct snd_usx2y_substream *subs = urb->context; in i_usx2y_subs_startup() local
343 struct usx2ydev *usx2y = subs->usx2y; in i_usx2y_subs_startup()
355 static void usx2y_subs_prepare(struct snd_usx2y_substream *subs) in usx2y_subs_prepare() argument
358 subs, subs->endpoint, subs->urb[0], subs->urb[1]); in usx2y_subs_prepare()
360 subs->hwptr = 0; in usx2y_subs_prepare()
361 subs->hwptr_done = 0; in usx2y_subs_prepare()
362 subs->transfer_done = 0; in usx2y_subs_prepare()
379 static void usx2y_urbs_release(struct snd_usx2y_substream *subs) in usx2y_urbs_release() argument
382 snd_printdd("usx2y_urbs_release() %i\n", subs->endpoint); in usx2y_urbs_release()
384 usx2y_urb_release(subs->urb + i, in usx2y_urbs_release()
385 subs != subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]); in usx2y_urbs_release()
387 kfree(subs->tmpbuf); in usx2y_urbs_release()
388 subs->tmpbuf = NULL; in usx2y_urbs_release()
393 static int usx2y_urbs_allocate(struct snd_usx2y_substream *subs) in usx2y_urbs_allocate() argument
397 int is_playback = subs == subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; in usx2y_urbs_allocate()
398 struct usb_device *dev = subs->usx2y->dev; in usx2y_urbs_allocate()
400 pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : in usx2y_urbs_allocate()
401 usb_rcvisocpipe(dev, subs->endpoint); in usx2y_urbs_allocate()
402 subs->maxpacksize = usb_maxpacket(dev, pipe, is_playback); in usx2y_urbs_allocate()
403 if (!subs->maxpacksize) in usx2y_urbs_allocate()
406 if (is_playback && NULL == subs->tmpbuf) { /* allocate a temporary buffer for playback */ in usx2y_urbs_allocate()
407 subs->tmpbuf = kcalloc(nr_of_packs(), subs->maxpacksize, GFP_KERNEL); in usx2y_urbs_allocate()
408 if (!subs->tmpbuf) in usx2y_urbs_allocate()
413 struct urb **purb = subs->urb + i; in usx2y_urbs_allocate()
420 usx2y_urbs_release(subs); in usx2y_urbs_allocate()
426 kmalloc_array(subs->maxpacksize, in usx2y_urbs_allocate()
429 usx2y_urbs_release(subs); in usx2y_urbs_allocate()
436 (*purb)->context = subs; in usx2y_urbs_allocate()
443 static void usx2y_subs_startup(struct snd_usx2y_substream *subs) in usx2y_subs_startup() argument
445 struct usx2ydev *usx2y = subs->usx2y; in usx2y_subs_startup()
446 usx2y->prepare_subs = subs; in usx2y_subs_startup()
447 subs->urb[0]->start_frame = -1; in usx2y_subs_startup()
452 static int usx2y_urbs_start(struct snd_usx2y_substream *subs) in usx2y_urbs_start() argument
455 struct usx2ydev *usx2y = subs->usx2y; in usx2y_urbs_start()
457 if ((err = usx2y_urbs_allocate(subs)) < 0) in usx2y_urbs_start()
459 subs->completed_urb = NULL; in usx2y_urbs_start()
461 struct snd_usx2y_substream *subs = usx2y->subs[i]; in usx2y_urbs_start() local
462 if (subs != NULL && atomic_read(&subs->state) >= STATE_PREPARED) in usx2y_urbs_start()
467 usx2y_subs_startup(subs); in usx2y_urbs_start()
469 struct urb *urb = subs->urb[i]; in usx2y_urbs_start()
473 atomic_set(&subs->state, STATE_STARTING3); in usx2y_urbs_start()
476 urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; in usx2y_urbs_start()
477 urb->iso_frame_desc[pack].length = subs->maxpacksize; in usx2y_urbs_start()
479 urb->transfer_buffer_length = subs->maxpacksize * nr_of_packs(); in usx2y_urbs_start()
489 atomic_set(&subs->state, STATE_STARTING1); in usx2y_urbs_start()
495 if (atomic_read(&subs->state) != STATE_PREPARED) in usx2y_urbs_start()
511 struct snd_usx2y_substream *subs = substream->runtime->private_data; in snd_usx2y_pcm_pointer() local
512 return subs->hwptr_done; in snd_usx2y_pcm_pointer()
519 struct snd_usx2y_substream *subs = substream->runtime->private_data; in snd_usx2y_pcm_trigger() local
524 if (atomic_read(&subs->state) == STATE_PREPARED && in snd_usx2y_pcm_trigger()
525 atomic_read(&subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= STATE_PREPARED) { in snd_usx2y_pcm_trigger()
526 atomic_set(&subs->state, STATE_PRERUNNING); in snd_usx2y_pcm_trigger()
534 if (atomic_read(&subs->state) >= STATE_PRERUNNING) in snd_usx2y_pcm_trigger()
535 atomic_set(&subs->state, STATE_PREPARED); in snd_usx2y_pcm_trigger()
751 struct snd_usx2y_substream *subs = dev->subs[i]; in snd_usx2y_pcm_hw_params() local
754 if (!subs) in snd_usx2y_pcm_hw_params()
756 test_substream = subs->pcm_substream; in snd_usx2y_pcm_hw_params()
780 struct snd_usx2y_substream *subs = runtime->private_data; in snd_usx2y_pcm_hw_free() local
781 mutex_lock(&subs->usx2y->pcm_mutex); in snd_usx2y_pcm_hw_free()
785 struct snd_usx2y_substream *cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; in snd_usx2y_pcm_hw_free()
786 atomic_set(&subs->state, STATE_STOPPED); in snd_usx2y_pcm_hw_free()
787 usx2y_urbs_release(subs); in snd_usx2y_pcm_hw_free()
796 struct snd_usx2y_substream *playback_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; in snd_usx2y_pcm_hw_free()
798 atomic_set(&subs->state, STATE_STOPPED); in snd_usx2y_pcm_hw_free()
799 usx2y_urbs_release(subs); in snd_usx2y_pcm_hw_free()
802 mutex_unlock(&subs->usx2y->pcm_mutex); in snd_usx2y_pcm_hw_free()
813 struct snd_usx2y_substream *subs = runtime->private_data; in snd_usx2y_pcm_prepare() local
814 struct usx2ydev *usx2y = subs->usx2y; in snd_usx2y_pcm_prepare()
815 struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; in snd_usx2y_pcm_prepare()
820 usx2y_subs_prepare(subs); in snd_usx2y_pcm_prepare()
830 snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe"); in snd_usx2y_pcm_prepare()
835 if (subs != capsubs && atomic_read(&subs->state) < STATE_PREPARED) in snd_usx2y_pcm_prepare()
836 err = usx2y_urbs_start(subs); in snd_usx2y_pcm_prepare()
867 struct snd_usx2y_substream *subs = ((struct snd_usx2y_substream **) in snd_usx2y_pcm_open() local
871 if (subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) in snd_usx2y_pcm_open()
875 runtime->private_data = subs; in snd_usx2y_pcm_open()
876 subs->pcm_substream = substream; in snd_usx2y_pcm_open()
886 struct snd_usx2y_substream *subs = runtime->private_data; in snd_usx2y_pcm_close() local
888 subs->pcm_substream = NULL; in snd_usx2y_pcm_close()
931 usx2y(card)->subs + 2 * usx2y(card)->pcm_devs; in usx2y_audio_stream_new()