Lines Matching full:cable
74 * call in cable->lock
78 * call in cable->lock
90 * call in cable->lock
92 unsigned int (*pos_update)(struct loopback_cable *cable);
143 struct loopback_cable *cable; member
211 /* call in cable->lock */
232 /* call in cable->lock */
235 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_start() local
241 err = snd_timer_start(cable->snd_timer.instance, 1); in loopback_snd_timer_start()
245 * of the same cable in loopback_snd_timer_start()
252 cable->snd_timer.id.card, in loopback_snd_timer_start()
253 cable->snd_timer.id.device, in loopback_snd_timer_start()
254 cable->snd_timer.id.subdevice, in loopback_snd_timer_start()
261 /* call in cable->lock */
270 /* call in cable->lock */
273 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_stop() local
277 if (cable->running ^ cable->pause) in loopback_snd_timer_stop()
280 err = snd_timer_stop(cable->snd_timer.instance); in loopback_snd_timer_stop()
284 cable->snd_timer.id.card, in loopback_snd_timer_stop()
285 cable->snd_timer.id.device, in loopback_snd_timer_stop()
286 cable->snd_timer.id.subdevice, in loopback_snd_timer_stop()
303 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_close_cable() local
306 if (!cable->snd_timer.instance) in loopback_snd_timer_close_cable()
312 * cable->lock; in loopback_snd_timer_close_cable()
314 snd_timer_close(cable->snd_timer.instance); in loopback_snd_timer_close_cable()
317 cancel_work_sync(&cable->snd_timer.event_work); in loopback_snd_timer_close_cable()
319 snd_timer_instance_free(cable->snd_timer.instance); in loopback_snd_timer_close_cable()
320 memset(&cable->snd_timer, 0, sizeof(cable->snd_timer)); in loopback_snd_timer_close_cable()
336 static int loopback_check_format(struct loopback_cable *cable, int stream) in loopback_check_format() argument
343 if (cable->valid != CABLE_VALID_BOTH) { in loopback_check_format()
348 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]-> in loopback_check_format()
350 cruntime = cable->streams[SNDRV_PCM_STREAM_CAPTURE]-> in loopback_check_format()
362 snd_pcm_stop(cable->streams[SNDRV_PCM_STREAM_CAPTURE]-> in loopback_check_format()
365 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]-> in loopback_check_format()
367 setup = get_setup(cable->streams[SNDRV_PCM_STREAM_PLAYBACK]); in loopback_check_format()
368 card = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->loopback->card; in loopback_check_format()
405 struct loopback_cable *cable = dpcm->cable; in loopback_trigger() local
410 err = loopback_check_format(cable, substream->stream); in loopback_trigger()
416 spin_lock(&cable->lock); in loopback_trigger()
417 cable->running |= stream; in loopback_trigger()
418 cable->pause &= ~stream; in loopback_trigger()
419 err = cable->ops->start(dpcm); in loopback_trigger()
420 spin_unlock(&cable->lock); in loopback_trigger()
425 spin_lock(&cable->lock); in loopback_trigger()
426 cable->running &= ~stream; in loopback_trigger()
427 cable->pause &= ~stream; in loopback_trigger()
428 err = cable->ops->stop(dpcm); in loopback_trigger()
429 spin_unlock(&cable->lock); in loopback_trigger()
435 spin_lock(&cable->lock); in loopback_trigger()
436 cable->pause |= stream; in loopback_trigger()
437 err = cable->ops->stop(dpcm); in loopback_trigger()
438 spin_unlock(&cable->lock); in loopback_trigger()
444 spin_lock(&cable->lock); in loopback_trigger()
446 cable->pause &= ~stream; in loopback_trigger()
447 err = cable->ops->start(dpcm); in loopback_trigger()
448 spin_unlock(&cable->lock); in loopback_trigger()
462 struct loopback_cable *cable = dpcm->cable; in params_change() local
464 cable->hw.formats = pcm_format_to_bits(runtime->format); in params_change()
465 cable->hw.rate_min = runtime->rate; in params_change()
466 cable->hw.rate_max = runtime->rate; in params_change()
467 cable->hw.channels_min = runtime->channels; in params_change()
468 cable->hw.channels_max = runtime->channels; in params_change()
470 if (cable->snd_timer.instance) { in params_change()
471 cable->hw.period_bytes_min = in params_change()
473 cable->hw.period_bytes_max = cable->hw.period_bytes_min; in params_change()
482 struct loopback_cable *cable = dpcm->cable; in loopback_prepare() local
485 if (cable->ops->stop_sync) { in loopback_prepare()
486 err = cable->ops->stop_sync(dpcm); in loopback_prepare()
514 if (!(cable->valid & ~(1 << substream->stream)) || in loopback_prepare()
518 cable->valid |= 1 << substream->stream; in loopback_prepare()
644 /* call in cable->lock */
646 (struct loopback_cable *cable) in loopback_jiffies_timer_pos_update() argument
649 cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; in loopback_jiffies_timer_pos_update()
651 cable->streams[SNDRV_PCM_STREAM_CAPTURE]; in loopback_jiffies_timer_pos_update()
656 running = cable->running ^ cable->pause; in loopback_jiffies_timer_pos_update()
705 spin_lock_irqsave(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
706 if (loopback_jiffies_timer_pos_update(dpcm->cable) & in loopback_jiffies_timer_function()
711 spin_unlock_irqrestore(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
717 spin_unlock_irqrestore(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
720 /* call in cable->lock */
726 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_check_resolution() local
745 cable->snd_timer.id.card, in loopback_snd_timer_check_resolution()
746 cable->snd_timer.id.device, in loopback_snd_timer_check_resolution()
747 cable->snd_timer.id.subdevice, in loopback_snd_timer_check_resolution()
754 static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable, in loopback_snd_timer_period_elapsed() argument
764 spin_lock_irqsave(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
765 running = cable->running ^ cable->pause; in loopback_snd_timer_period_elapsed()
768 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
772 dpcm_play = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; in loopback_snd_timer_period_elapsed()
773 dpcm_capt = cable->streams[SNDRV_PCM_STREAM_CAPTURE]; in loopback_snd_timer_period_elapsed()
779 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
800 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
823 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
835 struct loopback_cable *cable = timeri->callback_data; in loopback_snd_timer_function() local
837 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_TICK, in loopback_snd_timer_function()
843 struct loopback_cable *cable; in loopback_snd_timer_work() local
845 cable = container_of(work, struct loopback_cable, snd_timer.event_work); in loopback_snd_timer_work()
846 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_MSTOP, 0); in loopback_snd_timer_work()
854 /* Do not lock cable->lock here because timer->lock is already hold. in loopback_snd_timer_event()
855 * There are other functions which first lock cable->lock and than in loopback_snd_timer_event()
858 * spin_lock(&cable->lock) in loopback_snd_timer_event()
867 struct loopback_cable *cable = timeri->callback_data; in loopback_snd_timer_event() local
877 schedule_work(&cable->snd_timer.event_work); in loopback_snd_timer_event()
896 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_dpcm_info() local
899 cable->snd_timer.id.card, in loopback_snd_timer_dpcm_info()
900 cable->snd_timer.id.device, in loopback_snd_timer_dpcm_info()
901 cable->snd_timer.id.subdevice); in loopback_snd_timer_dpcm_info()
903 snd_pcm_direction_name(cable->snd_timer.stream)); in loopback_snd_timer_dpcm_info()
912 spin_lock(&dpcm->cable->lock); in loopback_pointer()
913 if (dpcm->cable->ops->pos_update) in loopback_pointer()
914 dpcm->cable->ops->pos_update(dpcm->cable); in loopback_pointer()
916 spin_unlock(&dpcm->cable->lock); in loopback_pointer()
958 struct loopback_cable *cable = dpcm->cable; in loopback_hw_free() local
961 cable->valid &= ~(1 << substream->stream); in loopback_hw_free()
978 struct loopback_cable *cable = dpcm->cable; in rule_format() local
983 m.bits[0] = (u_int32_t)cable->hw.formats; in rule_format()
984 m.bits[1] = (u_int32_t)(cable->hw.formats >> 32); in rule_format()
993 struct loopback_cable *cable = dpcm->cable; in rule_rate() local
997 t.min = cable->hw.rate_min; in rule_rate()
998 t.max = cable->hw.rate_max; in rule_rate()
1009 struct loopback_cable *cable = dpcm->cable; in rule_channels() local
1013 t.min = cable->hw.channels_min; in rule_channels()
1014 t.max = cable->hw.channels_max; in rule_channels()
1025 struct loopback_cable *cable = dpcm->cable; in rule_period_bytes() local
1029 t.min = cable->hw.period_bytes_min; in rule_period_bytes()
1030 t.max = cable->hw.period_bytes_max; in rule_period_bytes()
1042 struct loopback_cable *cable; in free_cable() local
1044 cable = loopback->cables[substream->number][dev]; in free_cable()
1045 if (!cable) in free_cable()
1047 if (cable->streams[!substream->stream]) { in free_cable()
1049 spin_lock_irq(&cable->lock); in free_cable()
1050 cable->streams[substream->stream] = NULL; in free_cable()
1051 spin_unlock_irq(&cable->lock); in free_cable()
1055 if (cable->ops && cable->ops->close_cable && dpcm) in free_cable()
1056 cable->ops->close_cable(dpcm); in free_cable()
1057 /* free the cable */ in free_cable()
1059 kfree(cable); in free_cable()
1151 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_open() local
1154 * per playback and capture subdevice (aka cable). in loopback_snd_timer_open()
1156 if (cable->snd_timer.instance) in loopback_snd_timer_open()
1167 cable->snd_timer.stream = dpcm->substream->stream; in loopback_snd_timer_open()
1168 cable->snd_timer.id = tid; in loopback_snd_timer_open()
1185 timeri->callback_data = (void *)cable; in loopback_snd_timer_open()
1189 INIT_WORK(&cable->snd_timer.event_work, loopback_snd_timer_work); in loopback_snd_timer_open()
1193 * by the other device of the same cable. in loopback_snd_timer_open()
1196 * Unlock cable->lock for snd_timer_close/open() call in loopback_snd_timer_open()
1202 err = snd_timer_open(timeri, &cable->snd_timer.id, current->pid); in loopback_snd_timer_open()
1206 cable->snd_timer.id.card, in loopback_snd_timer_open()
1207 cable->snd_timer.id.device, in loopback_snd_timer_open()
1208 cable->snd_timer.id.subdevice, in loopback_snd_timer_open()
1214 cable->snd_timer.instance = timeri; in loopback_snd_timer_open()
1236 struct loopback_cable *cable = NULL; in loopback_open() local
1249 cable = loopback->cables[substream->number][dev]; in loopback_open()
1250 if (!cable) { in loopback_open()
1251 cable = kzalloc(sizeof(*cable), GFP_KERNEL); in loopback_open()
1252 if (!cable) { in loopback_open()
1256 spin_lock_init(&cable->lock); in loopback_open()
1257 cable->hw = loopback_pcm_hardware; in loopback_open()
1259 cable->ops = &loopback_snd_timer_ops; in loopback_open()
1261 cable->ops = &loopback_jiffies_timer_ops; in loopback_open()
1262 loopback->cables[substream->number][dev] = cable; in loopback_open()
1264 dpcm->cable = cable; in loopback_open()
1267 if (cable->ops->open) { in loopback_open()
1268 err = cable->ops->open(dpcm); in loopback_open()
1301 if (cable->snd_timer.instance) { in loopback_open()
1317 runtime->hw = cable->hw; in loopback_open()
1319 spin_lock_irq(&cable->lock); in loopback_open()
1320 cable->streams[substream->stream] = dpcm; in loopback_open()
1321 spin_unlock_irq(&cable->lock); in loopback_open()
1338 if (dpcm->cable->ops->close_substream) in loopback_close()
1339 err = dpcm->cable->ops->close_substream(dpcm); in loopback_close()
1460 struct loopback_cable *cable; in loopback_active_get() local
1465 cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^ 1]; in loopback_active_get()
1466 if (cable != NULL) { in loopback_active_get()
1467 unsigned int running = cable->running ^ cable->pause; in loopback_active_get()
1704 if (dpcm->cable->ops->dpcm_info) in print_dpcm_info()
1705 dpcm->cable->ops->dpcm_info(dpcm, buffer); in print_dpcm_info()
1713 struct loopback_cable *cable = loopback->cables[sub][num]; in print_substream_info() local
1715 snd_iprintf(buffer, "Cable %i substream %i:\n", num, sub); in print_substream_info()
1716 if (cable == NULL) { in print_substream_info()
1720 snd_iprintf(buffer, " valid: %u\n", cable->valid); in print_substream_info()
1721 snd_iprintf(buffer, " running: %u\n", cable->running); in print_substream_info()
1722 snd_iprintf(buffer, " pause: %u\n", cable->pause); in print_substream_info()
1723 print_dpcm_info(buffer, cable->streams[0], "Playback"); in print_substream_info()
1724 print_dpcm_info(buffer, cable->streams[1], "Capture"); in print_substream_info()
1745 snprintf(name, sizeof(name), "cable#%d", cidx); in loopback_cable_proc_new()