Lines Matching refs:timeri
70 struct snd_timer_instance *timeri; member
140 struct snd_timer_instance *timeri; in snd_timer_instance_new() local
142 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); in snd_timer_instance_new()
143 if (timeri == NULL) in snd_timer_instance_new()
145 timeri->owner = kstrdup(owner, GFP_KERNEL); in snd_timer_instance_new()
146 if (! timeri->owner) { in snd_timer_instance_new()
147 kfree(timeri); in snd_timer_instance_new()
150 INIT_LIST_HEAD(&timeri->open_list); in snd_timer_instance_new()
151 INIT_LIST_HEAD(&timeri->active_list); in snd_timer_instance_new()
152 INIT_LIST_HEAD(&timeri->ack_list); in snd_timer_instance_new()
153 INIT_LIST_HEAD(&timeri->slave_list_head); in snd_timer_instance_new()
154 INIT_LIST_HEAD(&timeri->slave_active_head); in snd_timer_instance_new()
156 return timeri; in snd_timer_instance_new()
160 void snd_timer_instance_free(struct snd_timer_instance *timeri) in snd_timer_instance_free() argument
162 if (timeri) { in snd_timer_instance_free()
163 if (timeri->private_free) in snd_timer_instance_free()
164 timeri->private_free(timeri); in snd_timer_instance_free()
165 kfree(timeri->owner); in snd_timer_instance_free()
166 kfree(timeri); in snd_timer_instance_free()
282 static void snd_timer_close_locked(struct snd_timer_instance *timeri,
289 int snd_timer_open(struct snd_timer_instance *timeri, in snd_timer_open() argument
311 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
312 timeri->slave_id = tid->device; in snd_timer_open()
313 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; in snd_timer_open()
314 list_add_tail(&timeri->open_list, &snd_timer_slave_list); in snd_timer_open()
316 err = snd_timer_check_slave(timeri); in snd_timer_open()
365 timeri->timer = timer; in snd_timer_open()
366 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
367 timeri->slave_id = slave_id; in snd_timer_open()
369 list_add_tail(&timeri->open_list, &timer->open_list_head); in snd_timer_open()
371 err = snd_timer_check_master(timeri); in snd_timer_open()
374 snd_timer_close_locked(timeri, &card_dev_to_put); in snd_timer_open()
389 static void snd_timer_close_locked(struct snd_timer_instance *timeri, in snd_timer_close_locked() argument
392 struct snd_timer *timer = timeri->timer; in snd_timer_close_locked()
397 timeri->flags |= SNDRV_TIMER_IFLG_DEAD; in snd_timer_close_locked()
401 if (!list_empty(&timeri->open_list)) { in snd_timer_close_locked()
402 list_del_init(&timeri->open_list); in snd_timer_close_locked()
403 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_close_locked()
408 snd_timer_stop(timeri); in snd_timer_close_locked()
414 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { in snd_timer_close_locked()
424 timeri->timer = NULL; in snd_timer_close_locked()
425 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head, in snd_timer_close_locked()
438 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_close_locked()
455 void snd_timer_close(struct snd_timer_instance *timeri) in snd_timer_close() argument
459 if (snd_BUG_ON(!timeri)) in snd_timer_close()
463 snd_timer_close_locked(timeri, &card_dev_to_put); in snd_timer_close()
479 unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) in snd_timer_resolution() argument
485 if (timeri == NULL) in snd_timer_resolution()
487 timer = timeri->timer; in snd_timer_resolution()
530 static int snd_timer_start1(struct snd_timer_instance *timeri, in snd_timer_start1() argument
537 timer = timeri->timer; in snd_timer_start1()
542 if (timeri->flags & SNDRV_TIMER_IFLG_DEAD) { in snd_timer_start1()
550 if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | in snd_timer_start1()
557 timeri->ticks = timeri->cticks = ticks; in snd_timer_start1()
558 else if (!timeri->cticks) in snd_timer_start1()
559 timeri->cticks = 1; in snd_timer_start1()
560 timeri->pticks = 0; in snd_timer_start1()
562 list_move_tail(&timeri->active_list, &timer->active_list_head); in snd_timer_start1()
567 timeri->flags |= SNDRV_TIMER_IFLG_START; in snd_timer_start1()
575 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start1()
578 snd_timer_notify1(timeri, start ? SNDRV_TIMER_EVENT_START : in snd_timer_start1()
586 static int snd_timer_start_slave(struct snd_timer_instance *timeri, in snd_timer_start_slave() argument
593 if (timeri->flags & SNDRV_TIMER_IFLG_DEAD) { in snd_timer_start_slave()
597 if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { in snd_timer_start_slave()
601 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start_slave()
602 if (timeri->master && timeri->timer) { in snd_timer_start_slave()
603 spin_lock(&timeri->timer->lock); in snd_timer_start_slave()
604 list_add_tail(&timeri->active_list, in snd_timer_start_slave()
605 &timeri->master->slave_active_head); in snd_timer_start_slave()
606 snd_timer_notify1(timeri, start ? SNDRV_TIMER_EVENT_START : in snd_timer_start_slave()
608 spin_unlock(&timeri->timer->lock); in snd_timer_start_slave()
617 static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) in snd_timer_stop1() argument
623 timer = timeri->timer; in snd_timer_stop1()
627 list_del_init(&timeri->ack_list); in snd_timer_stop1()
628 list_del_init(&timeri->active_list); in snd_timer_stop1()
629 if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | in snd_timer_stop1()
637 timeri->cticks = timeri->ticks; in snd_timer_stop1()
638 timeri->pticks = 0; in snd_timer_stop1()
640 if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && in snd_timer_stop1()
652 timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); in snd_timer_stop1()
654 timeri->flags &= ~SNDRV_TIMER_IFLG_PAUSED; in snd_timer_stop1()
656 timeri->flags |= SNDRV_TIMER_IFLG_PAUSED; in snd_timer_stop1()
657 snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : in snd_timer_stop1()
665 static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop) in snd_timer_stop_slave() argument
671 running = timeri->flags & SNDRV_TIMER_IFLG_RUNNING; in snd_timer_stop_slave()
672 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; in snd_timer_stop_slave()
673 if (timeri->timer) { in snd_timer_stop_slave()
674 spin_lock(&timeri->timer->lock); in snd_timer_stop_slave()
675 list_del_init(&timeri->ack_list); in snd_timer_stop_slave()
676 list_del_init(&timeri->active_list); in snd_timer_stop_slave()
678 snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : in snd_timer_stop_slave()
680 spin_unlock(&timeri->timer->lock); in snd_timer_stop_slave()
689 int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) in snd_timer_start() argument
691 if (timeri == NULL || ticks < 1) in snd_timer_start()
693 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_start()
694 return snd_timer_start_slave(timeri, true); in snd_timer_start()
696 return snd_timer_start1(timeri, true, ticks); in snd_timer_start()
705 int snd_timer_stop(struct snd_timer_instance *timeri) in snd_timer_stop() argument
707 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_stop()
708 return snd_timer_stop_slave(timeri, true); in snd_timer_stop()
710 return snd_timer_stop1(timeri, true); in snd_timer_stop()
717 int snd_timer_continue(struct snd_timer_instance *timeri) in snd_timer_continue() argument
720 if (!(timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) in snd_timer_continue()
723 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_continue()
724 return snd_timer_start_slave(timeri, false); in snd_timer_continue()
726 return snd_timer_start1(timeri, false, 0); in snd_timer_continue()
733 int snd_timer_pause(struct snd_timer_instance * timeri) in snd_timer_pause() argument
735 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_pause()
736 return snd_timer_stop_slave(timeri, false); in snd_timer_pause()
738 return snd_timer_stop1(timeri, false); in snd_timer_pause()
1320 static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, in snd_timer_user_interrupt() argument
1324 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_interrupt()
1364 static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, in snd_timer_user_ccallback() argument
1369 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_ccallback()
1390 static void snd_timer_user_disconnect(struct snd_timer_instance *timeri) in snd_timer_user_disconnect() argument
1392 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_disconnect()
1398 static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, in snd_timer_user_tinterrupt() argument
1402 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_tinterrupt()
1519 if (tu->timeri) { in snd_timer_user_release()
1520 snd_timer_close(tu->timeri); in snd_timer_user_release()
1521 snd_timer_instance_free(tu->timeri); in snd_timer_user_release()
1762 if (tu->timeri) { in snd_timer_user_tselect()
1763 snd_timer_close(tu->timeri); in snd_timer_user_tselect()
1764 snd_timer_instance_free(tu->timeri); in snd_timer_user_tselect()
1765 tu->timeri = NULL; in snd_timer_user_tselect()
1774 tu->timeri = snd_timer_instance_new(str); in snd_timer_user_tselect()
1775 if (!tu->timeri) { in snd_timer_user_tselect()
1780 tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST; in snd_timer_user_tselect()
1781 tu->timeri->callback = tu->tread in snd_timer_user_tselect()
1783 tu->timeri->ccallback = snd_timer_user_ccallback; in snd_timer_user_tselect()
1784 tu->timeri->callback_data = (void *)tu; in snd_timer_user_tselect()
1785 tu->timeri->disconnect = snd_timer_user_disconnect; in snd_timer_user_tselect()
1787 err = snd_timer_open(tu->timeri, &tselect.id, current->pid); in snd_timer_user_tselect()
1789 snd_timer_instance_free(tu->timeri); in snd_timer_user_tselect()
1790 tu->timeri = NULL; in snd_timer_user_tselect()
1806 if (!tu->timeri) in snd_timer_user_info()
1808 t = tu->timeri->timer; in snd_timer_user_info()
1836 if (!tu->timeri) in snd_timer_user_params()
1838 t = tu->timeri->timer; in snd_timer_user_params()
1852 resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_params()
1881 snd_timer_stop(tu->timeri); in snd_timer_user_params()
1883 tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO| in snd_timer_user_params()
1887 tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO; in snd_timer_user_params()
1889 tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE; in snd_timer_user_params()
1891 tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT; in snd_timer_user_params()
1901 if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { in snd_timer_user_params()
1935 if (!tu->timeri) in snd_timer_user_status32()
1940 status.resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_status32()
1941 status.lost = tu->timeri->lost; in snd_timer_user_status32()
1958 if (!tu->timeri) in snd_timer_user_status64()
1963 status.resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_status64()
1964 status.lost = tu->timeri->lost; in snd_timer_user_status64()
1980 if (!tu->timeri) in snd_timer_user_start()
1982 snd_timer_stop(tu->timeri); in snd_timer_user_start()
1983 tu->timeri->lost = 0; in snd_timer_user_start()
1985 err = snd_timer_start(tu->timeri, tu->ticks); in snd_timer_user_start()
1997 if (!tu->timeri) in snd_timer_user_stop()
1999 err = snd_timer_stop(tu->timeri); in snd_timer_user_stop()
2011 if (!tu->timeri) in snd_timer_user_continue()
2014 if (!(tu->timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) in snd_timer_user_continue()
2016 tu->timeri->lost = 0; in snd_timer_user_continue()
2017 err = snd_timer_continue(tu->timeri); in snd_timer_user_continue()
2029 if (!tu->timeri) in snd_timer_user_pause()
2031 err = snd_timer_pause(tu->timeri); in snd_timer_user_pause()
2043 if (tu->timeri) /* too late */ in snd_timer_user_tread()