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
524 if (stream == &bebob->tx_stream) { in keep_resources()
525 formation = bebob->tx_stream_formations + index; in keep_resources()
526 conn = &bebob->out_conn; in keep_resources()
528 formation = bebob->rx_stream_formations + index; in keep_resources()
529 conn = &bebob->in_conn; in keep_resources()
540 int snd_bebob_stream_reserve_duplex(struct snd_bebob *bebob, unsigned int rate, in snd_bebob_stream_reserve_duplex() argument
549 err = check_connection_used_by_others(bebob, &bebob->rx_stream); in snd_bebob_stream_reserve_duplex()
553 err = bebob->spec->rate->get(bebob, &curr_rate); in snd_bebob_stream_reserve_duplex()
559 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_reserve_duplex()
560 break_both_connections(bebob); in snd_bebob_stream_reserve_duplex()
562 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
563 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_reserve_duplex()
566 if (bebob->substreams_counter == 0 || curr_rate != rate) { in snd_bebob_stream_reserve_duplex()
574 err = bebob->spec->rate->set(bebob, rate); in snd_bebob_stream_reserve_duplex()
576 dev_err(&bebob->unit->device, in snd_bebob_stream_reserve_duplex()
586 err = keep_resources(bebob, &bebob->tx_stream, rate, index); in snd_bebob_stream_reserve_duplex()
590 err = keep_resources(bebob, &bebob->rx_stream, rate, index); in snd_bebob_stream_reserve_duplex()
592 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
596 err = amdtp_domain_set_events_per_period(&bebob->domain, in snd_bebob_stream_reserve_duplex()
599 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_reserve_duplex()
600 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_reserve_duplex()
608 int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) in snd_bebob_stream_start_duplex() argument
613 if (bebob->substreams_counter == 0) in snd_bebob_stream_start_duplex()
617 if (amdtp_streaming_error(&bebob->rx_stream) || in snd_bebob_stream_start_duplex()
618 amdtp_streaming_error(&bebob->tx_stream)) { in snd_bebob_stream_start_duplex()
619 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_start_duplex()
620 break_both_connections(bebob); in snd_bebob_stream_start_duplex()
623 if (!amdtp_stream_running(&bebob->rx_stream)) { in snd_bebob_stream_start_duplex()
629 if (bebob->maudio_special_quirk) { in snd_bebob_stream_start_duplex()
630 err = bebob->spec->rate->get(bebob, &curr_rate); in snd_bebob_stream_start_duplex()
635 err = snd_bebob_stream_get_clock_src(bebob, &src); in snd_bebob_stream_start_duplex()
640 master = &bebob->tx_stream; in snd_bebob_stream_start_duplex()
641 slave = &bebob->rx_stream; in snd_bebob_stream_start_duplex()
643 master = &bebob->rx_stream; in snd_bebob_stream_start_duplex()
644 slave = &bebob->tx_stream; in snd_bebob_stream_start_duplex()
647 err = start_stream(bebob, master); in snd_bebob_stream_start_duplex()
651 err = start_stream(bebob, slave); in snd_bebob_stream_start_duplex()
664 if (bebob->version < 2) in snd_bebob_stream_start_duplex()
668 err = amdtp_domain_start(&bebob->domain, ir_delay_cycle); in snd_bebob_stream_start_duplex()
675 if (bebob->maudio_special_quirk) { in snd_bebob_stream_start_duplex()
676 err = bebob->spec->rate->set(bebob, curr_rate); in snd_bebob_stream_start_duplex()
678 dev_err(&bebob->unit->device, in snd_bebob_stream_start_duplex()
685 if (!amdtp_stream_wait_callback(&bebob->rx_stream, in snd_bebob_stream_start_duplex()
687 !amdtp_stream_wait_callback(&bebob->tx_stream, in snd_bebob_stream_start_duplex()
696 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_start_duplex()
697 break_both_connections(bebob); in snd_bebob_stream_start_duplex()
701 void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob) in snd_bebob_stream_stop_duplex() argument
703 if (bebob->substreams_counter == 0) { in snd_bebob_stream_stop_duplex()
704 amdtp_domain_stop(&bebob->domain); in snd_bebob_stream_stop_duplex()
705 break_both_connections(bebob); in snd_bebob_stream_stop_duplex()
707 cmp_connection_release(&bebob->out_conn); in snd_bebob_stream_stop_duplex()
708 cmp_connection_release(&bebob->in_conn); in snd_bebob_stream_stop_duplex()
716 void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) in snd_bebob_stream_destroy_duplex() argument
718 amdtp_domain_destroy(&bebob->domain); in snd_bebob_stream_destroy_duplex()
720 destroy_stream(bebob, &bebob->tx_stream); in snd_bebob_stream_destroy_duplex()
721 destroy_stream(bebob, &bebob->rx_stream); in snd_bebob_stream_destroy_duplex()
800 fill_stream_formations(struct snd_bebob *bebob, enum avc_bridgeco_plug_dir dir, in fill_stream_formations() argument
814 formations = bebob->rx_stream_formations; in fill_stream_formations()
816 formations = bebob->tx_stream_formations; in fill_stream_formations()
822 err = avc_bridgeco_get_plug_strm_fmt(bebob->unit, addr, buf, in fill_stream_formations()
829 dev_err(&bebob->unit->device, in fill_stream_formations()
848 seek_msu_sync_input_plug(struct snd_bebob *bebob) in seek_msu_sync_input_plug() argument
856 err = avc_general_get_plug_info(bebob->unit, 0x0c, 0x00, 0x00, plugs); in seek_msu_sync_input_plug()
858 dev_err(&bebob->unit->device, in seek_msu_sync_input_plug()
865 bebob->sync_input_plug = -1; in seek_msu_sync_input_plug()
868 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in seek_msu_sync_input_plug()
870 dev_err(&bebob->unit->device, in seek_msu_sync_input_plug()
877 bebob->sync_input_plug = i; in seek_msu_sync_input_plug()
885 int snd_bebob_stream_discover(struct snd_bebob *bebob) in snd_bebob_stream_discover() argument
887 const struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; in snd_bebob_stream_discover()
894 err = avc_general_get_plug_info(bebob->unit, 0x1f, 0x07, 0x00, plugs); in snd_bebob_stream_discover()
896 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
913 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
915 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
922 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_IN, 0); in snd_bebob_stream_discover()
928 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
930 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
937 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_OUT, 0); in snd_bebob_stream_discover()
942 bebob->midi_input_ports = 0; in snd_bebob_stream_discover()
946 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
948 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
953 bebob->midi_input_ports++; in snd_bebob_stream_discover()
958 bebob->midi_output_ports = 0; in snd_bebob_stream_discover()
962 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); in snd_bebob_stream_discover()
964 dev_err(&bebob->unit->device, in snd_bebob_stream_discover()
969 bebob->midi_output_ports++; in snd_bebob_stream_discover()
975 err = seek_msu_sync_input_plug(bebob); in snd_bebob_stream_discover()
980 void snd_bebob_stream_lock_changed(struct snd_bebob *bebob) in snd_bebob_stream_lock_changed() argument
982 bebob->dev_lock_changed = true; in snd_bebob_stream_lock_changed()
983 wake_up(&bebob->hwdep_wait); in snd_bebob_stream_lock_changed()
986 int snd_bebob_stream_lock_try(struct snd_bebob *bebob) in snd_bebob_stream_lock_try() argument
990 spin_lock_irq(&bebob->lock); in snd_bebob_stream_lock_try()
993 if (bebob->dev_lock_count < 0) { in snd_bebob_stream_lock_try()
999 if (bebob->dev_lock_count++ == 0) in snd_bebob_stream_lock_try()
1000 snd_bebob_stream_lock_changed(bebob); in snd_bebob_stream_lock_try()
1003 spin_unlock_irq(&bebob->lock); in snd_bebob_stream_lock_try()
1007 void snd_bebob_stream_lock_release(struct snd_bebob *bebob) in snd_bebob_stream_lock_release() argument
1009 spin_lock_irq(&bebob->lock); in snd_bebob_stream_lock_release()
1011 if (WARN_ON(bebob->dev_lock_count <= 0)) in snd_bebob_stream_lock_release()
1013 if (--bebob->dev_lock_count == 0) in snd_bebob_stream_lock_release()
1014 snd_bebob_stream_lock_changed(bebob); in snd_bebob_stream_lock_release()
1016 spin_unlock_irq(&bebob->lock); in snd_bebob_stream_lock_release()