/linux-4.1.27/sound/firewire/bebob/ |
H A D | Makefile | 1 snd-bebob-objs := bebob_command.o bebob_stream.o bebob_proc.o bebob_midi.o \ 3 bebob_focusrite.o bebob_maudio.o bebob.o 4 obj-$(CONFIG_SND_BEBOB) += snd-bebob.o
|
H A D | bebob_midi.c | 9 #include "bebob.h" 13 struct snd_bebob *bebob = substream->rmidi->private_data; midi_capture_open() local 16 err = snd_bebob_stream_lock_try(bebob); midi_capture_open() 20 atomic_inc(&bebob->capture_substreams); midi_capture_open() 21 err = snd_bebob_stream_start_duplex(bebob, 0); midi_capture_open() 23 snd_bebob_stream_lock_release(bebob); midi_capture_open() 30 struct snd_bebob *bebob = substream->rmidi->private_data; midi_playback_open() local 33 err = snd_bebob_stream_lock_try(bebob); midi_playback_open() 37 atomic_inc(&bebob->playback_substreams); midi_playback_open() 38 err = snd_bebob_stream_start_duplex(bebob, 0); midi_playback_open() 40 snd_bebob_stream_lock_release(bebob); midi_playback_open() 47 struct snd_bebob *bebob = substream->rmidi->private_data; midi_capture_close() local 49 atomic_dec(&bebob->capture_substreams); midi_capture_close() 50 snd_bebob_stream_stop_duplex(bebob); midi_capture_close() 52 snd_bebob_stream_lock_release(bebob); midi_capture_close() 58 struct snd_bebob *bebob = substream->rmidi->private_data; midi_playback_close() local 60 atomic_dec(&bebob->playback_substreams); midi_playback_close() 61 snd_bebob_stream_stop_duplex(bebob); midi_playback_close() 63 snd_bebob_stream_lock_release(bebob); midi_playback_close() 69 struct snd_bebob *bebob = substrm->rmidi->private_data; midi_capture_trigger() local 72 spin_lock_irqsave(&bebob->lock, flags); midi_capture_trigger() 75 amdtp_stream_midi_trigger(&bebob->tx_stream, midi_capture_trigger() 78 amdtp_stream_midi_trigger(&bebob->tx_stream, midi_capture_trigger() 81 spin_unlock_irqrestore(&bebob->lock, flags); midi_capture_trigger() 86 struct snd_bebob *bebob = substrm->rmidi->private_data; midi_playback_trigger() local 89 spin_lock_irqsave(&bebob->lock, flags); midi_playback_trigger() 92 amdtp_stream_midi_trigger(&bebob->rx_stream, midi_playback_trigger() 95 amdtp_stream_midi_trigger(&bebob->rx_stream, midi_playback_trigger() 98 spin_unlock_irqrestore(&bebob->lock, flags); midi_playback_trigger() 113 static void set_midi_substream_names(struct snd_bebob *bebob, set_midi_substream_names() argument 121 bebob->card->shortname, subs->number + 1); set_midi_substream_names() 125 int snd_bebob_create_midi_devices(struct snd_bebob *bebob) snd_bebob_create_midi_devices() argument 132 err = snd_rawmidi_new(bebob->card, bebob->card->driver, 0, snd_bebob_create_midi_devices() 133 bebob->midi_output_ports, bebob->midi_input_ports, snd_bebob_create_midi_devices() 139 "%s MIDI", bebob->card->shortname); snd_bebob_create_midi_devices() 140 rmidi->private_data = bebob; snd_bebob_create_midi_devices() 142 if (bebob->midi_input_ports > 0) { snd_bebob_create_midi_devices() 150 set_midi_substream_names(bebob, str); snd_bebob_create_midi_devices() 153 if (bebob->midi_output_ports > 0) { snd_bebob_create_midi_devices() 161 set_midi_substream_names(bebob, str); snd_bebob_create_midi_devices() 164 if ((bebob->midi_output_ports > 0) && (bebob->midi_input_ports > 0)) snd_bebob_create_midi_devices()
|
H A D | bebob_hwdep.c | 17 #include "bebob.h" 23 struct snd_bebob *bebob = hwdep->private_data; hwdep_read() local 27 spin_lock_irq(&bebob->lock); hwdep_read() 29 while (!bebob->dev_lock_changed) { hwdep_read() 30 prepare_to_wait(&bebob->hwdep_wait, &wait, TASK_INTERRUPTIBLE); hwdep_read() 31 spin_unlock_irq(&bebob->lock); hwdep_read() 33 finish_wait(&bebob->hwdep_wait, &wait); hwdep_read() 36 spin_lock_irq(&bebob->lock); hwdep_read() 40 if (bebob->dev_lock_changed) { hwdep_read() 42 event.lock_status.status = (bebob->dev_lock_count > 0); hwdep_read() 43 bebob->dev_lock_changed = false; hwdep_read() 48 spin_unlock_irq(&bebob->lock); hwdep_read() 59 struct snd_bebob *bebob = hwdep->private_data; hwdep_poll() local 62 poll_wait(file, &bebob->hwdep_wait, wait); hwdep_poll() 64 spin_lock_irq(&bebob->lock); hwdep_poll() 65 if (bebob->dev_lock_changed) hwdep_poll() 69 spin_unlock_irq(&bebob->lock); hwdep_poll() 75 hwdep_get_info(struct snd_bebob *bebob, void __user *arg) hwdep_get_info() argument 77 struct fw_device *dev = fw_parent_device(bebob->unit); hwdep_get_info() 95 hwdep_lock(struct snd_bebob *bebob) hwdep_lock() argument 99 spin_lock_irq(&bebob->lock); hwdep_lock() 101 if (bebob->dev_lock_count == 0) { hwdep_lock() 102 bebob->dev_lock_count = -1; hwdep_lock() 108 spin_unlock_irq(&bebob->lock); hwdep_lock() 114 hwdep_unlock(struct snd_bebob *bebob) hwdep_unlock() argument 118 spin_lock_irq(&bebob->lock); hwdep_unlock() 120 if (bebob->dev_lock_count == -1) { hwdep_unlock() 121 bebob->dev_lock_count = 0; hwdep_unlock() 127 spin_unlock_irq(&bebob->lock); hwdep_unlock() 135 struct snd_bebob *bebob = hwdep->private_data; hwdep_release() local 137 spin_lock_irq(&bebob->lock); hwdep_release() 138 if (bebob->dev_lock_count == -1) hwdep_release() 139 bebob->dev_lock_count = 0; hwdep_release() 140 spin_unlock_irq(&bebob->lock); hwdep_release() 149 struct snd_bebob *bebob = hwdep->private_data; hwdep_ioctl() local 153 return hwdep_get_info(bebob, (void __user *)arg); hwdep_ioctl() 155 return hwdep_lock(bebob); hwdep_ioctl() 157 return hwdep_unlock(bebob); hwdep_ioctl() 183 int snd_bebob_create_hwdep_device(struct snd_bebob *bebob) snd_bebob_create_hwdep_device() argument 188 err = snd_hwdep_new(bebob->card, "BeBoB", 0, &hwdep); snd_bebob_create_hwdep_device() 194 hwdep->private_data = bebob; snd_bebob_create_hwdep_device()
|
H A D | bebob_stream.c | 9 #include "./bebob.h" 65 snd_bebob_stream_get_rate(struct snd_bebob *bebob, unsigned int *curr_rate) snd_bebob_stream_get_rate() argument 72 err = avc_general_get_sig_fmt(bebob->unit, &tx_rate, snd_bebob_stream_get_rate() 80 err = avc_general_get_sig_fmt(bebob->unit, &rx_rate, snd_bebob_stream_get_rate() 91 err = avc_general_set_sig_fmt(bebob->unit, rx_rate, snd_bebob_stream_get_rate() 98 snd_bebob_stream_set_rate(struct snd_bebob *bebob, unsigned int rate) snd_bebob_stream_set_rate() argument 102 err = avc_general_set_sig_fmt(bebob->unit, rate, snd_bebob_stream_set_rate() 107 err = avc_general_set_sig_fmt(bebob->unit, rate, snd_bebob_stream_set_rate() 122 snd_bebob_stream_check_internal_clock(struct snd_bebob *bebob, bool *internal) snd_bebob_stream_check_internal_clock() argument 124 struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; snd_bebob_stream_check_internal_clock() 133 err = clk_spec->get(bebob, &id); snd_bebob_stream_check_internal_clock() 135 dev_err(&bebob->unit->device, snd_bebob_stream_check_internal_clock() 141 dev_err(&bebob->unit->device, snd_bebob_stream_check_internal_clock() 159 if (bebob->sync_input_plug < 0) { snd_bebob_stream_check_internal_clock() 169 bebob->sync_input_plug); snd_bebob_stream_check_internal_clock() 170 err = avc_bridgeco_get_plug_input(bebob->unit, addr, input); snd_bebob_stream_check_internal_clock() 172 dev_err(&bebob->unit->device, snd_bebob_stream_check_internal_clock() 174 bebob->sync_input_plug, err); snd_bebob_stream_check_internal_clock() 200 map_data_channels(struct snd_bebob *bebob, struct amdtp_stream *s) map_data_channels() argument 217 if (s == &bebob->tx_stream) map_data_channels() 223 err = avc_bridgeco_get_plug_ch_pos(bebob->unit, addr, buf, 256); map_data_channels() 225 dev_err(&bebob->unit->device, map_data_channels() 244 err = avc_bridgeco_get_plug_section_type(bebob->unit, addr, map_data_channels() 247 dev_err(&bebob->unit->device, map_data_channels() 322 init_both_connections(struct snd_bebob *bebob) init_both_connections() argument 326 err = cmp_connection_init(&bebob->in_conn, init_both_connections() 327 bebob->unit, CMP_INPUT, 0); init_both_connections() 331 err = cmp_connection_init(&bebob->out_conn, init_both_connections() 332 bebob->unit, CMP_OUTPUT, 0); init_both_connections() 334 cmp_connection_destroy(&bebob->in_conn); init_both_connections() 340 check_connection_used_by_others(struct snd_bebob *bebob, struct amdtp_stream *s) check_connection_used_by_others() argument 346 if (s == &bebob->tx_stream) check_connection_used_by_others() 347 conn = &bebob->out_conn; check_connection_used_by_others() 349 conn = &bebob->in_conn; check_connection_used_by_others() 353 dev_err(&bebob->unit->device, check_connection_used_by_others() 364 make_both_connections(struct snd_bebob *bebob, unsigned int rate) make_both_connections() argument 368 if (bebob->connected) make_both_connections() 375 pcm_channels = bebob->tx_stream_formations[index].pcm; make_both_connections() 376 midi_channels = bebob->tx_stream_formations[index].midi; make_both_connections() 377 amdtp_stream_set_parameters(&bebob->tx_stream, make_both_connections() 379 pcm_channels = bebob->rx_stream_formations[index].pcm; make_both_connections() 380 midi_channels = bebob->rx_stream_formations[index].midi; make_both_connections() 381 amdtp_stream_set_parameters(&bebob->rx_stream, make_both_connections() 385 err = cmp_connection_establish(&bebob->out_conn, make_both_connections() 386 amdtp_stream_get_max_payload(&bebob->tx_stream)); make_both_connections() 389 err = cmp_connection_establish(&bebob->in_conn, make_both_connections() 390 amdtp_stream_get_max_payload(&bebob->rx_stream)); make_both_connections() 392 cmp_connection_break(&bebob->out_conn); make_both_connections() 396 bebob->connected = true; make_both_connections() 402 break_both_connections(struct snd_bebob *bebob) break_both_connections() argument 404 cmp_connection_break(&bebob->in_conn); break_both_connections() 405 cmp_connection_break(&bebob->out_conn); break_both_connections() 407 bebob->connected = false; break_both_connections() 410 if (bebob->maudio_special_quirk != NULL) break_both_connections() 415 destroy_both_connections(struct snd_bebob *bebob) destroy_both_connections() argument 417 cmp_connection_destroy(&bebob->in_conn); destroy_both_connections() 418 cmp_connection_destroy(&bebob->out_conn); destroy_both_connections() 422 get_sync_mode(struct snd_bebob *bebob, enum cip_flags *sync_mode) get_sync_mode() argument 430 start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream, start_stream() argument 436 if (stream == &bebob->rx_stream) start_stream() 437 conn = &bebob->in_conn; start_stream() 439 conn = &bebob->out_conn; start_stream() 442 if (bebob->maudio_special_quirk == NULL) { start_stream() 443 err = map_data_channels(bebob, stream); start_stream() 456 int snd_bebob_stream_init_duplex(struct snd_bebob *bebob) snd_bebob_stream_init_duplex() argument 460 err = init_both_connections(bebob); snd_bebob_stream_init_duplex() 464 err = amdtp_stream_init(&bebob->tx_stream, bebob->unit, snd_bebob_stream_init_duplex() 467 amdtp_stream_destroy(&bebob->tx_stream); snd_bebob_stream_init_duplex() 468 destroy_both_connections(bebob); snd_bebob_stream_init_duplex() 472 init_completion(&bebob->bus_reset); snd_bebob_stream_init_duplex() 473 bebob->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK; snd_bebob_stream_init_duplex() 479 if (bebob->maudio_special_quirk) snd_bebob_stream_init_duplex() 480 bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC; snd_bebob_stream_init_duplex() 482 err = amdtp_stream_init(&bebob->rx_stream, bebob->unit, snd_bebob_stream_init_duplex() 485 amdtp_stream_destroy(&bebob->tx_stream); snd_bebob_stream_init_duplex() 486 amdtp_stream_destroy(&bebob->rx_stream); snd_bebob_stream_init_duplex() 487 destroy_both_connections(bebob); snd_bebob_stream_init_duplex() 493 int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate) snd_bebob_stream_start_duplex() argument 495 struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate; snd_bebob_stream_start_duplex() 510 if (amdtp_streaming_error(&bebob->tx_stream)) { snd_bebob_stream_start_duplex() 511 if (completion_done(&bebob->bus_reset)) snd_bebob_stream_start_duplex() 512 reinit_completion(&bebob->bus_reset); snd_bebob_stream_start_duplex() 515 &bebob->bus_reset, snd_bebob_stream_start_duplex() 519 mutex_lock(&bebob->mutex); snd_bebob_stream_start_duplex() 522 if (atomic_read(&bebob->playback_substreams) == 0 && snd_bebob_stream_start_duplex() 523 atomic_read(&bebob->capture_substreams) == 0) snd_bebob_stream_start_duplex() 526 err = get_sync_mode(bebob, &sync_mode); snd_bebob_stream_start_duplex() 530 master = &bebob->tx_stream; snd_bebob_stream_start_duplex() 531 slave = &bebob->rx_stream; snd_bebob_stream_start_duplex() 532 slave_substreams = &bebob->playback_substreams; snd_bebob_stream_start_duplex() 534 master = &bebob->rx_stream; snd_bebob_stream_start_duplex() 535 slave = &bebob->tx_stream; snd_bebob_stream_start_duplex() 536 slave_substreams = &bebob->capture_substreams; snd_bebob_stream_start_duplex() 543 err = check_connection_used_by_others(bebob, master); snd_bebob_stream_start_duplex() 559 break_both_connections(bebob); snd_bebob_stream_start_duplex() 562 err = rate_spec->get(bebob, &curr_rate); snd_bebob_stream_start_duplex() 564 dev_err(&bebob->unit->device, snd_bebob_stream_start_duplex() 573 break_both_connections(bebob); snd_bebob_stream_start_duplex() 579 bebob->master = master; snd_bebob_stream_start_duplex() 588 if (bebob->maudio_special_quirk == NULL) { snd_bebob_stream_start_duplex() 589 err = rate_spec->set(bebob, rate); snd_bebob_stream_start_duplex() 591 dev_err(&bebob->unit->device, snd_bebob_stream_start_duplex() 598 err = make_both_connections(bebob, rate); snd_bebob_stream_start_duplex() 602 err = start_stream(bebob, master, rate); snd_bebob_stream_start_duplex() 604 dev_err(&bebob->unit->device, snd_bebob_stream_start_duplex() 606 break_both_connections(bebob); snd_bebob_stream_start_duplex() 615 if (bebob->maudio_special_quirk != NULL) { snd_bebob_stream_start_duplex() 616 err = rate_spec->set(bebob, rate); snd_bebob_stream_start_duplex() 618 dev_err(&bebob->unit->device, snd_bebob_stream_start_duplex() 622 break_both_connections(bebob); snd_bebob_stream_start_duplex() 630 break_both_connections(bebob); snd_bebob_stream_start_duplex() 638 err = start_stream(bebob, slave, rate); snd_bebob_stream_start_duplex() 640 dev_err(&bebob->unit->device, snd_bebob_stream_start_duplex() 643 break_both_connections(bebob); snd_bebob_stream_start_duplex() 651 break_both_connections(bebob); snd_bebob_stream_start_duplex() 656 mutex_unlock(&bebob->mutex); snd_bebob_stream_start_duplex() 660 void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob) snd_bebob_stream_stop_duplex() argument 665 if (bebob->master == &bebob->rx_stream) { snd_bebob_stream_stop_duplex() 666 slave = &bebob->tx_stream; snd_bebob_stream_stop_duplex() 667 master = &bebob->rx_stream; snd_bebob_stream_stop_duplex() 668 slave_substreams = &bebob->capture_substreams; snd_bebob_stream_stop_duplex() 669 master_substreams = &bebob->playback_substreams; snd_bebob_stream_stop_duplex() 671 slave = &bebob->rx_stream; snd_bebob_stream_stop_duplex() 672 master = &bebob->tx_stream; snd_bebob_stream_stop_duplex() 673 slave_substreams = &bebob->playback_substreams; snd_bebob_stream_stop_duplex() 674 master_substreams = &bebob->capture_substreams; snd_bebob_stream_stop_duplex() 677 mutex_lock(&bebob->mutex); snd_bebob_stream_stop_duplex() 686 break_both_connections(bebob); snd_bebob_stream_stop_duplex() 690 mutex_unlock(&bebob->mutex); snd_bebob_stream_stop_duplex() 693 void snd_bebob_stream_update_duplex(struct snd_bebob *bebob) snd_bebob_stream_update_duplex() argument 696 mutex_lock(&bebob->mutex); snd_bebob_stream_update_duplex() 698 if ((cmp_connection_update(&bebob->in_conn) < 0) || snd_bebob_stream_update_duplex() 699 (cmp_connection_update(&bebob->out_conn) < 0)) { snd_bebob_stream_update_duplex() 700 amdtp_stream_pcm_abort(&bebob->rx_stream); snd_bebob_stream_update_duplex() 701 amdtp_stream_pcm_abort(&bebob->tx_stream); snd_bebob_stream_update_duplex() 702 amdtp_stream_stop(&bebob->rx_stream); snd_bebob_stream_update_duplex() 703 amdtp_stream_stop(&bebob->tx_stream); snd_bebob_stream_update_duplex() 704 break_both_connections(bebob); snd_bebob_stream_update_duplex() 706 amdtp_stream_update(&bebob->rx_stream); snd_bebob_stream_update_duplex() 707 amdtp_stream_update(&bebob->tx_stream); snd_bebob_stream_update_duplex() 711 if (!completion_done(&bebob->bus_reset)) snd_bebob_stream_update_duplex() 712 complete_all(&bebob->bus_reset); snd_bebob_stream_update_duplex() 714 mutex_unlock(&bebob->mutex); snd_bebob_stream_update_duplex() 721 void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob) snd_bebob_stream_destroy_duplex() argument 723 amdtp_stream_destroy(&bebob->rx_stream); snd_bebob_stream_destroy_duplex() 724 amdtp_stream_destroy(&bebob->tx_stream); snd_bebob_stream_destroy_duplex() 726 destroy_both_connections(bebob); snd_bebob_stream_destroy_duplex() 805 fill_stream_formations(struct snd_bebob *bebob, enum avc_bridgeco_plug_dir dir, fill_stream_formations() argument 819 formations = bebob->rx_stream_formations; fill_stream_formations() 821 formations = bebob->tx_stream_formations; fill_stream_formations() 827 err = avc_bridgeco_get_plug_strm_fmt(bebob->unit, addr, buf, fill_stream_formations() 834 dev_err(&bebob->unit->device, fill_stream_formations() 853 seek_msu_sync_input_plug(struct snd_bebob *bebob) seek_msu_sync_input_plug() argument 861 err = avc_general_get_plug_info(bebob->unit, 0x0c, 0x00, 0x00, plugs); seek_msu_sync_input_plug() 863 dev_err(&bebob->unit->device, seek_msu_sync_input_plug() 870 bebob->sync_input_plug = -1; seek_msu_sync_input_plug() 873 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); seek_msu_sync_input_plug() 875 dev_err(&bebob->unit->device, seek_msu_sync_input_plug() 882 bebob->sync_input_plug = i; seek_msu_sync_input_plug() 890 int snd_bebob_stream_discover(struct snd_bebob *bebob) snd_bebob_stream_discover() argument 892 struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; snd_bebob_stream_discover() 899 err = avc_general_get_plug_info(bebob->unit, 0x1f, 0x07, 0x00, plugs); snd_bebob_stream_discover() 901 dev_err(&bebob->unit->device, snd_bebob_stream_discover() 918 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); snd_bebob_stream_discover() 920 dev_err(&bebob->unit->device, snd_bebob_stream_discover() 927 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_IN, 0); snd_bebob_stream_discover() 933 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); snd_bebob_stream_discover() 935 dev_err(&bebob->unit->device, snd_bebob_stream_discover() 942 err = fill_stream_formations(bebob, AVC_BRIDGECO_PLUG_DIR_OUT, 0); snd_bebob_stream_discover() 947 bebob->midi_input_ports = 0; snd_bebob_stream_discover() 951 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); snd_bebob_stream_discover() 953 dev_err(&bebob->unit->device, snd_bebob_stream_discover() 958 bebob->midi_input_ports++; snd_bebob_stream_discover() 963 bebob->midi_output_ports = 0; snd_bebob_stream_discover() 967 err = avc_bridgeco_get_plug_type(bebob->unit, addr, &type); snd_bebob_stream_discover() 969 dev_err(&bebob->unit->device, snd_bebob_stream_discover() 974 bebob->midi_output_ports++; snd_bebob_stream_discover() 980 err = seek_msu_sync_input_plug(bebob); snd_bebob_stream_discover() 985 void snd_bebob_stream_lock_changed(struct snd_bebob *bebob) snd_bebob_stream_lock_changed() argument 987 bebob->dev_lock_changed = true; snd_bebob_stream_lock_changed() 988 wake_up(&bebob->hwdep_wait); snd_bebob_stream_lock_changed() 991 int snd_bebob_stream_lock_try(struct snd_bebob *bebob) snd_bebob_stream_lock_try() argument 995 spin_lock_irq(&bebob->lock); snd_bebob_stream_lock_try() 998 if (bebob->dev_lock_count < 0) { snd_bebob_stream_lock_try() 1004 if (bebob->dev_lock_count++ == 0) snd_bebob_stream_lock_try() 1005 snd_bebob_stream_lock_changed(bebob); snd_bebob_stream_lock_try() 1008 spin_unlock_irq(&bebob->lock); snd_bebob_stream_lock_try() 1012 void snd_bebob_stream_lock_release(struct snd_bebob *bebob) snd_bebob_stream_lock_release() argument 1014 spin_lock_irq(&bebob->lock); snd_bebob_stream_lock_release() 1016 if (WARN_ON(bebob->dev_lock_count <= 0)) snd_bebob_stream_lock_release() 1018 if (--bebob->dev_lock_count == 0) snd_bebob_stream_lock_release() 1019 snd_bebob_stream_lock_changed(bebob); snd_bebob_stream_lock_release() 1021 spin_unlock_irq(&bebob->lock); snd_bebob_stream_lock_release()
|
H A D | bebob_pcm.c | 9 #include "./bebob.h" 109 pcm_init_hw_params(struct snd_bebob *bebob, pcm_init_hw_params() argument 126 s = &bebob->tx_stream; pcm_init_hw_params() 127 formations = bebob->tx_stream_formations; pcm_init_hw_params() 130 s = &bebob->rx_stream; pcm_init_hw_params() 131 formations = bebob->rx_stream_formations; pcm_init_hw_params() 157 struct snd_bebob *bebob = substream->private_data; pcm_open() local 158 struct snd_bebob_rate_spec *spec = bebob->spec->rate; pcm_open() 163 err = snd_bebob_stream_lock_try(bebob); pcm_open() 167 err = pcm_init_hw_params(bebob, substream); pcm_open() 171 err = snd_bebob_stream_check_internal_clock(bebob, &internal); pcm_open() 180 amdtp_stream_pcm_running(&bebob->tx_stream) || pcm_open() 181 amdtp_stream_pcm_running(&bebob->rx_stream)) { pcm_open() 182 err = spec->get(bebob, &sampling_rate); pcm_open() 184 dev_err(&bebob->unit->device, pcm_open() 197 snd_bebob_stream_lock_release(bebob); pcm_open() 204 struct snd_bebob *bebob = substream->private_data; pcm_close() local 205 snd_bebob_stream_lock_release(bebob); pcm_close() 213 struct snd_bebob *bebob = substream->private_data; pcm_capture_hw_params() local 216 atomic_inc(&bebob->capture_substreams); pcm_capture_hw_params() 217 amdtp_stream_set_pcm_format(&bebob->tx_stream, pcm_capture_hw_params() 226 struct snd_bebob *bebob = substream->private_data; pcm_playback_hw_params() local 229 atomic_inc(&bebob->playback_substreams); pcm_playback_hw_params() 230 amdtp_stream_set_pcm_format(&bebob->rx_stream, pcm_playback_hw_params() 239 struct snd_bebob *bebob = substream->private_data; pcm_capture_hw_free() local 242 atomic_dec(&bebob->capture_substreams); pcm_capture_hw_free() 244 snd_bebob_stream_stop_duplex(bebob); pcm_capture_hw_free() 251 struct snd_bebob *bebob = substream->private_data; pcm_playback_hw_free() local 254 atomic_dec(&bebob->playback_substreams); pcm_playback_hw_free() 256 snd_bebob_stream_stop_duplex(bebob); pcm_playback_hw_free() 264 struct snd_bebob *bebob = substream->private_data; pcm_capture_prepare() local 268 err = snd_bebob_stream_start_duplex(bebob, runtime->rate); pcm_capture_prepare() 270 amdtp_stream_pcm_prepare(&bebob->tx_stream); pcm_capture_prepare() 277 struct snd_bebob *bebob = substream->private_data; pcm_playback_prepare() local 281 err = snd_bebob_stream_start_duplex(bebob, runtime->rate); pcm_playback_prepare() 283 amdtp_stream_pcm_prepare(&bebob->rx_stream); pcm_playback_prepare() 291 struct snd_bebob *bebob = substream->private_data; pcm_capture_trigger() local 295 amdtp_stream_pcm_trigger(&bebob->tx_stream, substream); pcm_capture_trigger() 298 amdtp_stream_pcm_trigger(&bebob->tx_stream, NULL); pcm_capture_trigger() 309 struct snd_bebob *bebob = substream->private_data; pcm_playback_trigger() local 313 amdtp_stream_pcm_trigger(&bebob->rx_stream, substream); pcm_playback_trigger() 316 amdtp_stream_pcm_trigger(&bebob->rx_stream, NULL); pcm_playback_trigger() 328 struct snd_bebob *bebob = sbstrm->private_data; pcm_capture_pointer() local 329 return amdtp_stream_pcm_pointer(&bebob->tx_stream); pcm_capture_pointer() 334 struct snd_bebob *bebob = sbstrm->private_data; pcm_playback_pointer() local 335 return amdtp_stream_pcm_pointer(&bebob->rx_stream); pcm_playback_pointer() 362 int snd_bebob_create_pcm_devices(struct snd_bebob *bebob) snd_bebob_create_pcm_devices() argument 367 err = snd_pcm_new(bebob->card, bebob->card->driver, 0, 1, 1, &pcm); snd_bebob_create_pcm_devices() 371 pcm->private_data = bebob; snd_bebob_create_pcm_devices() 373 "%s PCM", bebob->card->shortname); snd_bebob_create_pcm_devices()
|
H A D | bebob.c | 2 * bebob.c - a part of driver for BeBoB based devices 15 #include "bebob.h" 67 name_device(struct snd_bebob *bebob, unsigned int vendor_id) name_device() argument 69 struct fw_device *fw_dev = fw_parent_device(bebob->unit); name_device() 84 err = fw_csr_string(bebob->unit->directory, CSR_MODEL, name_device() 90 err = snd_bebob_read_quad(bebob->unit, INFO_OFFSET_HW_MODEL_ID, name_device() 96 err = snd_bebob_read_quad(bebob->unit, INFO_OFFSET_HW_MODEL_REVISION, name_device() 102 err = snd_bebob_read_block(bebob->unit, INFO_OFFSET_GUID, name_device() 107 strcpy(bebob->card->driver, "BeBoB"); name_device() 108 strcpy(bebob->card->shortname, model); name_device() 109 strcpy(bebob->card->mixername, model); name_device() 110 snprintf(bebob->card->longname, sizeof(bebob->card->longname), name_device() 113 data[0], data[1], dev_name(&bebob->unit->device), name_device() 128 struct snd_bebob *bebob = card->private_data; bebob_card_free() local 130 snd_bebob_stream_destroy_duplex(bebob); bebob_card_free() 131 fw_unit_put(bebob->unit); bebob_card_free() 133 kfree(bebob->maudio_special_quirk); bebob_card_free() 135 if (bebob->card_index >= 0) { bebob_card_free() 137 clear_bit(bebob->card_index, devices_used); bebob_card_free() 141 mutex_destroy(&bebob->mutex); bebob_card_free() 174 struct snd_bebob *bebob; bebob_probe() local 213 bebob = card->private_data; bebob_probe() 214 bebob->card_index = card_index; bebob_probe() 218 bebob->card = card; bebob_probe() 219 bebob->unit = fw_unit_get(unit); bebob_probe() 220 bebob->spec = spec; bebob_probe() 221 mutex_init(&bebob->mutex); bebob_probe() 222 spin_lock_init(&bebob->lock); bebob_probe() 223 init_waitqueue_head(&bebob->hwdep_wait); bebob_probe() 225 err = name_device(bebob, entry->vendor_id); bebob_probe() 231 err = snd_bebob_maudio_special_discover(bebob, true); bebob_probe() 234 err = snd_bebob_maudio_special_discover(bebob, false); bebob_probe() 236 err = snd_bebob_stream_discover(bebob); bebob_probe() 240 snd_bebob_proc_init(bebob); bebob_probe() 242 if ((bebob->midi_input_ports > 0) || bebob_probe() 243 (bebob->midi_output_ports > 0)) { bebob_probe() 244 err = snd_bebob_create_midi_devices(bebob); bebob_probe() 249 err = snd_bebob_create_pcm_devices(bebob); bebob_probe() 253 err = snd_bebob_create_hwdep_device(bebob); bebob_probe() 257 err = snd_bebob_stream_init_duplex(bebob); bebob_probe() 261 if (!bebob->maudio_special_quirk) { bebob_probe() 264 snd_bebob_stream_destroy_duplex(bebob); bebob_probe() 278 bebob->deferred_registration = true; bebob_probe() 279 fw_schedule_bus_reset(fw_parent_device(bebob->unit)->card, bebob_probe() 283 dev_set_drvdata(&unit->device, bebob); bebob_probe() 296 struct snd_bebob *bebob = dev_get_drvdata(&unit->device); bebob_update() local 298 if (bebob == NULL) bebob_update() 301 fcp_bus_reset(bebob->unit); bebob_update() 302 snd_bebob_stream_update_duplex(bebob); bebob_update() 304 if (bebob->deferred_registration) { bebob_update() 305 if (snd_card_register(bebob->card) < 0) { bebob_update() 306 snd_bebob_stream_destroy_duplex(bebob); bebob_update() 307 snd_card_free(bebob->card); bebob_update() 309 bebob->deferred_registration = false; bebob_update() 315 struct snd_bebob *bebob = dev_get_drvdata(&unit->device); bebob_remove() local 317 if (bebob == NULL) bebob_remove() 321 if (!completion_done(&bebob->bus_reset)) bebob_remove() 322 complete_all(&bebob->bus_reset); bebob_remove() 325 snd_card_free_when_closed(bebob->card); bebob_remove() 461 .name = "snd-bebob",
|
H A D | bebob_proc.c | 9 #include "./bebob.h" 39 struct snd_bebob *bebob = entry->private_data; proc_read_hw_info() local 46 if (snd_bebob_read_block(bebob->unit, 0, proc_read_hw_info() 75 struct snd_bebob *bebob = entry->private_data; proc_read_meters() local 76 struct snd_bebob_meter_spec *spec = bebob->spec->meter; proc_read_meters() 89 if (spec->get(bebob, buf, size) < 0) proc_read_meters() 108 struct snd_bebob *bebob = entry->private_data; proc_read_formation() local 114 formation = bebob->tx_stream_formations; proc_read_formation() 123 formation = bebob->rx_stream_formations; proc_read_formation() 135 struct snd_bebob *bebob = entry->private_data; proc_read_clock() local 136 struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate; proc_read_clock() 137 struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock; proc_read_clock() 141 if (rate_spec->get(bebob, &rate) >= 0) proc_read_clock() 145 if (clk_spec->get(bebob, &id) >= 0) proc_read_clock() 149 if (snd_bebob_stream_check_internal_clock(bebob, proc_read_clock() 153 bebob->sync_input_plug); proc_read_clock() 158 add_node(struct snd_bebob *bebob, struct snd_info_entry *root, const char *name, add_node() argument 163 entry = snd_info_create_card_entry(bebob->card, name, root); add_node() 167 snd_info_set_text_ops(entry, bebob, op); add_node() 172 void snd_bebob_proc_init(struct snd_bebob *bebob) snd_bebob_proc_init() argument 180 root = snd_info_create_card_entry(bebob->card, "firewire", snd_bebob_proc_init() 181 bebob->card->proc_root); snd_bebob_proc_init() 190 add_node(bebob, root, "clock", proc_read_clock); snd_bebob_proc_init() 191 add_node(bebob, root, "firmware", proc_read_hw_info); snd_bebob_proc_init() 192 add_node(bebob, root, "formation", proc_read_formation); snd_bebob_proc_init() 194 if (bebob->spec->meter != NULL) snd_bebob_proc_init() 195 add_node(bebob, root, "meter", proc_read_meters); snd_bebob_proc_init()
|
H A D | bebob_terratec.c | 9 #include "./bebob.h" 15 phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id) phase88_rack_clk_src_get() argument 20 err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext); phase88_rack_clk_src_get() 23 err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word); phase88_rack_clk_src_get() 41 phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id) phase24_series_clk_src_get() argument 43 return avc_audio_get_selector(bebob->unit, 0, 4, id); phase24_series_clk_src_get()
|
H A D | bebob_maudio.c | 9 #include "./bebob.h" 135 get_meter(struct snd_bebob *bebob, void *buf, unsigned int size) get_meter() argument 137 return snd_fw_transaction(bebob->unit, TCODE_READ_BLOCK_REQUEST, get_meter() 143 check_clk_sync(struct snd_bebob *bebob, unsigned int size, bool *sync) check_clk_sync() argument 152 err = get_meter(bebob, buf, size); check_clk_sync() 168 avc_maudio_set_special_clk(struct snd_bebob *bebob, unsigned int clk_src, avc_maudio_set_special_clk() argument 172 struct special_params *params = bebob->maudio_special_quirk; avc_maudio_set_special_clk() 176 if (amdtp_stream_running(&bebob->rx_stream) || avc_maudio_set_special_clk() 177 amdtp_stream_running(&bebob->tx_stream)) avc_maudio_set_special_clk() 197 err = fcp_avc_transaction(bebob->unit, buf, 12, buf, 12, avc_maudio_set_special_clk() 216 snd_ctl_notify(bebob->card, SNDRV_CTL_EVENT_MASK_VALUE, avc_maudio_set_special_clk() 225 special_stream_formation_set(struct snd_bebob *bebob) special_stream_formation_set() argument 235 struct special_params *params = bebob->maudio_special_quirk; special_stream_formation_set() 243 bebob->tx_stream_formations[i + 1].pcm = special_stream_formation_set() 245 bebob->tx_stream_formations[i + 1].midi = 1; special_stream_formation_set() 247 bebob->rx_stream_formations[i + 1].pcm = special_stream_formation_set() 249 bebob->rx_stream_formations[i + 1].midi = 1; special_stream_formation_set() 253 static int add_special_controls(struct snd_bebob *bebob); 255 snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814) snd_bebob_maudio_special_discover() argument 264 mutex_lock(&bebob->mutex); snd_bebob_maudio_special_discover() 266 bebob->maudio_special_quirk = (void *)params; snd_bebob_maudio_special_discover() 270 bebob->rx_stream.context = ERR_PTR(-1); snd_bebob_maudio_special_discover() 271 bebob->tx_stream.context = ERR_PTR(-1); snd_bebob_maudio_special_discover() 272 err = avc_maudio_set_special_clk(bebob, 0x03, 0x00, 0x00, 0x00); snd_bebob_maudio_special_discover() 274 dev_err(&bebob->unit->device, snd_bebob_maudio_special_discover() 279 err = add_special_controls(bebob); snd_bebob_maudio_special_discover() 283 special_stream_formation_set(bebob); snd_bebob_maudio_special_discover() 286 bebob->midi_input_ports = 1; snd_bebob_maudio_special_discover() 287 bebob->midi_output_ports = 1; snd_bebob_maudio_special_discover() 289 bebob->midi_input_ports = 2; snd_bebob_maudio_special_discover() 290 bebob->midi_output_ports = 2; snd_bebob_maudio_special_discover() 295 bebob->maudio_special_quirk = NULL; snd_bebob_maudio_special_discover() 297 mutex_unlock(&bebob->mutex); snd_bebob_maudio_special_discover() 302 static int special_get_rate(struct snd_bebob *bebob, unsigned int *rate) special_get_rate() argument 308 err = avc_general_get_sig_fmt(bebob->unit, rate, special_get_rate() 314 static int special_set_rate(struct snd_bebob *bebob, unsigned int rate) special_set_rate() argument 316 struct special_params *params = bebob->maudio_special_quirk; special_set_rate() 319 err = avc_general_set_sig_fmt(bebob->unit, rate, special_set_rate() 330 err = avc_general_set_sig_fmt(bebob->unit, rate, special_set_rate() 336 snd_ctl_notify(bebob->card, SNDRV_CTL_EVENT_MASK_VALUE, special_set_rate() 346 static int special_clk_get(struct snd_bebob *bebob, unsigned int *id) special_clk_get() argument 348 struct special_params *params = bebob->maudio_special_quirk; special_clk_get() 361 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_clk_ctl_get() local 362 struct special_params *params = bebob->maudio_special_quirk; special_clk_ctl_get() 369 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_clk_ctl_put() local 370 struct special_params *params = bebob->maudio_special_quirk; special_clk_ctl_put() 377 mutex_lock(&bebob->mutex); special_clk_ctl_put() 379 err = avc_maudio_set_special_clk(bebob, id, special_clk_ctl_put() 383 mutex_unlock(&bebob->mutex); special_clk_ctl_put() 413 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_sync_ctl_get() local 417 err = check_clk_sync(bebob, METER_SIZE_SPECIAL, &synced); special_sync_ctl_get() 445 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_dig_in_iface_ctl_get() local 446 struct special_params *params = bebob->maudio_special_quirk; special_dig_in_iface_ctl_get() 450 mutex_lock(&bebob->mutex); special_dig_in_iface_ctl_get() 452 err = avc_audio_get_selector(bebob->unit, 0x00, 0x04, special_dig_in_iface_ctl_get() 455 dev_err(&bebob->unit->device, special_dig_in_iface_ctl_get() 469 mutex_unlock(&bebob->mutex); special_dig_in_iface_ctl_get() 475 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_dig_in_iface_ctl_set() local 476 struct special_params *params = bebob->maudio_special_quirk; special_dig_in_iface_ctl_set() 488 mutex_lock(&bebob->mutex); special_dig_in_iface_ctl_set() 490 err = avc_maudio_set_special_clk(bebob, special_dig_in_iface_ctl_set() 505 err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); special_dig_in_iface_ctl_set() 507 dev_err(&bebob->unit->device, special_dig_in_iface_ctl_set() 511 special_stream_formation_set(bebob); special_dig_in_iface_ctl_set() 512 mutex_unlock(&bebob->mutex); special_dig_in_iface_ctl_set() 538 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_dig_out_iface_ctl_get() local 539 struct special_params *params = bebob->maudio_special_quirk; special_dig_out_iface_ctl_get() 540 mutex_lock(&bebob->mutex); special_dig_out_iface_ctl_get() 542 mutex_unlock(&bebob->mutex); special_dig_out_iface_ctl_get() 548 struct snd_bebob *bebob = snd_kcontrol_chip(kctl); special_dig_out_iface_ctl_set() local 549 struct special_params *params = bebob->maudio_special_quirk; special_dig_out_iface_ctl_set() 557 mutex_lock(&bebob->mutex); special_dig_out_iface_ctl_set() 559 err = avc_maudio_set_special_clk(bebob, special_dig_out_iface_ctl_set() 564 special_stream_formation_set(bebob); special_dig_out_iface_ctl_set() 568 mutex_unlock(&bebob->mutex); special_dig_out_iface_ctl_set() 580 static int add_special_controls(struct snd_bebob *bebob) add_special_controls() argument 583 struct special_params *params = bebob->maudio_special_quirk; add_special_controls() 586 kctl = snd_ctl_new1(&special_clk_ctl, bebob); add_special_controls() 587 err = snd_ctl_add(bebob->card, kctl); add_special_controls() 591 kctl = snd_ctl_new1(&special_sync_ctl, bebob); add_special_controls() 592 err = snd_ctl_add(bebob->card, kctl); add_special_controls() 597 kctl = snd_ctl_new1(&special_dig_in_iface_ctl, bebob); add_special_controls() 598 err = snd_ctl_add(bebob->card, kctl); add_special_controls() 602 kctl = snd_ctl_new1(&special_dig_out_iface_ctl, bebob); add_special_controls() 603 err = snd_ctl_add(bebob->card, kctl); add_special_controls() 620 special_meter_get(struct snd_bebob *bebob, u32 *target, unsigned int size) special_meter_get() argument 635 err = get_meter(bebob, (void *)buf, METER_SIZE_SPECIAL - 4); special_meter_get() 679 normal_meter_get(struct snd_bebob *bebob, u32 *buf, unsigned int size) normal_meter_get() argument 681 struct snd_bebob_meter_spec *spec = bebob->spec->meter; normal_meter_get() 689 err = get_meter(bebob, (void *)buf, size); normal_meter_get()
|
H A D | bebob.h | 2 * bebob.h - a part of driver for BeBoB based devices 56 int (*get)(struct snd_bebob *bebob, unsigned int *id); 59 int (*get)(struct snd_bebob *bebob, unsigned int *rate); 60 int (*set)(struct snd_bebob *bebob, unsigned int rate); 65 int (*get)(struct snd_bebob *bebob, u32 *target, unsigned int size); 206 int snd_bebob_stream_get_rate(struct snd_bebob *bebob, unsigned int *rate); 207 int snd_bebob_stream_set_rate(struct snd_bebob *bebob, unsigned int rate); 208 int snd_bebob_stream_check_internal_clock(struct snd_bebob *bebob, 210 int snd_bebob_stream_discover(struct snd_bebob *bebob); 211 int snd_bebob_stream_init_duplex(struct snd_bebob *bebob); 212 int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate); 213 void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob); 214 void snd_bebob_stream_update_duplex(struct snd_bebob *bebob); 215 void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob); 217 void snd_bebob_stream_lock_changed(struct snd_bebob *bebob); 218 int snd_bebob_stream_lock_try(struct snd_bebob *bebob); 219 void snd_bebob_stream_lock_release(struct snd_bebob *bebob); 221 void snd_bebob_proc_init(struct snd_bebob *bebob); 223 int snd_bebob_create_midi_devices(struct snd_bebob *bebob); 225 int snd_bebob_create_pcm_devices(struct snd_bebob *bebob); 227 int snd_bebob_create_hwdep_device(struct snd_bebob *bebob); 243 int snd_bebob_maudio_special_discover(struct snd_bebob *bebob, bool is1814);
|
H A D | bebob_focusrite.c | 9 #include "./bebob.h" 60 saffire_read_block(struct snd_bebob *bebob, u64 offset, saffire_read_block() argument 67 err = snd_fw_transaction(bebob->unit, TCODE_READ_BLOCK_REQUEST, saffire_read_block() 80 saffire_read_quad(struct snd_bebob *bebob, u64 offset, u32 *value) saffire_read_quad() argument 85 err = snd_fw_transaction(bebob->unit, TCODE_READ_QUADLET_REQUEST, saffire_read_quad() 97 saffire_write_quad(struct snd_bebob *bebob, u64 offset, u32 value) saffire_write_quad() argument 101 return snd_fw_transaction(bebob->unit, TCODE_WRITE_QUADLET_REQUEST, saffire_write_quad() 135 saffirepro_both_clk_freq_get(struct snd_bebob *bebob, unsigned int *rate) saffirepro_both_clk_freq_get() argument 140 err = saffire_read_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, &id); saffirepro_both_clk_freq_get() 151 saffirepro_both_clk_freq_set(struct snd_bebob *bebob, unsigned int rate) saffirepro_both_clk_freq_set() argument 162 return saffire_write_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, id); saffirepro_both_clk_freq_set() 170 saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) saffirepro_both_clk_src_get() argument 176 err = saffire_read_quad(bebob, SAFFIREPRO_OFFSET_CLOCK_SOURCE, &value); saffirepro_both_clk_src_get() 181 if (bebob->spec->clock->labels == saffirepro_10_clk_src_labels) saffirepro_both_clk_src_get() 202 saffire_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) saffire_both_clk_src_get() argument 207 err = saffire_read_quad(bebob, SAFFIRE_OFFSET_CLOCK_SOURCE, &value); saffire_both_clk_src_get() 223 saffire_meter_get(struct snd_bebob *bebob, u32 *buf, unsigned int size) saffire_meter_get() argument 225 struct snd_bebob_meter_spec *spec = bebob->spec->meter; saffire_meter_get() 239 err = saffire_read_block(bebob, offset, buf, size); saffire_meter_get()
|
H A D | bebob_yamaha.c | 9 #include "./bebob.h" 33 clk_src_get(struct snd_bebob *bebob, unsigned int *id) clk_src_get() argument 35 return avc_audio_get_selector(bebob->unit, 0, 4, id); clk_src_get()
|
H A D | bebob_command.c | 9 #include "./bebob.h"
|
/linux-4.1.27/sound/firewire/ |
H A D | Makefile | 13 obj-$(CONFIG_SND_BEBOB) += bebob/
|