Lines Matching refs:timeri

59 	struct snd_timer_instance *timeri;  member
103 struct snd_timer_instance *timeri; in snd_timer_instance_new() local
104 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); in snd_timer_instance_new()
105 if (timeri == NULL) in snd_timer_instance_new()
107 timeri->owner = kstrdup(owner, GFP_KERNEL); in snd_timer_instance_new()
108 if (! timeri->owner) { in snd_timer_instance_new()
109 kfree(timeri); in snd_timer_instance_new()
112 INIT_LIST_HEAD(&timeri->open_list); in snd_timer_instance_new()
113 INIT_LIST_HEAD(&timeri->active_list); in snd_timer_instance_new()
114 INIT_LIST_HEAD(&timeri->ack_list); in snd_timer_instance_new()
115 INIT_LIST_HEAD(&timeri->slave_list_head); in snd_timer_instance_new()
116 INIT_LIST_HEAD(&timeri->slave_active_head); in snd_timer_instance_new()
118 timeri->timer = timer; in snd_timer_instance_new()
120 kfree(timeri->owner); in snd_timer_instance_new()
121 kfree(timeri); in snd_timer_instance_new()
125 return timeri; in snd_timer_instance_new()
236 struct snd_timer_instance *timeri = NULL; in snd_timer_open() local
246 timeri = snd_timer_instance_new(owner, NULL); in snd_timer_open()
247 if (!timeri) { in snd_timer_open()
251 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
252 timeri->slave_id = tid->device; in snd_timer_open()
253 timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; in snd_timer_open()
254 list_add_tail(&timeri->open_list, &snd_timer_slave_list); in snd_timer_open()
255 snd_timer_check_slave(timeri); in snd_timer_open()
257 *ti = timeri; in snd_timer_open()
277 timeri = list_entry(timer->open_list_head.next, in snd_timer_open()
279 if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { in snd_timer_open()
284 timeri = snd_timer_instance_new(owner, timer); in snd_timer_open()
285 if (!timeri) { in snd_timer_open()
289 timeri->slave_class = tid->dev_sclass; in snd_timer_open()
290 timeri->slave_id = slave_id; in snd_timer_open()
293 list_add_tail(&timeri->open_list, &timer->open_list_head); in snd_timer_open()
294 snd_timer_check_master(timeri); in snd_timer_open()
296 *ti = timeri; in snd_timer_open()
300 static int _snd_timer_stop(struct snd_timer_instance *timeri,
306 int snd_timer_close(struct snd_timer_instance *timeri) in snd_timer_close() argument
311 if (snd_BUG_ON(!timeri)) in snd_timer_close()
315 snd_timer_stop(timeri); in snd_timer_close()
317 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { in snd_timer_close()
320 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { in snd_timer_close()
327 list_del(&timeri->open_list); in snd_timer_close()
330 timer = timeri->timer; in snd_timer_close()
333 while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { in snd_timer_close()
340 list_del(&timeri->open_list); in snd_timer_close()
345 list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head, in snd_timer_close()
356 if (timeri->private_free) in snd_timer_close()
357 timeri->private_free(timeri); in snd_timer_close()
358 kfree(timeri->owner); in snd_timer_close()
359 kfree(timeri); in snd_timer_close()
365 unsigned long snd_timer_resolution(struct snd_timer_instance *timeri) in snd_timer_resolution() argument
369 if (timeri == NULL) in snd_timer_resolution()
371 if ((timer = timeri->timer) != NULL) { in snd_timer_resolution()
413 static int snd_timer_start1(struct snd_timer *timer, struct snd_timer_instance *timeri, in snd_timer_start1() argument
416 list_move_tail(&timeri->active_list, &timer->active_list_head); in snd_timer_start1()
421 timeri->flags |= SNDRV_TIMER_IFLG_START; in snd_timer_start1()
428 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start1()
433 static int snd_timer_start_slave(struct snd_timer_instance *timeri) in snd_timer_start_slave() argument
438 timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; in snd_timer_start_slave()
439 if (timeri->master) in snd_timer_start_slave()
440 list_add_tail(&timeri->active_list, in snd_timer_start_slave()
441 &timeri->master->slave_active_head); in snd_timer_start_slave()
449 int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) in snd_timer_start() argument
455 if (timeri == NULL || ticks < 1) in snd_timer_start()
457 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { in snd_timer_start()
458 result = snd_timer_start_slave(timeri); in snd_timer_start()
459 snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); in snd_timer_start()
462 timer = timeri->timer; in snd_timer_start()
466 timeri->ticks = timeri->cticks = ticks; in snd_timer_start()
467 timeri->pticks = 0; in snd_timer_start()
468 result = snd_timer_start1(timer, timeri, ticks); in snd_timer_start()
470 snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); in snd_timer_start()
474 static int _snd_timer_stop(struct snd_timer_instance * timeri, in _snd_timer_stop() argument
480 if (snd_BUG_ON(!timeri)) in _snd_timer_stop()
483 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { in _snd_timer_stop()
486 timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; in _snd_timer_stop()
491 timer = timeri->timer; in _snd_timer_stop()
495 list_del_init(&timeri->ack_list); in _snd_timer_stop()
496 list_del_init(&timeri->active_list); in _snd_timer_stop()
497 if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && in _snd_timer_stop()
510 timeri->flags &= in _snd_timer_stop()
515 snd_timer_notify1(timeri, event); in _snd_timer_stop()
524 int snd_timer_stop(struct snd_timer_instance *timeri) in snd_timer_stop() argument
530 err = _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_STOP); in snd_timer_stop()
533 timer = timeri->timer; in snd_timer_stop()
535 timeri->cticks = timeri->ticks; in snd_timer_stop()
536 timeri->pticks = 0; in snd_timer_stop()
544 int snd_timer_continue(struct snd_timer_instance *timeri) in snd_timer_continue() argument
550 if (timeri == NULL) in snd_timer_continue()
552 if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) in snd_timer_continue()
553 return snd_timer_start_slave(timeri); in snd_timer_continue()
554 timer = timeri->timer; in snd_timer_continue()
558 if (!timeri->cticks) in snd_timer_continue()
559 timeri->cticks = 1; in snd_timer_continue()
560 timeri->pticks = 0; in snd_timer_continue()
561 result = snd_timer_start1(timer, timeri, timer->sticks); in snd_timer_continue()
563 snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_CONTINUE); in snd_timer_continue()
570 int snd_timer_pause(struct snd_timer_instance * timeri) in snd_timer_pause() argument
572 return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE); in snd_timer_pause()
1113 static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, in snd_timer_user_interrupt() argument
1117 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_interrupt()
1157 static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, in snd_timer_user_ccallback() argument
1162 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_ccallback()
1181 static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, in snd_timer_user_tinterrupt() argument
1185 struct snd_timer_user *tu = timeri->callback_data; in snd_timer_user_tinterrupt()
1273 if (tu->timeri) in snd_timer_user_release()
1274 snd_timer_close(tu->timeri); in snd_timer_user_release()
1513 if (tu->timeri) { in snd_timer_user_tselect()
1514 snd_timer_close(tu->timeri); in snd_timer_user_tselect()
1515 tu->timeri = NULL; in snd_timer_user_tselect()
1524 err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid); in snd_timer_user_tselect()
1545 snd_timer_close(tu->timeri); in snd_timer_user_tselect()
1546 tu->timeri = NULL; in snd_timer_user_tselect()
1548 tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST; in snd_timer_user_tselect()
1549 tu->timeri->callback = tu->tread in snd_timer_user_tselect()
1551 tu->timeri->ccallback = snd_timer_user_ccallback; in snd_timer_user_tselect()
1552 tu->timeri->callback_data = (void *)tu; in snd_timer_user_tselect()
1569 if (!tu->timeri) in snd_timer_user_info()
1571 t = tu->timeri->timer; in snd_timer_user_info()
1601 if (!tu->timeri) in snd_timer_user_params()
1603 t = tu->timeri->timer; in snd_timer_user_params()
1634 snd_timer_stop(tu->timeri); in snd_timer_user_params()
1636 tu->timeri->flags &= ~(SNDRV_TIMER_IFLG_AUTO| in snd_timer_user_params()
1640 tu->timeri->flags |= SNDRV_TIMER_IFLG_AUTO; in snd_timer_user_params()
1642 tu->timeri->flags |= SNDRV_TIMER_IFLG_EXCLUSIVE; in snd_timer_user_params()
1644 tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT; in snd_timer_user_params()
1667 if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { in snd_timer_user_params()
1699 if (!tu->timeri) in snd_timer_user_status()
1703 status.resolution = snd_timer_resolution(tu->timeri); in snd_timer_user_status()
1704 status.lost = tu->timeri->lost; in snd_timer_user_status()
1720 if (!tu->timeri) in snd_timer_user_start()
1722 snd_timer_stop(tu->timeri); in snd_timer_user_start()
1723 tu->timeri->lost = 0; in snd_timer_user_start()
1725 return (err = snd_timer_start(tu->timeri, tu->ticks)) < 0 ? err : 0; in snd_timer_user_start()
1734 if (!tu->timeri) in snd_timer_user_stop()
1736 return (err = snd_timer_stop(tu->timeri)) < 0 ? err : 0; in snd_timer_user_stop()
1745 if (!tu->timeri) in snd_timer_user_continue()
1747 tu->timeri->lost = 0; in snd_timer_user_continue()
1748 return (err = snd_timer_continue(tu->timeri)) < 0 ? err : 0; in snd_timer_user_continue()
1757 if (!tu->timeri) in snd_timer_user_pause()
1759 return (err = snd_timer_pause(tu->timeri)) < 0 ? err : 0; in snd_timer_user_pause()
1787 if (tu->timeri) { /* too late */ in snd_timer_user_ioctl()