Lines Matching full:cable

75 	 * call in cable->lock
79 * call in cable->lock
91 * call in cable->lock
93 unsigned int (*pos_update)(struct loopback_cable *cable);
142 struct loopback_cable *cable; member
207 /* call in cable->lock */
228 /* call in cable->lock */
231 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_start() local
237 err = snd_timer_start(cable->snd_timer.instance, 1); in loopback_snd_timer_start()
241 * of the same cable in loopback_snd_timer_start()
248 cable->snd_timer.id.card, in loopback_snd_timer_start()
249 cable->snd_timer.id.device, in loopback_snd_timer_start()
250 cable->snd_timer.id.subdevice, in loopback_snd_timer_start()
257 /* call in cable->lock */
266 /* call in cable->lock */
269 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_stop() local
273 if (cable->running ^ cable->pause) in loopback_snd_timer_stop()
276 err = snd_timer_stop(cable->snd_timer.instance); in loopback_snd_timer_stop()
280 cable->snd_timer.id.card, in loopback_snd_timer_stop()
281 cable->snd_timer.id.device, in loopback_snd_timer_stop()
282 cable->snd_timer.id.subdevice, in loopback_snd_timer_stop()
299 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_close_cable() local
302 if (!cable->snd_timer.instance) in loopback_snd_timer_close_cable()
308 * cable->lock; in loopback_snd_timer_close_cable()
310 snd_timer_close(cable->snd_timer.instance); in loopback_snd_timer_close_cable()
313 cancel_work_sync(&cable->snd_timer.event_work); in loopback_snd_timer_close_cable()
315 snd_timer_instance_free(cable->snd_timer.instance); in loopback_snd_timer_close_cable()
316 memset(&cable->snd_timer, 0, sizeof(cable->snd_timer)); in loopback_snd_timer_close_cable()
321 static int loopback_check_format(struct loopback_cable *cable, int stream) in loopback_check_format() argument
328 if (cable->valid != CABLE_VALID_BOTH) { in loopback_check_format()
333 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]-> in loopback_check_format()
335 cruntime = cable->streams[SNDRV_PCM_STREAM_CAPTURE]-> in loopback_check_format()
345 snd_pcm_stop(cable->streams[SNDRV_PCM_STREAM_CAPTURE]-> in loopback_check_format()
348 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]-> in loopback_check_format()
350 setup = get_setup(cable->streams[SNDRV_PCM_STREAM_PLAYBACK]); in loopback_check_format()
351 card = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->loopback->card; in loopback_check_format()
382 struct loopback_cable *cable = dpcm->cable; in loopback_trigger() local
387 err = loopback_check_format(cable, substream->stream); in loopback_trigger()
393 spin_lock(&cable->lock); in loopback_trigger()
394 cable->running |= stream; in loopback_trigger()
395 cable->pause &= ~stream; in loopback_trigger()
396 err = cable->ops->start(dpcm); in loopback_trigger()
397 spin_unlock(&cable->lock); in loopback_trigger()
402 spin_lock(&cable->lock); in loopback_trigger()
403 cable->running &= ~stream; in loopback_trigger()
404 cable->pause &= ~stream; in loopback_trigger()
405 err = cable->ops->stop(dpcm); in loopback_trigger()
406 spin_unlock(&cable->lock); in loopback_trigger()
412 spin_lock(&cable->lock); in loopback_trigger()
413 cable->pause |= stream; in loopback_trigger()
414 err = cable->ops->stop(dpcm); in loopback_trigger()
415 spin_unlock(&cable->lock); in loopback_trigger()
421 spin_lock(&cable->lock); in loopback_trigger()
423 cable->pause &= ~stream; in loopback_trigger()
424 err = cable->ops->start(dpcm); in loopback_trigger()
425 spin_unlock(&cable->lock); in loopback_trigger()
439 struct loopback_cable *cable = dpcm->cable; in params_change() local
441 cable->hw.formats = pcm_format_to_bits(runtime->format); in params_change()
442 cable->hw.rate_min = runtime->rate; in params_change()
443 cable->hw.rate_max = runtime->rate; in params_change()
444 cable->hw.channels_min = runtime->channels; in params_change()
445 cable->hw.channels_max = runtime->channels; in params_change()
447 if (cable->snd_timer.instance) { in params_change()
448 cable->hw.period_bytes_min = in params_change()
450 cable->hw.period_bytes_max = cable->hw.period_bytes_min; in params_change()
459 struct loopback_cable *cable = dpcm->cable; in loopback_prepare() local
462 if (cable->ops->stop_sync) { in loopback_prepare()
463 err = cable->ops->stop_sync(dpcm); in loopback_prepare()
490 if (!(cable->valid & ~(1 << substream->stream)) || in loopback_prepare()
494 cable->valid |= 1 << substream->stream; in loopback_prepare()
601 /* call in cable->lock */
603 (struct loopback_cable *cable) in loopback_jiffies_timer_pos_update() argument
606 cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; in loopback_jiffies_timer_pos_update()
608 cable->streams[SNDRV_PCM_STREAM_CAPTURE]; in loopback_jiffies_timer_pos_update()
612 running = cable->running ^ cable->pause; in loopback_jiffies_timer_pos_update()
661 spin_lock_irqsave(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
662 if (loopback_jiffies_timer_pos_update(dpcm->cable) & in loopback_jiffies_timer_function()
667 spin_unlock_irqrestore(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
673 spin_unlock_irqrestore(&dpcm->cable->lock, flags); in loopback_jiffies_timer_function()
676 /* call in cable->lock */
682 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_check_resolution() local
701 cable->snd_timer.id.card, in loopback_snd_timer_check_resolution()
702 cable->snd_timer.id.device, in loopback_snd_timer_check_resolution()
703 cable->snd_timer.id.subdevice, in loopback_snd_timer_check_resolution()
710 static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable, in loopback_snd_timer_period_elapsed() argument
720 spin_lock_irqsave(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
721 running = cable->running ^ cable->pause; in loopback_snd_timer_period_elapsed()
724 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
728 dpcm_play = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]; in loopback_snd_timer_period_elapsed()
729 dpcm_capt = cable->streams[SNDRV_PCM_STREAM_CAPTURE]; in loopback_snd_timer_period_elapsed()
735 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
756 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
779 spin_unlock_irqrestore(&cable->lock, flags); in loopback_snd_timer_period_elapsed()
791 struct loopback_cable *cable = timeri->callback_data; in loopback_snd_timer_function() local
793 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_TICK, in loopback_snd_timer_function()
799 struct loopback_cable *cable; in loopback_snd_timer_work() local
801 cable = container_of(work, struct loopback_cable, snd_timer.event_work); in loopback_snd_timer_work()
802 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_MSTOP, 0); in loopback_snd_timer_work()
810 /* Do not lock cable->lock here because timer->lock is already hold. in loopback_snd_timer_event()
811 * There are other functions which first lock cable->lock and than in loopback_snd_timer_event()
814 * spin_lock(&cable->lock) in loopback_snd_timer_event()
823 struct loopback_cable *cable = timeri->callback_data; in loopback_snd_timer_event() local
833 schedule_work(&cable->snd_timer.event_work); in loopback_snd_timer_event()
852 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_dpcm_info() local
855 cable->snd_timer.id.card, in loopback_snd_timer_dpcm_info()
856 cable->snd_timer.id.device, in loopback_snd_timer_dpcm_info()
857 cable->snd_timer.id.subdevice); in loopback_snd_timer_dpcm_info()
859 (cable->snd_timer.stream == SNDRV_PCM_STREAM_CAPTURE) ? in loopback_snd_timer_dpcm_info()
869 spin_lock(&dpcm->cable->lock); in loopback_pointer()
870 if (dpcm->cable->ops->pos_update) in loopback_pointer()
871 dpcm->cable->ops->pos_update(dpcm->cable); in loopback_pointer()
873 spin_unlock(&dpcm->cable->lock); in loopback_pointer()
912 struct loopback_cable *cable = dpcm->cable; in loopback_hw_free() local
915 cable->valid &= ~(1 << substream->stream); in loopback_hw_free()
932 struct loopback_cable *cable = dpcm->cable; in rule_format() local
937 m.bits[0] = (u_int32_t)cable->hw.formats; in rule_format()
938 m.bits[1] = (u_int32_t)(cable->hw.formats >> 32); in rule_format()
947 struct loopback_cable *cable = dpcm->cable; in rule_rate() local
951 t.min = cable->hw.rate_min; in rule_rate()
952 t.max = cable->hw.rate_max; in rule_rate()
963 struct loopback_cable *cable = dpcm->cable; in rule_channels() local
967 t.min = cable->hw.channels_min; in rule_channels()
968 t.max = cable->hw.channels_max; in rule_channels()
979 struct loopback_cable *cable = dpcm->cable; in rule_period_bytes() local
983 t.min = cable->hw.period_bytes_min; in rule_period_bytes()
984 t.max = cable->hw.period_bytes_max; in rule_period_bytes()
996 struct loopback_cable *cable; in free_cable() local
998 cable = loopback->cables[substream->number][dev]; in free_cable()
999 if (!cable) in free_cable()
1001 if (cable->streams[!substream->stream]) { in free_cable()
1003 spin_lock_irq(&cable->lock); in free_cable()
1004 cable->streams[substream->stream] = NULL; in free_cable()
1005 spin_unlock_irq(&cable->lock); in free_cable()
1009 if (cable->ops && cable->ops->close_cable && dpcm) in free_cable()
1010 cable->ops->close_cable(dpcm); in free_cable()
1011 /* free the cable */ in free_cable()
1013 kfree(cable); in free_cable()
1103 struct loopback_cable *cable = dpcm->cable; in loopback_snd_timer_open() local
1106 * per playback and capture subdevice (aka cable). in loopback_snd_timer_open()
1108 if (cable->snd_timer.instance) in loopback_snd_timer_open()
1119 cable->snd_timer.stream = dpcm->substream->stream; in loopback_snd_timer_open()
1120 cable->snd_timer.id = tid; in loopback_snd_timer_open()
1137 timeri->callback_data = (void *)cable; in loopback_snd_timer_open()
1141 INIT_WORK(&cable->snd_timer.event_work, loopback_snd_timer_work); in loopback_snd_timer_open()
1145 * by the other device of the same cable. in loopback_snd_timer_open()
1148 * Unlock cable->lock for snd_timer_close/open() call in loopback_snd_timer_open()
1154 err = snd_timer_open(timeri, &cable->snd_timer.id, current->pid); in loopback_snd_timer_open()
1158 cable->snd_timer.id.card, in loopback_snd_timer_open()
1159 cable->snd_timer.id.device, in loopback_snd_timer_open()
1160 cable->snd_timer.id.subdevice, in loopback_snd_timer_open()
1166 cable->snd_timer.instance = timeri; in loopback_snd_timer_open()
1188 struct loopback_cable *cable = NULL; in loopback_open() local
1201 cable = loopback->cables[substream->number][dev]; in loopback_open()
1202 if (!cable) { in loopback_open()
1203 cable = kzalloc(sizeof(*cable), GFP_KERNEL); in loopback_open()
1204 if (!cable) { in loopback_open()
1208 spin_lock_init(&cable->lock); in loopback_open()
1209 cable->hw = loopback_pcm_hardware; in loopback_open()
1211 cable->ops = &loopback_snd_timer_ops; in loopback_open()
1213 cable->ops = &loopback_jiffies_timer_ops; in loopback_open()
1214 loopback->cables[substream->number][dev] = cable; in loopback_open()
1216 dpcm->cable = cable; in loopback_open()
1219 if (cable->ops->open) { in loopback_open()
1220 err = cable->ops->open(dpcm); in loopback_open()
1253 if (cable->snd_timer.instance) { in loopback_open()
1269 runtime->hw = cable->hw; in loopback_open()
1271 spin_lock_irq(&cable->lock); in loopback_open()
1272 cable->streams[substream->stream] = dpcm; in loopback_open()
1273 spin_unlock_irq(&cable->lock); in loopback_open()
1290 if (dpcm->cable->ops->close_substream) in loopback_close()
1291 err = dpcm->cable->ops->close_substream(dpcm); in loopback_close()
1412 struct loopback_cable *cable; in loopback_active_get() local
1417 cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^ 1]; in loopback_active_get()
1418 if (cable != NULL) { in loopback_active_get()
1419 unsigned int running = cable->running ^ cable->pause; in loopback_active_get()
1616 if (dpcm->cable->ops->dpcm_info) in print_dpcm_info()
1617 dpcm->cable->ops->dpcm_info(dpcm, buffer); in print_dpcm_info()
1625 struct loopback_cable *cable = loopback->cables[sub][num]; in print_substream_info() local
1627 snd_iprintf(buffer, "Cable %i substream %i:\n", num, sub); in print_substream_info()
1628 if (cable == NULL) { in print_substream_info()
1632 snd_iprintf(buffer, " valid: %u\n", cable->valid); in print_substream_info()
1633 snd_iprintf(buffer, " running: %u\n", cable->running); in print_substream_info()
1634 snd_iprintf(buffer, " pause: %u\n", cable->pause); in print_substream_info()
1635 print_dpcm_info(buffer, cable->streams[0], "Playback"); in print_substream_info()
1636 print_dpcm_info(buffer, cable->streams[1], "Capture"); in print_substream_info()
1657 snprintf(name, sizeof(name), "cable#%d", cidx); in loopback_cable_proc_new()