Lines Matching full:timer
17 #include <sound/timer.h>
37 MODULE_DESCRIPTION("ALSA timer interface");
45 MODULE_ALIAS("devname:snd/timer");
128 static int snd_timer_free(struct snd_timer *timer);
133 static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_left);
136 * create a timer instance with the given owner string.
172 * find a timer instance from the given timer id
176 struct snd_timer *timer; in snd_timer_find() local
178 list_for_each_entry(timer, &snd_timer_list, device_list) { in snd_timer_find()
179 if (timer->tmr_class != tid->dev_class) in snd_timer_find()
181 if ((timer->tmr_class == SNDRV_TIMER_CLASS_CARD || in snd_timer_find()
182 timer->tmr_class == SNDRV_TIMER_CLASS_PCM) && in snd_timer_find()
183 (timer->card == NULL || in snd_timer_find()
184 timer->card->number != tid->card)) in snd_timer_find()
186 if (timer->tmr_device != tid->device) in snd_timer_find()
188 if (timer->tmr_subdevice != tid->subdevice) in snd_timer_find()
190 return timer; in snd_timer_find()
202 request_module("snd-timer-%i", tid->device); in snd_timer_request()
223 if (master->timer->num_instances >= master->timer->max_instances) in check_matching_master_slave()
226 master->timer->num_instances++; in check_matching_master_slave()
228 spin_lock(&master->timer->lock); in check_matching_master_slave()
230 slave->timer = master->timer; in check_matching_master_slave()
233 spin_unlock(&master->timer->lock); in check_matching_master_slave()
246 struct snd_timer *timer; in snd_timer_check_slave() local
251 list_for_each_entry(timer, &snd_timer_list, device_list) { in snd_timer_check_slave()
252 list_for_each_entry(master, &timer->open_list_head, open_list) { in snd_timer_check_slave()
286 * open a timer instance
293 struct snd_timer *timer; in snd_timer_open() local
302 pr_debug("ALSA: timer: invalid slave class %i\n", in snd_timer_open()
321 timer = snd_timer_find(tid); in snd_timer_open()
323 if (!timer) { in snd_timer_open()
327 timer = snd_timer_find(tid); in snd_timer_open()
330 if (!timer) { in snd_timer_open()
334 if (!list_empty(&timer->open_list_head)) { in snd_timer_open()
336 list_entry(timer->open_list_head.next, in snd_timer_open()
343 if (timer->num_instances >= timer->max_instances) { in snd_timer_open()
347 if (!try_module_get(timer->module)) { in snd_timer_open()
352 if (timer->card) { in snd_timer_open()
353 get_device(&timer->card->card_dev); in snd_timer_open()
354 card_dev_to_put = &timer->card->card_dev; in snd_timer_open()
357 if (list_empty(&timer->open_list_head) && timer->hw.open) { in snd_timer_open()
358 err = timer->hw.open(timer); in snd_timer_open()
360 module_put(timer->module); in snd_timer_open()
365 timeri->timer = timer; in snd_timer_open()
369 list_add_tail(&timeri->open_list, &timer->open_list_head); in snd_timer_open()
370 timer->num_instances++; in snd_timer_open()
386 * close a timer instance
392 struct snd_timer *timer = timeri->timer; in snd_timer_close_locked() local
395 if (timer) { in snd_timer_close_locked()
396 spin_lock_irq(&timer->lock); in snd_timer_close_locked()
398 spin_unlock_irq(&timer->lock); in snd_timer_close_locked()
407 /* force to stop the timer */ in snd_timer_close_locked()
410 if (timer) { in snd_timer_close_locked()
411 timer->num_instances--; in snd_timer_close_locked()
413 spin_lock_irq(&timer->lock); in snd_timer_close_locked()
415 spin_unlock_irq(&timer->lock); in snd_timer_close_locked()
417 spin_lock_irq(&timer->lock); in snd_timer_close_locked()
419 spin_unlock_irq(&timer->lock); in snd_timer_close_locked()
423 spin_lock(&timer->lock); in snd_timer_close_locked()
424 timeri->timer = NULL; in snd_timer_close_locked()
428 timer->num_instances--; in snd_timer_close_locked()
430 slave->timer = NULL; in snd_timer_close_locked()
434 spin_unlock(&timer->lock); in snd_timer_close_locked()
437 /* slave doesn't need to release timer resources below */ in snd_timer_close_locked()
439 timer = NULL; in snd_timer_close_locked()
442 if (timer) { in snd_timer_close_locked()
443 if (list_empty(&timer->open_list_head) && timer->hw.close) in snd_timer_close_locked()
444 timer->hw.close(timer); in snd_timer_close_locked()
446 if (timer->card) in snd_timer_close_locked()
447 *card_devp_to_put = &timer->card->card_dev; in snd_timer_close_locked()
448 module_put(timer->module); in snd_timer_close_locked()
453 * close a timer instance
471 static unsigned long snd_timer_hw_resolution(struct snd_timer *timer) in snd_timer_hw_resolution() argument
473 if (timer->hw.c_resolution) in snd_timer_hw_resolution()
474 return timer->hw.c_resolution(timer); in snd_timer_hw_resolution()
476 return timer->hw.resolution; in snd_timer_hw_resolution()
481 struct snd_timer * timer; in snd_timer_resolution() local
487 timer = timeri->timer; in snd_timer_resolution()
488 if (timer) { in snd_timer_resolution()
489 spin_lock_irqsave(&timer->lock, flags); in snd_timer_resolution()
490 ret = snd_timer_hw_resolution(timer); in snd_timer_resolution()
491 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_resolution()
499 struct snd_timer *timer = ti->timer; in snd_timer_notify1() local
511 if (timer && in snd_timer_notify1()
514 resolution = snd_timer_hw_resolution(timer); in snd_timer_notify1()
519 if (timer == NULL) in snd_timer_notify1()
521 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) in snd_timer_notify1()
529 /* start/continue a master timer */
533 struct snd_timer *timer; in snd_timer_start1() local
537 timer = timeri->timer; in snd_timer_start1()
538 if (!timer) in snd_timer_start1()
541 spin_lock_irqsave(&timer->lock, flags); in snd_timer_start1()
546 if (timer->card && timer->card->shutdown) { in snd_timer_start1()
562 list_move_tail(&timeri->active_list, &timer->active_list_head); in snd_timer_start1()
563 if (timer->running) { in snd_timer_start1()
564 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) in snd_timer_start1()
566 timer->flags |= SNDRV_TIMER_FLG_RESCHED; in snd_timer_start1()
571 timer->sticks = ticks; in snd_timer_start1()
572 timer->hw.start(timer); in snd_timer_start1()
574 timer->running++; in snd_timer_start1()
581 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_start1()
585 /* start/continue a slave timer */
602 if (timeri->master && timeri->timer) { in snd_timer_start_slave()
603 spin_lock(&timeri->timer->lock); in snd_timer_start_slave()
608 spin_unlock(&timeri->timer->lock); in snd_timer_start_slave()
616 /* stop/pause a master timer */
619 struct snd_timer *timer; in snd_timer_stop1() local
623 timer = timeri->timer; in snd_timer_stop1()
624 if (!timer) in snd_timer_stop1()
626 spin_lock_irqsave(&timer->lock, flags); in snd_timer_stop1()
634 if (timer->card && timer->card->shutdown) in snd_timer_stop1()
641 !(--timer->running)) { in snd_timer_stop1()
642 timer->hw.stop(timer); in snd_timer_stop1()
643 if (timer->flags & SNDRV_TIMER_FLG_RESCHED) { in snd_timer_stop1()
644 timer->flags &= ~SNDRV_TIMER_FLG_RESCHED; in snd_timer_stop1()
645 snd_timer_reschedule(timer, 0); in snd_timer_stop1()
646 if (timer->flags & SNDRV_TIMER_FLG_CHANGE) { in snd_timer_stop1()
647 timer->flags &= ~SNDRV_TIMER_FLG_CHANGE; in snd_timer_stop1()
648 timer->hw.start(timer); in snd_timer_stop1()
660 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_stop1()
664 /* stop/pause a slave timer */
675 if (timeri->timer) { in snd_timer_stop_slave()
676 spin_lock(&timeri->timer->lock); in snd_timer_stop_slave()
681 spin_unlock(&timeri->timer->lock); in snd_timer_stop_slave()
688 * start the timer instance
702 * stop the timer instance.
704 * do not call this from the timer callback!
720 /* timer can continue only after pause */ in snd_timer_continue()
744 * reschedule the timer
747 * when the scheduling ticks is changed set CHANGE flag to reprogram the timer.
749 static void snd_timer_reschedule(struct snd_timer * timer, unsigned long ticks_left) in snd_timer_reschedule() argument
754 list_for_each_entry(ti, &timer->active_list_head, active_list) { in snd_timer_reschedule()
758 timer->running++; in snd_timer_reschedule()
766 timer->flags &= ~SNDRV_TIMER_FLG_RESCHED; in snd_timer_reschedule()
769 if (ticks > timer->hw.ticks) in snd_timer_reschedule()
770 ticks = timer->hw.ticks; in snd_timer_reschedule()
772 timer->flags |= SNDRV_TIMER_FLG_CHANGE; in snd_timer_reschedule()
773 timer->sticks = ticks; in snd_timer_reschedule()
776 /* call callbacks in timer ack list */
777 static void snd_timer_process_callbacks(struct snd_timer *timer, in snd_timer_process_callbacks() argument
795 spin_unlock(&timer->lock); in snd_timer_process_callbacks()
798 spin_lock(&timer->lock); in snd_timer_process_callbacks()
805 static void snd_timer_clear_callbacks(struct snd_timer *timer, in snd_timer_clear_callbacks() argument
810 spin_lock_irqsave(&timer->lock, flags); in snd_timer_clear_callbacks()
813 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_clear_callbacks()
817 * timer work
822 struct snd_timer *timer = container_of(work, struct snd_timer, task_work); in snd_timer_work() local
825 if (timer->card && timer->card->shutdown) { in snd_timer_work()
826 snd_timer_clear_callbacks(timer, &timer->sack_list_head); in snd_timer_work()
830 spin_lock_irqsave(&timer->lock, flags); in snd_timer_work()
831 snd_timer_process_callbacks(timer, &timer->sack_list_head); in snd_timer_work()
832 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_work()
836 * timer interrupt
838 * ticks_left is usually equal to timer->sticks.
841 void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) in snd_timer_interrupt() argument
849 if (timer == NULL) in snd_timer_interrupt()
852 if (timer->card && timer->card->shutdown) { in snd_timer_interrupt()
853 snd_timer_clear_callbacks(timer, &timer->ack_list_head); in snd_timer_interrupt()
857 spin_lock_irqsave(&timer->lock, flags); in snd_timer_interrupt()
860 resolution = snd_timer_hw_resolution(timer); in snd_timer_interrupt()
867 list_for_each_entry_safe(ti, tmp, &timer->active_list_head, in snd_timer_interrupt()
885 --timer->running; in snd_timer_interrupt()
888 if ((timer->hw.flags & SNDRV_TIMER_HW_WORK) || in snd_timer_interrupt()
890 ack_list_head = &timer->ack_list_head; in snd_timer_interrupt()
892 ack_list_head = &timer->sack_list_head; in snd_timer_interrupt()
902 if (timer->flags & SNDRV_TIMER_FLG_RESCHED) in snd_timer_interrupt()
903 snd_timer_reschedule(timer, timer->sticks); in snd_timer_interrupt()
904 if (timer->running) { in snd_timer_interrupt()
905 if (timer->hw.flags & SNDRV_TIMER_HW_STOP) { in snd_timer_interrupt()
906 timer->hw.stop(timer); in snd_timer_interrupt()
907 timer->flags |= SNDRV_TIMER_FLG_CHANGE; in snd_timer_interrupt()
909 if (!(timer->hw.flags & SNDRV_TIMER_HW_AUTO) || in snd_timer_interrupt()
910 (timer->flags & SNDRV_TIMER_FLG_CHANGE)) { in snd_timer_interrupt()
911 /* restart timer */ in snd_timer_interrupt()
912 timer->flags &= ~SNDRV_TIMER_FLG_CHANGE; in snd_timer_interrupt()
913 timer->hw.start(timer); in snd_timer_interrupt()
916 timer->hw.stop(timer); in snd_timer_interrupt()
920 snd_timer_process_callbacks(timer, &timer->ack_list_head); in snd_timer_interrupt()
923 use_work = !list_empty(&timer->sack_list_head); in snd_timer_interrupt()
924 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_interrupt()
927 queue_work(system_highpri_wq, &timer->task_work); in snd_timer_interrupt()
938 struct snd_timer *timer; in snd_timer_new() local
955 timer = kzalloc(sizeof(*timer), GFP_KERNEL); in snd_timer_new()
956 if (!timer) in snd_timer_new()
958 timer->tmr_class = tid->dev_class; in snd_timer_new()
959 timer->card = card; in snd_timer_new()
960 timer->tmr_device = tid->device; in snd_timer_new()
961 timer->tmr_subdevice = tid->subdevice; in snd_timer_new()
963 strscpy(timer->id, id, sizeof(timer->id)); in snd_timer_new()
964 timer->sticks = 1; in snd_timer_new()
965 INIT_LIST_HEAD(&timer->device_list); in snd_timer_new()
966 INIT_LIST_HEAD(&timer->open_list_head); in snd_timer_new()
967 INIT_LIST_HEAD(&timer->active_list_head); in snd_timer_new()
968 INIT_LIST_HEAD(&timer->ack_list_head); in snd_timer_new()
969 INIT_LIST_HEAD(&timer->sack_list_head); in snd_timer_new()
970 spin_lock_init(&timer->lock); in snd_timer_new()
971 INIT_WORK(&timer->task_work, snd_timer_work); in snd_timer_new()
972 timer->max_instances = 1000; /* default limit per timer */ in snd_timer_new()
974 timer->module = card->module; in snd_timer_new()
975 err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops); in snd_timer_new()
977 snd_timer_free(timer); in snd_timer_new()
982 *rtimer = timer; in snd_timer_new()
987 static int snd_timer_free(struct snd_timer *timer) in snd_timer_free() argument
989 if (!timer) in snd_timer_free()
993 if (! list_empty(&timer->open_list_head)) { in snd_timer_free()
996 pr_warn("ALSA: timer %p is busy?\n", timer); in snd_timer_free()
997 list_for_each_safe(p, n, &timer->open_list_head) { in snd_timer_free()
1000 ti->timer = NULL; in snd_timer_free()
1003 list_del(&timer->device_list); in snd_timer_free()
1006 if (timer->private_free) in snd_timer_free()
1007 timer->private_free(timer); in snd_timer_free()
1008 kfree(timer); in snd_timer_free()
1014 struct snd_timer *timer = device->device_data; in snd_timer_dev_free() local
1015 return snd_timer_free(timer); in snd_timer_dev_free()
1020 struct snd_timer *timer = dev->device_data; in snd_timer_dev_register() local
1023 if (snd_BUG_ON(!timer || !timer->hw.start || !timer->hw.stop)) in snd_timer_dev_register()
1025 if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) && in snd_timer_dev_register()
1026 !timer->hw.resolution && timer->hw.c_resolution == NULL) in snd_timer_dev_register()
1031 if (timer1->tmr_class > timer->tmr_class) in snd_timer_dev_register()
1033 if (timer1->tmr_class < timer->tmr_class) in snd_timer_dev_register()
1035 if (timer1->card && timer->card) { in snd_timer_dev_register()
1036 if (timer1->card->number > timer->card->number) in snd_timer_dev_register()
1038 if (timer1->card->number < timer->card->number) in snd_timer_dev_register()
1041 if (timer1->tmr_device > timer->tmr_device) in snd_timer_dev_register()
1043 if (timer1->tmr_device < timer->tmr_device) in snd_timer_dev_register()
1045 if (timer1->tmr_subdevice > timer->tmr_subdevice) in snd_timer_dev_register()
1047 if (timer1->tmr_subdevice < timer->tmr_subdevice) in snd_timer_dev_register()
1053 list_add_tail(&timer->device_list, &timer1->device_list); in snd_timer_dev_register()
1060 struct snd_timer *timer = device->device_data; in snd_timer_dev_disconnect() local
1064 list_del_init(&timer->device_list); in snd_timer_dev_disconnect()
1066 list_for_each_entry(ti, &timer->open_list_head, open_list) { in snd_timer_dev_disconnect()
1074 void snd_timer_notify(struct snd_timer *timer, int event, struct timespec64 *tstamp) in snd_timer_notify() argument
1080 if (timer->card && timer->card->shutdown) in snd_timer_notify()
1082 if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) in snd_timer_notify()
1087 spin_lock_irqsave(&timer->lock, flags); in snd_timer_notify()
1091 resolution = snd_timer_hw_resolution(timer); in snd_timer_notify()
1092 list_for_each_entry(ti, &timer->active_list_head, active_list) { in snd_timer_notify()
1099 spin_unlock_irqrestore(&timer->lock, flags); in snd_timer_notify()
1119 int snd_timer_global_free(struct snd_timer *timer) in snd_timer_global_free() argument
1121 return snd_timer_free(timer); in snd_timer_global_free()
1125 int snd_timer_global_register(struct snd_timer *timer) in snd_timer_global_register() argument
1130 dev.device_data = timer; in snd_timer_global_register()
1136 * System timer
1151 struct snd_timer *timer = priv->snd_timer; in snd_timer_s_function() local
1155 snd_timer_interrupt(timer, (long)jiff - (long)priv->last_jiffies); in snd_timer_s_function()
1158 static int snd_timer_s_start(struct snd_timer * timer) in snd_timer_s_start() argument
1163 priv = (struct snd_timer_system_private *) timer->private_data; in snd_timer_s_start()
1165 if (priv->correction > timer->sticks - 1) { in snd_timer_s_start()
1166 priv->correction -= timer->sticks - 1; in snd_timer_s_start()
1169 njiff += timer->sticks - priv->correction; in snd_timer_s_start()
1177 static int snd_timer_s_stop(struct snd_timer * timer) in snd_timer_s_stop() argument
1182 priv = (struct snd_timer_system_private *) timer->private_data; in snd_timer_s_stop()
1186 timer->sticks = priv->last_expires - jiff; in snd_timer_s_stop()
1188 timer->sticks = 1; in snd_timer_s_stop()
1193 static int snd_timer_s_close(struct snd_timer *timer) in snd_timer_s_close() argument
1197 priv = (struct snd_timer_system_private *)timer->private_data; in snd_timer_s_close()
1212 static void snd_timer_free_system(struct snd_timer *timer) in snd_timer_free_system() argument
1214 kfree(timer->private_data); in snd_timer_free_system()
1219 struct snd_timer *timer; in snd_timer_register_system() local
1223 err = snd_timer_global_new("system", SNDRV_TIMER_GLOBAL_SYSTEM, &timer); in snd_timer_register_system()
1226 strcpy(timer->name, "system timer"); in snd_timer_register_system()
1227 timer->hw = snd_timer_system; in snd_timer_register_system()
1230 snd_timer_free(timer); in snd_timer_register_system()
1233 priv->snd_timer = timer; in snd_timer_register_system()
1235 timer->private_data = priv; in snd_timer_register_system()
1236 timer->private_free = snd_timer_free_system; in snd_timer_register_system()
1237 return snd_timer_global_register(timer); in snd_timer_register_system()
1248 struct snd_timer *timer; in snd_timer_proc_read() local
1252 list_for_each_entry(timer, &snd_timer_list, device_list) { in snd_timer_proc_read()
1253 if (timer->card && timer->card->shutdown) in snd_timer_proc_read()
1255 switch (timer->tmr_class) { in snd_timer_proc_read()
1257 snd_iprintf(buffer, "G%i: ", timer->tmr_device); in snd_timer_proc_read()
1261 timer->card->number, timer->tmr_device); in snd_timer_proc_read()
1264 snd_iprintf(buffer, "P%i-%i-%i: ", timer->card->number, in snd_timer_proc_read()
1265 timer->tmr_device, timer->tmr_subdevice); in snd_timer_proc_read()
1268 snd_iprintf(buffer, "?%i-%i-%i-%i: ", timer->tmr_class, in snd_timer_proc_read()
1269 timer->card ? timer->card->number : -1, in snd_timer_proc_read()
1270 timer->tmr_device, timer->tmr_subdevice); in snd_timer_proc_read()
1272 snd_iprintf(buffer, "%s :", timer->name); in snd_timer_proc_read()
1273 if (timer->hw.resolution) in snd_timer_proc_read()
1275 timer->hw.resolution / 1000, in snd_timer_proc_read()
1276 timer->hw.resolution % 1000, in snd_timer_proc_read()
1277 timer->hw.ticks); in snd_timer_proc_read()
1278 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) in snd_timer_proc_read()
1281 list_for_each_entry(ti, &timer->open_list_head, open_list) in snd_timer_proc_read()
1541 static void snd_timer_user_copy_id(struct snd_timer_id *id, struct snd_timer *timer) in snd_timer_user_copy_id() argument
1543 id->dev_class = timer->tmr_class; in snd_timer_user_copy_id()
1545 id->card = timer->card ? timer->card->number : -1; in snd_timer_user_copy_id()
1546 id->device = timer->tmr_device; in snd_timer_user_copy_id()
1547 id->subdevice = timer->tmr_subdevice; in snd_timer_user_copy_id()
1553 struct snd_timer *timer; in snd_timer_user_next_device() local
1563 timer = list_entry(snd_timer_list.next, in snd_timer_user_next_device()
1565 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1572 timer = list_entry(p, struct snd_timer, device_list); in snd_timer_user_next_device()
1573 if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) { in snd_timer_user_next_device()
1574 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1577 if (timer->tmr_device >= id.device) { in snd_timer_user_next_device()
1578 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1600 timer = list_entry(p, struct snd_timer, device_list); in snd_timer_user_next_device()
1601 if (timer->tmr_class > id.dev_class) { in snd_timer_user_next_device()
1602 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1605 if (timer->tmr_class < id.dev_class) in snd_timer_user_next_device()
1607 if (timer->card->number > id.card) { in snd_timer_user_next_device()
1608 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1611 if (timer->card->number < id.card) in snd_timer_user_next_device()
1613 if (timer->tmr_device > id.device) { in snd_timer_user_next_device()
1614 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1617 if (timer->tmr_device < id.device) in snd_timer_user_next_device()
1619 if (timer->tmr_subdevice > id.subdevice) { in snd_timer_user_next_device()
1620 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1623 if (timer->tmr_subdevice < id.subdevice) in snd_timer_user_next_device()
1625 snd_timer_user_copy_id(&id, timer); in snd_timer_user_next_device()
1808 t = tu->timeri->timer; in snd_timer_user_info()
1838 t = tu->timeri->timer; in snd_timer_user_params()
2013 /* start timer instead of continue if it's not used before */ in snd_timer_user_continue()
2287 /* unregister the system timer */
2290 struct snd_timer *timer, *n; in snd_timer_free_all() local
2292 list_for_each_entry_safe(timer, n, &snd_timer_list, device_list) in snd_timer_free_all()
2293 snd_timer_free(timer); in snd_timer_free_all()
2307 dev_set_name(&timer_dev, "timer"); in alsa_timer_init()
2311 "system timer"); in alsa_timer_init()
2316 pr_err("ALSA: unable to register system timer (%i)\n", err); in alsa_timer_init()
2323 pr_err("ALSA: unable to register timer device (%i)\n", err); in alsa_timer_init()