Lines Matching refs:timeri

62 	struct snd_timer_instance *timeri;  member
107 struct snd_timer_instance *timeri; in snd_timer_instance_new() local
108 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); in snd_timer_instance_new()
109 if (timeri == NULL) in snd_timer_instance_new()
111 timeri->owner = kstrdup(owner, GFP_KERNEL); in snd_timer_instance_new()
112 if (! timeri->owner) { in snd_timer_instance_new()
113 kfree(timeri); in snd_timer_instance_new()
116 INIT_LIST_HEAD(&timeri->open_list); in snd_timer_instance_new()
117 INIT_LIST_HEAD(&timeri->active_list); in snd_timer_instance_new()
118 INIT_LIST_HEAD(&timeri->ack_list); in snd_timer_instance_new()
119 INIT_LIST_HEAD(&timeri->slave_list_head); in snd_timer_instance_new()
120 INIT_LIST_HEAD(&timeri->slave_active_head); in snd_timer_instance_new()
122 timeri->timer = timer; in snd_timer_instance_new()
124 kfree(timeri->owner); in snd_timer_instance_new()
125 kfree(timeri); in snd_timer_instance_new()
129 return timeri; in snd_timer_instance_new()
243 static int snd_timer_close_locked(struct snd_timer_instance *timeri);
254 struct snd_timer_instance *timeri = NULL; in snd_timer_open() local
266 timeri = snd_timer_instance_new(owner, NULL); in snd_timer_open()
267 if (!timeri) { in snd_timer_open()
271 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
272 timeri->slave_id = tid->device; in snd_timer_open()
273 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; in snd_timer_open()
274 list_add_tail(&timeri->open_list, &snd_timer_slave_list); in snd_timer_open()
275 err = snd_timer_check_slave(timeri); in snd_timer_open()
277 snd_timer_close_locked(timeri); in snd_timer_open()
278 timeri = NULL; in snd_timer_open()
281 *ti = timeri; in snd_timer_open()
301 timeri = list_entry(timer->open_list_head.next, in snd_timer_open()
303 if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { in snd_timer_open()
312 timeri = snd_timer_instance_new(owner, timer); in snd_timer_open()
313 if (!timeri) { in snd_timer_open()
320 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
321 timeri->slave_id = slave_id; in snd_timer_open()
326 kfree(timeri->owner); in snd_timer_open()
327 kfree(timeri); in snd_timer_open()
337 list_add_tail(&timeri->open_list, &timer->open_list_head); in snd_timer_open()
339 err = snd_timer_check_master(timeri); in snd_timer_open()
341 snd_timer_close_locked(timeri); in snd_timer_open()
342 timeri = NULL; in snd_timer_open()
345 *ti = timeri; in snd_timer_open()
354 static int snd_timer_close_locked(struct snd_timer_instance *timeri) in snd_timer_close_locked() argument
359 list_del(&timeri->open_list); in snd_timer_close_locked()
362 snd_timer_stop(timeri); in snd_timer_close_locked()
364 timer = timeri->timer; in snd_timer_close_locked()
369 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { in snd_timer_close_locked()
379 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head, in snd_timer_close_locked()
392 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_close_locked()
396 if (timeri->private_free) in snd_timer_close_locked()
397 timeri->private_free(timeri); in snd_timer_close_locked()
398 kfree(timeri->owner); in snd_timer_close_locked()
399 kfree(timeri); in snd_timer_close_locked()
416 int snd_timer_close(struct snd_timer_instance *timeri) in snd_timer_close() argument
420 if (snd_BUG_ON(!timeri)) in snd_timer_close()
424 err = snd_timer_close_locked(timeri); in snd_timer_close()
438 unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) in snd_timer_resolution() argument
444 if (timeri == NULL) in snd_timer_resolution()
446 timer = timeri->timer; in snd_timer_resolution()
488 static int snd_timer_start1(struct snd_timer_instance *timeri, in snd_timer_start1() argument
495 timer = timeri->timer; in snd_timer_start1()
504 if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | in snd_timer_start1()
511 timeri->ticks = timeri->cticks = ticks; in snd_timer_start1()
512 else if (!timeri->cticks) in snd_timer_start1()
513 timeri->cticks = 1; in snd_timer_start1()
514 timeri->pticks = 0; in snd_timer_start1()
516 list_move_tail(&timeri->active_list, &timer->active_list_head); in snd_timer_start1()
521 timeri->flags |= SNDRV_TIMER_IFLG_START; in snd_timer_start1()
529 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start1()
532 snd_timer_notify1(timeri, start ? SNDRV_TIMER_EVENT_START : in snd_timer_start1()
540 static int snd_timer_start_slave(struct snd_timer_instance *timeri, in snd_timer_start_slave() argument
546 if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { in snd_timer_start_slave()
550 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start_slave()
551 if (timeri->master && timeri->timer) { in snd_timer_start_slave()
552 spin_lock(&timeri->timer->lock); in snd_timer_start_slave()
553 list_add_tail(&timeri->active_list, in snd_timer_start_slave()
554 &timeri->master->slave_active_head); in snd_timer_start_slave()
555 snd_timer_notify1(timeri, start ? SNDRV_TIMER_EVENT_START : in snd_timer_start_slave()
557 spin_unlock(&timeri->timer->lock); in snd_timer_start_slave()
564 static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) in snd_timer_stop1() argument
570 timer = timeri->timer; in snd_timer_stop1()
574 if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | in snd_timer_stop1()
579 list_del_init(&timeri->ack_list); in snd_timer_stop1()
580 list_del_init(&timeri->active_list); in snd_timer_stop1()
584 timeri->cticks = timeri->ticks; in snd_timer_stop1()
585 timeri->pticks = 0; in snd_timer_stop1()
587 if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && in snd_timer_stop1()
599 timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); in snd_timer_stop1()
601 timeri->flags &= ~SNDRV_TIMER_IFLG_PAUSED; in snd_timer_stop1()
603 timeri->flags |= SNDRV_TIMER_IFLG_PAUSED; in snd_timer_stop1()
604 snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : in snd_timer_stop1()
612 static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop) in snd_timer_stop_slave() argument
617 if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) { in snd_timer_stop_slave()
621 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; in snd_timer_stop_slave()
622 if (timeri->timer) { in snd_timer_stop_slave()
623 spin_lock(&timeri->timer->lock); in snd_timer_stop_slave()
624 list_del_init(&timeri->ack_list); in snd_timer_stop_slave()
625 list_del_init(&timeri->active_list); in snd_timer_stop_slave()
626 snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : in snd_timer_stop_slave()
628 spin_unlock(&timeri->timer->lock); in snd_timer_stop_slave()
637 int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) in snd_timer_start() argument
639 if (timeri == NULL || ticks < 1) in snd_timer_start()
641 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_start()
642 return snd_timer_start_slave(timeri, true); in snd_timer_start()
644 return snd_timer_start1(timeri, true, ticks); in snd_timer_start()
653 int snd_timer_stop(struct snd_timer_instance *timeri) in snd_timer_stop() argument
655 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_stop()
656 return snd_timer_stop_slave(timeri, true); in snd_timer_stop()
658 return snd_timer_stop1(timeri, true); in snd_timer_stop()
665 int snd_timer_continue(struct snd_timer_instance *timeri) in snd_timer_continue() argument
668 if (!(timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) in snd_timer_continue()
671 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_continue()
672 return snd_timer_start_slave(timeri, false); in snd_timer_continue()
674 return snd_timer_start1(timeri, false, 0); in snd_timer_continue()
681 int snd_timer_pause(struct snd_timer_instance * timeri) in snd_timer_pause() argument
683 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_pause()
684 return snd_timer_stop_slave(timeri, false); in snd_timer_pause()
686 return snd_timer_stop1(timeri, false); in snd_timer_pause()
1260 static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, in snd_timer_user_interrupt() argument
1264 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_interrupt()
1304 static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, in snd_timer_user_ccallback() argument
1309 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_ccallback()
1329 static void snd_timer_user_disconnect(struct snd_timer_instance *timeri) in snd_timer_user_disconnect() argument
1331 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_disconnect()
1337 static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, in snd_timer_user_tinterrupt() argument
1341 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_tinterrupt()
1455 if (tu->timeri) in snd_timer_user_release()
1456 snd_timer_close(tu->timeri); in snd_timer_user_release()
1695 if (tu->timeri) { in snd_timer_user_tselect()
1696 snd_timer_close(tu->timeri); in snd_timer_user_tselect()
1697 tu->timeri = NULL; in snd_timer_user_tselect()
1706 err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid); in snd_timer_user_tselect()
1710 tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST; in snd_timer_user_tselect()
1711 tu->timeri->callback = tu->tread in snd_timer_user_tselect()
1713 tu->timeri->ccallback = snd_timer_user_ccallback; in snd_timer_user_tselect()
1714 tu->timeri->callback_data = (void *)tu; in snd_timer_user_tselect()
1715 tu->timeri->disconnect = snd_timer_user_disconnect; in snd_timer_user_tselect()
1730 if (!tu->timeri) in snd_timer_user_info()
1732 t = tu->timeri->timer; in snd_timer_user_info()
1760 if (!tu->timeri) in snd_timer_user_params()
1762 t = tu->timeri->timer; in snd_timer_user_params()
1776 resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_params()
1805 snd_timer_stop(tu->timeri); in snd_timer_user_params()
1807 tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO| in snd_timer_user_params()
1811 tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO; in snd_timer_user_params()
1813 tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE; in snd_timer_user_params()
1815 tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT; in snd_timer_user_params()
1825 if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { in snd_timer_user_params()
1859 if (!tu->timeri) in snd_timer_user_status()
1863 status.resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_status()
1864 status.lost = tu->timeri->lost; in snd_timer_user_status()
1880 if (!tu->timeri) in snd_timer_user_start()
1882 snd_timer_stop(tu->timeri); in snd_timer_user_start()
1883 tu->timeri->lost = 0; in snd_timer_user_start()
1885 return (err = snd_timer_start(tu->timeri, tu->ticks)) < 0 ? err : 0; in snd_timer_user_start()
1894 if (!tu->timeri) in snd_timer_user_stop()
1896 return (err = snd_timer_stop(tu->timeri)) < 0 ? err : 0; in snd_timer_user_stop()
1905 if (!tu->timeri) in snd_timer_user_continue()
1908 if (!(tu->timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) in snd_timer_user_continue()
1910 tu->timeri->lost = 0; in snd_timer_user_continue()
1911 return (err = snd_timer_continue(tu->timeri)) < 0 ? err : 0; in snd_timer_user_continue()
1920 if (!tu->timeri) in snd_timer_user_pause()
1922 return (err = snd_timer_pause(tu->timeri)) < 0 ? err : 0; in snd_timer_user_pause()
1949 if (tu->timeri) /* too late */ in __snd_timer_user_ioctl()