Lines Matching refs:bebob
64 snd_bebob_stream_get_rate(struct snd_bebob *bebob, unsigned int *curr_rate) in snd_bebob_stream_get_rate() argument
71 err = avc_general_get_sig_fmt(bebob->unit, &tx_rate, in snd_bebob_stream_get_rate()
79 err = avc_general_get_sig_fmt(bebob->unit, &rx_rate, in snd_bebob_stream_get_rate()
90 err = avc_general_set_sig_fmt(bebob->unit, rx_rate, in snd_bebob_stream_get_rate()
97 snd_bebob_stream_set_rate(struct snd_bebob *bebob, unsigned int rate) in snd_bebob_stream_set_rate() argument
101 err = avc_general_set_sig_fmt(bebob->unit, rate, in snd_bebob_stream_set_rate()
106 err = avc_general_set_sig_fmt(bebob->unit, rate, in snd_bebob_stream_set_rate()
120 int snd_bebob_stream_get_clock_src(struct snd_bebob *bebob, in snd_bebob_stream_get_clock_src() argument
123 const struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; in snd_bebob_stream_get_clock_src()
131 err = clk_spec->get(bebob, &id); in snd_bebob_stream_get_clock_src()
133 dev_err(&bebob->unit->device, in snd_bebob_stream_get_clock_src()
139 dev_err(&bebob->unit->device, in snd_bebob_stream_get_clock_src()
154 if (bebob->sync_input_plug < 0) { in snd_bebob_stream_get_clock_src()
164 bebob->sync_input_plug); in snd_bebob_stream_get_clock_src()
165 err = avc_bridgeco_get_plug_input(bebob->unit, addr, input); in snd_bebob_stream_get_clock_src()
167 dev_err(&bebob->unit->device, in snd_bebob_stream_get_clock_src()
169 bebob->sync_input_plug, err); in snd_bebob_stream_get_clock_src()
222 err = avc_bridgeco_get_plug_type(bebob->unit, addr, in snd_bebob_stream_get_clock_src()
255 static int map_data_channels(struct snd_bebob *bebob, struct amdtp_stream *s) in map_data_channels() argument
272 if (s == &bebob->tx_stream) in map_data_channels()
278 err = avc_bridgeco_get_plug_ch_pos(bebob->unit, addr, buf, 256); in map_data_channels()
280 dev_err(&bebob->unit->device, in map_data_channels()
299 err = avc_bridgeco_get_plug_section_type(bebob->unit, addr, in map_data_channels()
302 dev_err(&bebob->unit->device, in map_data_channels()
378 check_connection_used_by_others(struct snd_bebob *bebob, struct amdtp_stream *s) in check_connection_used_by_others() argument
384 if (s == &bebob->tx_stream) in check_connection_used_by_others()
385 conn = &bebob->out_conn; in check_connection_used_by_others()
387 conn = &bebob->in_conn; in check_connection_used_by_others()
391 dev_err(&bebob->unit->device, in check_connection_used_by_others()
401 static void break_both_connections(struct snd_bebob *bebob) in break_both_connections() argument
403 cmp_connection_break(&bebob->in_conn); in break_both_connections()
404 cmp_connection_break(&bebob->out_conn); in break_both_connections()
409 if (bebob->version < 2) in break_both_connections()
413 static int start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) in start_stream() argument
418 if (stream == &bebob->rx_stream) in start_stream()
419 conn = &bebob->in_conn; in start_stream()
421 conn = &bebob->out_conn; in start_stream()
424 if (bebob->maudio_special_quirk == NULL) { in start_stream()
425 err = map_data_channels(bebob, stream); in start_stream()
434 return amdtp_domain_add_stream(&bebob->domain, stream, in start_stream()
438 static int init_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) in init_stream() argument
445 if (stream == &bebob->tx_stream) { in init_stream()
447 conn = &bebob->out_conn; in init_stream()
451 conn = &bebob->in_conn; in init_stream()
455 err = cmp_connection_init(conn, bebob->unit, dir_conn, 0); in init_stream()
459 err = amdtp_am824_init(stream, bebob->unit, dir_stream, CIP_BLOCKING); in init_stream()
465 if (stream == &bebob->tx_stream) { in init_stream()
470 if (bebob->version > 2) in init_stream()
471 bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC | in init_stream()
477 if (bebob->maudio_special_quirk) in init_stream()
478 bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC; in init_stream()
484 static void destroy_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) in destroy_stream() argument
488 if (stream == &bebob->tx_stream) in destroy_stream()
489 cmp_connection_destroy(&bebob->out_conn); in destroy_stream()
491 cmp_connection_destroy(&bebob->in_conn); in destroy_stream()
494 int snd_bebob_stream_init_duplex(struct snd_bebob *bebob) in snd_bebob_stream_init_duplex() argument
498 err = init_stream(bebob, &bebob->tx_stream); in snd_bebob_stream_init_duplex()
502 err = init_stream(bebob, &bebob->rx_stream); in snd_bebob_stream_init_duplex()
504 destroy_stream(bebob, &bebob->tx_stream); in snd_bebob_stream_init_duplex()
508 err = amdtp_domain_init(&bebob->domain); in snd_bebob_stream_init_duplex()
510 destroy_stream(bebob, &bebob->tx_stream); in snd_bebob_stream_init_duplex()
511 destroy_stream(bebob, &bebob->rx_stream); in snd_bebob_stream_init_duplex()
517 static int keep_resources(struct snd_bebob *bebob, struct amdtp_stream *stream, in keep_resources() argument
525 if (stream == &bebob->tx_stream) { in keep_resources()
526 pcm_channels = bebob->tx_stream_formations[index].pcm; in keep_resources()
527 midi_ports = bebob->midi_input_ports; in keep_resources()
528 conn = &bebob->out_conn; in keep_resources()
530 pcm_channels = bebob->rx_stream_formations[index].pcm; in keep_resources()
531 midi_ports = bebob->midi_output_ports; in keep_resources()
532 conn = &bebob->in_conn; in keep_resources()
542 int snd_bebob_stream_reserve_duplex(struct snd_bebob *bebob, unsigned int rate, in snd_bebob_stream_reserve_duplex() argument
551 err = check_connection_used_by_others(bebob, &bebob->rx_stream); in snd_bebob_stream_reserve_duplex()
555 err = bebob->spec->rate->get(bebob, &curr_rate); in snd_bebob_stream_reserve_duplex()
561 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_reserve_duplex()
562 break_both_connections(bebob); in snd_bebob_stream_reserve_duplex()
564 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
565 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_reserve_duplex()
568 if (bebob->substreams_counter == 0 || curr_rate != rate) { in snd_bebob_stream_reserve_duplex()
576 err = bebob->spec->rate->set(bebob, rate); in snd_bebob_stream_reserve_duplex()
578 dev_err(&bebob->unit->device, in snd_bebob_stream_reserve_duplex()
588 err = keep_resources(bebob, &bebob->tx_stream, rate, index); in snd_bebob_stream_reserve_duplex()
592 err = keep_resources(bebob, &bebob->rx_stream, rate, index); in snd_bebob_stream_reserve_duplex()
594 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
598 err = amdtp_domain_set_events_per_period(&bebob->domain, in snd_bebob_stream_reserve_duplex()
601 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
602 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_reserve_duplex()
610 int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) in snd_bebob_stream_start_duplex() argument
615 if (bebob->substreams_counter == 0) in snd_bebob_stream_start_duplex()
619 if (amdtp_streaming_error(&bebob->rx_stream) || in snd_bebob_stream_start_duplex()
620 amdtp_streaming_error(&bebob->tx_stream)) { in snd_bebob_stream_start_duplex()
621 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_start_duplex()
622 break_both_connections(bebob); in snd_bebob_stream_start_duplex()
625 if (!amdtp_stream_running(&bebob->rx_stream)) { in snd_bebob_stream_start_duplex()
631 if (bebob->maudio_special_quirk) { in snd_bebob_stream_start_duplex()
632 err = bebob->spec->rate->get(bebob, &curr_rate); in snd_bebob_stream_start_duplex()
637 err = snd_bebob_stream_get_clock_src(bebob, &src); in snd_bebob_stream_start_duplex()
642 master = &bebob->tx_stream; in snd_bebob_stream_start_duplex()
643 slave = &bebob->rx_stream; in snd_bebob_stream_start_duplex()
645 master = &bebob->rx_stream; in snd_bebob_stream_start_duplex()
646 slave = &bebob->tx_stream; in snd_bebob_stream_start_duplex()
649 err = start_stream(bebob, master); in snd_bebob_stream_start_duplex()
653 err = start_stream(bebob, slave); in snd_bebob_stream_start_duplex()
666 if (bebob->version < 2) in snd_bebob_stream_start_duplex()
670 err = amdtp_domain_start(&bebob->domain, ir_delay_cycle); in snd_bebob_stream_start_duplex()
677 if (bebob->maudio_special_quirk) { in snd_bebob_stream_start_duplex()
678 err = bebob->spec->rate->set(bebob, curr_rate); in snd_bebob_stream_start_duplex()
680 dev_err(&bebob->unit->device, in snd_bebob_stream_start_duplex()
687 if (!amdtp_stream_wait_callback(&bebob->rx_stream, in snd_bebob_stream_start_duplex()
689 !amdtp_stream_wait_callback(&bebob->tx_stream, in snd_bebob_stream_start_duplex()
698 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_start_duplex()
699 break_both_connections(bebob); in snd_bebob_stream_start_duplex()
703 void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob) in snd_bebob_stream_stop_duplex() argument
705 if (bebob->substreams_counter == 0) { in snd_bebob_stream_stop_duplex()
706 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_stop_duplex()
707 break_both_connections(bebob); in snd_bebob_stream_stop_duplex()
709 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_stop_duplex()
710 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_stop_duplex()
718 void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) in snd_bebob_stream_destroy_duplex() argument
720 amdtp_domain_destroy(&bebob->domain); in snd_bebob_stream_destroy_duplex()
722 destroy_stream(bebob, &bebob->tx_stream); in snd_bebob_stream_destroy_duplex()
723 destroy_stream(bebob, &bebob->rx_stream); in snd_bebob_stream_destroy_duplex()
802 fill_stream_formations(struct snd_bebob *bebob, enum avc_bridgeco_plug_dir dir, in fill_stream_formations() argument
816 formations = bebob->rx_stream_formations; in fill_stream_formations()
818 formations = bebob->tx_stream_formations; in fill_stream_formations()
824 err = avc_bridgeco_get_plug_strm_fmt(bebob->unit, addr, buf, in fill_stream_formations()
831 dev_err(&bebob->unit->device, in fill_stream_formations()
850 seek_msu_sync_input_plug(struct snd_bebob *bebob) in seek_msu_sync_input_plug() argument
858 err = avc_general_get_plug_info(bebob->unit, 0x0c, 0x00, 0x00, plugs); in seek_msu_sync_input_plug()
860 dev_err(&bebob->unit->device, in seek_msu_sync_input_plug()
867 bebob->sync_input_plug = -1; in seek_msu_sync_input_plug()
870 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in seek_msu_sync_input_plug()
872 dev_err(&bebob->unit->device, in seek_msu_sync_input_plug()
879 bebob->sync_input_plug = i; in seek_msu_sync_input_plug()
887 int snd_bebob_stream_discover(struct snd_bebob *bebob) in snd_bebob_stream_discover() argument
889 const struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; in snd_bebob_stream_discover()
896 err = avc_general_get_plug_info(bebob->unit, 0x1f, 0x07, 0x00, plugs); in snd_bebob_stream_discover()
898 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
915 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
917 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
924 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_IN, 0); in snd_bebob_stream_discover()
930 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
932 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
939 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_OUT, 0); in snd_bebob_stream_discover()
944 bebob->midi_input_ports = 0; in snd_bebob_stream_discover()
948 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
950 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
955 bebob->midi_input_ports++; in snd_bebob_stream_discover()
960 bebob->midi_output_ports = 0; in snd_bebob_stream_discover()
964 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
966 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
971 bebob->midi_output_ports++; in snd_bebob_stream_discover()
977 err = seek_msu_sync_input_plug(bebob); in snd_bebob_stream_discover()
982 void snd_bebob_stream_lock_changed(struct snd_bebob *bebob) in snd_bebob_stream_lock_changed() argument
984 bebob->dev_lock_changed = true; in snd_bebob_stream_lock_changed()
985 wake_up(&bebob->hwdep_wait); in snd_bebob_stream_lock_changed()
988 int snd_bebob_stream_lock_try(struct snd_bebob *bebob) in snd_bebob_stream_lock_try() argument
992 spin_lock_irq(&bebob->lock); in snd_bebob_stream_lock_try()
995 if (bebob->dev_lock_count < 0) { in snd_bebob_stream_lock_try()
1001 if (bebob->dev_lock_count++ == 0) in snd_bebob_stream_lock_try()
1002 snd_bebob_stream_lock_changed(bebob); in snd_bebob_stream_lock_try()
1005 spin_unlock_irq(&bebob->lock); in snd_bebob_stream_lock_try()
1009 void snd_bebob_stream_lock_release(struct snd_bebob *bebob) in snd_bebob_stream_lock_release() argument
1011 spin_lock_irq(&bebob->lock); in snd_bebob_stream_lock_release()
1013 if (WARN_ON(bebob->dev_lock_count <= 0)) in snd_bebob_stream_lock_release()
1015 if (--bebob->dev_lock_count == 0) in snd_bebob_stream_lock_release()
1016 snd_bebob_stream_lock_changed(bebob); in snd_bebob_stream_lock_release()
1018 spin_unlock_irq(&bebob->lock); in snd_bebob_stream_lock_release()