Lines Matching refs:rt
112 static int hiface_pcm_set_rate(struct pcm_runtime *rt, unsigned int rate) in hiface_pcm_set_rate() argument
114 struct usb_device *device = rt->chip->dev; in hiface_pcm_set_rate()
172 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_get_substream() local
173 struct device *device = &rt->chip->dev->dev; in hiface_pcm_get_substream()
176 return &rt->playback; in hiface_pcm_get_substream()
183 static void hiface_pcm_stream_stop(struct pcm_runtime *rt) in hiface_pcm_stream_stop() argument
187 if (rt->stream_state != STREAM_DISABLED) { in hiface_pcm_stream_stop()
188 rt->stream_state = STREAM_STOPPING; in hiface_pcm_stream_stop()
192 &rt->out_urbs[i].submitted, 100); in hiface_pcm_stream_stop()
195 &rt->out_urbs[i].submitted); in hiface_pcm_stream_stop()
196 usb_kill_urb(&rt->out_urbs[i].instance); in hiface_pcm_stream_stop()
199 rt->stream_state = STREAM_DISABLED; in hiface_pcm_stream_stop()
204 static int hiface_pcm_stream_start(struct pcm_runtime *rt) in hiface_pcm_stream_start() argument
209 if (rt->stream_state == STREAM_DISABLED) { in hiface_pcm_stream_start()
212 rt->panic = false; in hiface_pcm_stream_start()
215 rt->stream_state = STREAM_STARTING; in hiface_pcm_stream_start()
217 memset(rt->out_urbs[i].buffer, 0, PCM_PACKET_SIZE); in hiface_pcm_stream_start()
218 usb_anchor_urb(&rt->out_urbs[i].instance, in hiface_pcm_stream_start()
219 &rt->out_urbs[i].submitted); in hiface_pcm_stream_start()
220 ret = usb_submit_urb(&rt->out_urbs[i].instance, in hiface_pcm_stream_start()
223 hiface_pcm_stream_stop(rt); in hiface_pcm_stream_start()
229 wait_event_timeout(rt->stream_wait_queue, rt->stream_wait_cond, in hiface_pcm_stream_start()
231 if (rt->stream_wait_cond) { in hiface_pcm_stream_start()
232 struct device *device = &rt->chip->dev->dev; in hiface_pcm_stream_start()
235 rt->stream_state = STREAM_RUNNING; in hiface_pcm_stream_start()
237 hiface_pcm_stream_stop(rt); in hiface_pcm_stream_start()
305 struct pcm_runtime *rt = out_urb->chip->pcm; in hiface_pcm_out_urb_handler() local
311 if (rt->panic || rt->stream_state == STREAM_STOPPING) in hiface_pcm_out_urb_handler()
321 if (rt->stream_state == STREAM_STARTING) { in hiface_pcm_out_urb_handler()
322 rt->stream_wait_cond = true; in hiface_pcm_out_urb_handler()
323 wake_up(&rt->stream_wait_queue); in hiface_pcm_out_urb_handler()
327 sub = &rt->playback; in hiface_pcm_out_urb_handler()
346 rt->panic = true; in hiface_pcm_out_urb_handler()
351 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_open() local
356 if (rt->panic) in hiface_pcm_open()
359 mutex_lock(&rt->stream_mutex); in hiface_pcm_open()
363 sub = &rt->playback; in hiface_pcm_open()
366 struct device *device = &rt->chip->dev->dev; in hiface_pcm_open()
367 mutex_unlock(&rt->stream_mutex); in hiface_pcm_open()
372 if (rt->extra_freq) { in hiface_pcm_open()
381 mutex_unlock(&rt->stream_mutex); in hiface_pcm_open()
388 mutex_unlock(&rt->stream_mutex); in hiface_pcm_open()
394 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_close() local
398 if (rt->panic) in hiface_pcm_close()
401 mutex_lock(&rt->stream_mutex); in hiface_pcm_close()
403 hiface_pcm_stream_stop(rt); in hiface_pcm_close()
412 mutex_unlock(&rt->stream_mutex); in hiface_pcm_close()
418 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_prepare() local
423 if (rt->panic) in hiface_pcm_prepare()
428 mutex_lock(&rt->stream_mutex); in hiface_pcm_prepare()
430 hiface_pcm_stream_stop(rt); in hiface_pcm_prepare()
435 if (rt->stream_state == STREAM_DISABLED) { in hiface_pcm_prepare()
437 ret = hiface_pcm_set_rate(rt, alsa_rt->rate); in hiface_pcm_prepare()
439 mutex_unlock(&rt->stream_mutex); in hiface_pcm_prepare()
442 ret = hiface_pcm_stream_start(rt); in hiface_pcm_prepare()
444 mutex_unlock(&rt->stream_mutex); in hiface_pcm_prepare()
448 mutex_unlock(&rt->stream_mutex); in hiface_pcm_prepare()
455 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_trigger() local
457 if (rt->panic) in hiface_pcm_trigger()
485 struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); in hiface_pcm_pointer() local
489 if (rt->panic || !sub) in hiface_pcm_pointer()
530 struct pcm_runtime *rt = chip->pcm; in hiface_pcm_abort() local
532 if (rt) { in hiface_pcm_abort()
533 rt->panic = true; in hiface_pcm_abort()
535 mutex_lock(&rt->stream_mutex); in hiface_pcm_abort()
536 hiface_pcm_stream_stop(rt); in hiface_pcm_abort()
537 mutex_unlock(&rt->stream_mutex); in hiface_pcm_abort()
543 struct pcm_runtime *rt = chip->pcm; in hiface_pcm_destroy() local
547 kfree(rt->out_urbs[i].buffer); in hiface_pcm_destroy()
555 struct pcm_runtime *rt = pcm->private_data; in hiface_pcm_free() local
557 if (rt) in hiface_pcm_free()
558 hiface_pcm_destroy(rt->chip); in hiface_pcm_free()
566 struct pcm_runtime *rt; in hiface_pcm_init() local
568 rt = kzalloc(sizeof(*rt), GFP_KERNEL); in hiface_pcm_init()
569 if (!rt) in hiface_pcm_init()
572 rt->chip = chip; in hiface_pcm_init()
573 rt->stream_state = STREAM_DISABLED; in hiface_pcm_init()
575 rt->extra_freq = 1; in hiface_pcm_init()
577 init_waitqueue_head(&rt->stream_wait_queue); in hiface_pcm_init()
578 mutex_init(&rt->stream_mutex); in hiface_pcm_init()
579 spin_lock_init(&rt->playback.lock); in hiface_pcm_init()
582 ret = hiface_pcm_init_urb(&rt->out_urbs[i], chip, OUT_EP, in hiface_pcm_init()
594 pcm->private_data = rt; in hiface_pcm_init()
602 rt->instance = pcm; in hiface_pcm_init()
604 chip->pcm = rt; in hiface_pcm_init()
609 kfree(rt->out_urbs[i].buffer); in hiface_pcm_init()
610 kfree(rt); in hiface_pcm_init()