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);
144 struct loopback_cable *cable;
212 /* call in cable->lock */
233 /* call in cable->lock */
236 struct loopback_cable *cable = dpcm->cable;
242 err = snd_timer_start(cable->snd_timer.instance, 1);
246 * of the same cable
253 cable->snd_timer.id.card,
254 cable->snd_timer.id.device,
255 cable->snd_timer.id.subdevice,
262 /* call in cable->lock */
271 /* call in cable->lock */
274 struct loopback_cable *cable = dpcm->cable;
278 if (cable->running ^ cable->pause)
281 err = snd_timer_stop(cable->snd_timer.instance);
285 cable->snd_timer.id.card,
286 cable->snd_timer.id.device,
287 cable->snd_timer.id.subdevice,
304 struct loopback_cable *cable = dpcm->cable;
307 if (!cable->snd_timer.instance)
313 * cable->lock;
315 snd_timer_close(cable->snd_timer.instance);
318 cancel_work_sync(&cable->snd_timer.event_work);
320 snd_timer_instance_free(cable->snd_timer.instance);
321 memset(&cable->snd_timer, 0, sizeof(cable->snd_timer));
337 static int loopback_check_format(struct loopback_cable *cable, int stream)
344 if (cable->valid != CABLE_VALID_BOTH) {
349 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->
351 cruntime = cable->streams[SNDRV_PCM_STREAM_CAPTURE]->
363 snd_pcm_stop(cable->streams[SNDRV_PCM_STREAM_CAPTURE]->
366 runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->
368 setup = get_setup(cable->streams[SNDRV_PCM_STREAM_PLAYBACK]);
369 card = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->loopback->card;
406 struct loopback_cable *cable = dpcm->cable;
411 err = loopback_check_format(cable, substream->stream);
417 scoped_guard(spinlock, &cable->lock) {
418 cable->running |= stream;
419 cable->pause &= ~stream;
420 err = cable->ops->start(dpcm);
426 scoped_guard(spinlock, &cable->lock) {
427 cable->running &= ~stream;
428 cable->pause &= ~stream;
429 err = cable->ops->stop(dpcm);
436 scoped_guard(spinlock, &cable->lock) {
437 cable->pause |= stream;
438 err = cable->ops->stop(dpcm);
445 scoped_guard(spinlock, &cable->lock) {
447 cable->pause &= ~stream;
448 err = cable->ops->start(dpcm);
463 struct loopback_cable *cable = dpcm->cable;
465 cable->hw.formats = pcm_format_to_bits(runtime->format);
466 cable->hw.rate_min = runtime->rate;
467 cable->hw.rate_max = runtime->rate;
468 cable->hw.channels_min = runtime->channels;
469 cable->hw.channels_max = runtime->channels;
471 if (cable->snd_timer.instance) {
472 cable->hw.period_bytes_min =
474 cable->hw.period_bytes_max = cable->hw.period_bytes_min;
483 struct loopback_cable *cable = dpcm->cable;
486 if (cable->ops->stop_sync) {
487 err = cable->ops->stop_sync(dpcm);
515 if (!(cable->valid & ~(1 << substream->stream)) ||
519 cable->valid |= 1 << substream->stream;
644 /* call in cable->lock */
646 (struct loopback_cable *cable)
649 cable->streams[SNDRV_PCM_STREAM_PLAYBACK];
651 cable->streams[SNDRV_PCM_STREAM_CAPTURE];
656 running = cable->running ^ cable->pause;
705 scoped_guard(spinlock_irqsave, &dpcm->cable->lock) {
706 if (loopback_jiffies_timer_pos_update(dpcm->cable) &
721 /* call in cable->lock */
727 struct loopback_cable *cable = dpcm->cable;
746 cable->snd_timer.id.card,
747 cable->snd_timer.id.device,
748 cable->snd_timer.id.subdevice,
755 static void loopback_snd_timer_period_elapsed(struct loopback_cable *cable,
765 scoped_guard(spinlock_irqsave, &cable->lock) {
766 running = cable->running ^ cable->pause;
771 dpcm_play = cable->streams[SNDRV_PCM_STREAM_PLAYBACK];
772 dpcm_capt = cable->streams[SNDRV_PCM_STREAM_CAPTURE];
836 struct loopback_cable *cable = timeri->callback_data;
838 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_TICK,
844 struct loopback_cable *cable;
846 cable = container_of(work, struct loopback_cable, snd_timer.event_work);
847 loopback_snd_timer_period_elapsed(cable, SNDRV_TIMER_EVENT_MSTOP, 0);
855 /* Do not lock cable->lock here because timer->lock is already hold.
856 * There are other functions which first lock cable->lock and than
859 * spin_lock(&cable->lock)
868 struct loopback_cable *cable = timeri->callback_data;
878 schedule_work(&cable->snd_timer.event_work);
897 struct loopback_cable *cable = dpcm->cable;
900 cable->snd_timer.id.card,
901 cable->snd_timer.id.device,
902 cable->snd_timer.id.subdevice);
904 snd_pcm_direction_name(cable->snd_timer.stream));
913 guard(spinlock)(&dpcm->cable->lock);
914 if (dpcm->cable->ops->pos_update)
915 dpcm->cable->ops->pos_update(dpcm->cable);
958 struct loopback_cable *cable = dpcm->cable;
961 cable->valid &= ~(1 << substream->stream);
977 struct loopback_cable *cable = dpcm->cable;
982 m.bits[0] = (u_int32_t)cable->hw.formats;
983 m.bits[1] = (u_int32_t)(cable->hw.formats >> 32);
992 struct loopback_cable *cable = dpcm->cable;
996 t.min = cable->hw.rate_min;
997 t.max = cable->hw.rate_max;
1008 struct loopback_cable *cable = dpcm->cable;
1012 t.min = cable->hw.channels_min;
1013 t.max = cable->hw.channels_max;
1024 struct loopback_cable *cable = dpcm->cable;
1028 t.min = cable->hw.period_bytes_min;
1029 t.max = cable->hw.period_bytes_max;
1041 struct loopback_cable *cable;
1043 cable = loopback->cables[substream->number][dev];
1044 if (!cable)
1046 if (cable->streams[!substream->stream]) {
1048 guard(spinlock_irq)(&cable->lock);
1049 cable->streams[substream->stream] = NULL;
1053 if (cable->ops && cable->ops->close_cable && dpcm)
1054 cable->ops->close_cable(dpcm);
1055 /* free the cable */
1057 kfree(cable);
1149 struct loopback_cable *cable = dpcm->cable;
1152 * per playback and capture subdevice (aka cable).
1154 if (cable->snd_timer.instance)
1165 cable->snd_timer.stream = dpcm->substream->stream;
1166 cable->snd_timer.id = tid;
1183 timeri->callback_data = (void *)cable;
1187 INIT_WORK(&cable->snd_timer.event_work, loopback_snd_timer_work);
1191 * by the other device of the same cable.
1194 * Unlock cable->lock for snd_timer_close/open() call
1200 err = snd_timer_open(timeri, &cable->snd_timer.id, current->pid);
1204 cable->snd_timer.id.card,
1205 cable->snd_timer.id.device,
1206 cable->snd_timer.id.subdevice,
1212 cable->snd_timer.instance = timeri;
1234 struct loopback_cable *cable = NULL;
1245 cable = loopback->cables[substream->number][dev];
1246 if (!cable) {
1247 cable = kzalloc(sizeof(*cable), GFP_KERNEL);
1248 if (!cable) {
1252 spin_lock_init(&cable->lock);
1253 cable->hw = loopback_pcm_hardware;
1255 cable->ops = &loopback_snd_timer_ops;
1257 cable->ops = &loopback_jiffies_timer_ops;
1258 loopback->cables[substream->number][dev] = cable;
1260 dpcm->cable = cable;
1263 if (cable->ops->open) {
1264 err = cable->ops->open(dpcm);
1297 if (cable->snd_timer.instance) {
1313 runtime->hw = cable->hw;
1315 scoped_guard(spinlock_irq, &cable->lock) {
1316 cable->streams[substream->stream] = dpcm;
1333 if (dpcm->cable->ops->close_substream)
1334 err = dpcm->cable->ops->close_substream(dpcm);
1450 struct loopback_cable *cable;
1455 cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^ 1];
1456 if (cable != NULL) {
1457 unsigned int running = cable->running ^ cable->pause;
1690 if (dpcm->cable->ops->dpcm_info)
1691 dpcm->cable->ops->dpcm_info(dpcm, buffer);
1699 struct loopback_cable *cable = loopback->cables[sub][num];
1701 snd_iprintf(buffer, "Cable %i substream %i:\n", num, sub);
1702 if (cable == NULL) {
1706 snd_iprintf(buffer, " valid: %u\n", cable->valid);
1707 snd_iprintf(buffer, " running: %u\n", cable->running);
1708 snd_iprintf(buffer, " pause: %u\n", cable->pause);
1709 print_dpcm_info(buffer, cable->streams[0], "Playback");
1710 print_dpcm_info(buffer, cable->streams[1], "Capture");
1730 snprintf(name, sizeof(name), "cable#%d", cidx);