From patchwork Sun Oct 26 13:03:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 5154231 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F84BC11AC for ; Sun, 26 Oct 2014 13:23:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9EB220340 for ; Sun, 26 Oct 2014 13:23:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AD2D22028D for ; Sun, 26 Oct 2014 13:23:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id CBA572657C6; Sun, 26 Oct 2014 14:23:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A2E40265368; Sun, 26 Oct 2014 14:09:24 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C26DC26535D; Sun, 26 Oct 2014 14:09:22 +0100 (CET) Received: from smtp310.phy.lolipop.jp (smtp310.phy.lolipop.jp [210.157.22.78]) by alsa0.perex.cz (Postfix) with ESMTP id E5EDB260815 for ; Sun, 26 Oct 2014 14:04:15 +0100 (CET) Received: from smtp310.phy.lolipop.lan (HELO smtp310.phy.lolipop.jp) (172.17.1.10) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp310.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Sun, 26 Oct 2014 22:04:14 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp310.phy.lolipop.jp (LOLIPOP-Fsecure); Sun, 26 Oct 2014 22:03:30 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Sun, 26 Oct 2014 22:03:27 +0900 Message-Id: <1414328610-12729-27-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414328610-12729-1-git-send-email-o-takashi@sakamocchi.jp> References: <1414328610-12729-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org, ffado-devel@lists.sourceforge.net Subject: [alsa-devel] [PATCH 26/29] ALSA: oxfw: Add support AMDTP in-stream X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Previous commit adds support for some devices which can capture PCM samples. These devices transmit AMDTP stream in non-blocking mode. This commit adds functionality to handle AMDTP incoming stream. OXFW seems to have two quirks: - Transmits packets with non-zero dbc in its beginning - Transmits packets with wrong values in syt field For the first quirk, this commit adds CIP_SKIP_INIT_DBC_CHECK flag for incoming stream to skip first check of dbc. For the second quirk, this commit doesn't add duplex stream which Fireworks/BeBoB drivers use. So OXFW driver generates syt value for outgoing stream. Here are examples of a sequence of packets transmitted by Behringer F-Control Audio 202. There are differences between sequences of syt value when OXFW driver transfers outgoing stream or not. When driver gives no outgoing stream: Index Payload CIP_Header_0 CIP_Header_1 38 14 00020092 900103D1 39 12 00020098 900102FF 40 12 0002009D 9001027F 41 14 000200A2 90010396 42 14 000200A8 900102E8 43 12 000200AE 90010219 44 14 000200B3 90010331 45 12 000200B9 9001025F 46 14 000200BE 90010376 47 12 000200C4 900102A1 00 12 000200C9 9001023E 01 14 000200CE 90010358 02 12 000200D4 90010289 03 16 000200D9 900103A3 04 12 000200E0 900102DD 05 14 000200E5 900103F1 06 12 000200EB 90010335 07 12 000200F0 90010263 08 14 000200F5 9001037C 09 12 000200FB 900102AE When driver gives outgoing stream: Index Payload CIP_Header_0 CIP_Header_1 38 12 000200BD 900104A8 39 14 000200C2 900104A8 40 12 000200C8 900104AC 41 14 000200CD 900104A9 42 12 000200D3 900104B1 43 14 000200D8 900104A8 44 12 000200DE 900104AA 45 14 000200E3 900104A9 46 14 000200E9 900104AE 47 12 000200EF 900104A8 00 14 000200F4 900104AD 01 12 000200FA 900104A7 02 14 000200FF 900104A9 03 12 00020005 900104A9 04 14 0002000A 900104B1 05 12 00020010 900104AA 06 14 00020015 900104AD 07 12 0002001B 900104A7 08 14 00020020 900104AC 09 12 00020026 900104A7 Signed-off-by: Takashi Sakamoto --- sound/firewire/oxfw/oxfw-pcm.c | 6 +- sound/firewire/oxfw/oxfw-proc.c | 29 ++++ sound/firewire/oxfw/oxfw-stream.c | 277 +++++++++++++++++++++++++++++--------- sound/firewire/oxfw/oxfw.c | 23 +++- sound/firewire/oxfw/oxfw.h | 24 +++- 5 files changed, 283 insertions(+), 76 deletions(-) diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c index ab5991a..b2fd930 100644 --- a/sound/firewire/oxfw/oxfw-pcm.c +++ b/sound/firewire/oxfw/oxfw-pcm.c @@ -176,7 +176,7 @@ static int pcm_hw_free(struct snd_pcm_substream *substream) { struct snd_oxfw *oxfw = substream->private_data; - snd_oxfw_stream_stop_simplex(oxfw); + snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream); return snd_pcm_lib_free_vmalloc_buffer(substream); } @@ -187,8 +187,8 @@ static int pcm_prepare(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; int err; - err = snd_oxfw_stream_start_simplex(oxfw, runtime->rate, - runtime->channels); + err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, + runtime->rate, runtime->channels); if (err < 0) goto end; diff --git a/sound/firewire/oxfw/oxfw-proc.c b/sound/firewire/oxfw/oxfw-proc.c index 18e0305..604808e 100644 --- a/sound/firewire/oxfw/oxfw-proc.c +++ b/sound/firewire/oxfw/oxfw-proc.c @@ -44,6 +44,35 @@ static void proc_read_formation(struct snd_info_entry *entry, formation.rate, formation.pcm, formation.midi); } + if (!oxfw->has_output) + return; + + /* Show output. */ + err = snd_oxfw_stream_get_current_formation(oxfw, + AVC_GENERAL_PLUG_DIR_OUT, + &curr); + if (err < 0) + return; + + snd_iprintf(buffer, "Output Stream from device:\n"); + snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n"); + for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { + format = oxfw->tx_stream_formats[i]; + if (format == NULL) + continue; + + err = snd_oxfw_stream_parse_format(format, &formation); + if (err < 0) + continue; + + if (memcmp(&formation, &curr, sizeof(curr)) == 0) + flag = '*'; + else + flag = ' '; + + snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag, + formation.rate, formation.pcm, formation.midi); + } } static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root, diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c index e3ba398..aa7dbda 100644 --- a/sound/firewire/oxfw/oxfw-stream.c +++ b/sound/firewire/oxfw/oxfw-stream.c @@ -39,6 +39,22 @@ static const unsigned int avc_stream_rate_table[] = { [5] = 0x07, }; +static int set_rate(struct snd_oxfw *oxfw, unsigned int rate) +{ + int err; + + err = avc_general_set_sig_fmt(oxfw->unit, rate, + AVC_GENERAL_PLUG_DIR_IN, 0); + if (err < 0) + goto end; + + if (oxfw->has_output) + err = avc_general_set_sig_fmt(oxfw->unit, rate, + AVC_GENERAL_PLUG_DIR_OUT, 0); +end: + return err; +} + static int set_stream_format(struct snd_oxfw *oxfw, struct amdtp_stream *s, unsigned int rate, unsigned int pcm_channels) { @@ -47,8 +63,13 @@ static int set_stream_format(struct snd_oxfw *oxfw, struct amdtp_stream *s, enum avc_general_plug_dir dir; unsigned int i, err, len; - formats = oxfw->rx_stream_formats; - dir = AVC_GENERAL_PLUG_DIR_IN; + if (s == &oxfw->tx_stream) { + formats = oxfw->tx_stream_formats; + dir = AVC_GENERAL_PLUG_DIR_OUT; + } else { + formats = oxfw->rx_stream_formats; + dir = AVC_GENERAL_PLUG_DIR_IN; + } /* Seek stream format for requirements. */ for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { @@ -64,8 +85,7 @@ static int set_stream_format(struct snd_oxfw *oxfw, struct amdtp_stream *s, /* If assumed, just change rate. */ if (oxfw->assumed) - return avc_general_set_sig_fmt(oxfw->unit, rate, - AVC_GENERAL_PLUG_DIR_IN, 0); + return set_rate(oxfw, rate); /* Calculate format length. */ len = 5 + formats[i][4] * 2; @@ -74,53 +94,41 @@ static int set_stream_format(struct snd_oxfw *oxfw, struct amdtp_stream *s, if (err < 0) return err; - /* Some immediate requests just after changing format causes freezing. */ + /* Some immediate requests just after changing format cause freezing. */ msleep(100); return 0; } -int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw) +static void stop_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream) { - int err; - - err = cmp_connection_init(&oxfw->in_conn, oxfw->unit, - CMP_INPUT, 0); - if (err < 0) - goto end; + amdtp_stream_pcm_abort(stream); + amdtp_stream_stop(stream); - err = amdtp_stream_init(&oxfw->rx_stream, oxfw->unit, - AMDTP_OUT_STREAM, CIP_NONBLOCKING); - if (err < 0) { - amdtp_stream_destroy(&oxfw->rx_stream); - cmp_connection_destroy(&oxfw->in_conn); - } -end: - return err; -} - -static void stop_stream(struct snd_oxfw *oxfw) -{ - amdtp_stream_pcm_abort(&oxfw->rx_stream); - amdtp_stream_stop(&oxfw->rx_stream); - cmp_connection_break(&oxfw->in_conn); + if (stream == &oxfw->tx_stream) + cmp_connection_break(&oxfw->out_conn); + else + cmp_connection_break(&oxfw->in_conn); } -static int start_stream(struct snd_oxfw *oxfw, unsigned int rate, - unsigned int pcm_channels) +static int start_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream, + unsigned int rate, unsigned int pcm_channels) { u8 **formats; struct cmp_connection *conn; struct snd_oxfw_stream_formation formation; unsigned int i, midi_ports; - struct amdtp_stream *stream; int err; - stream = &oxfw->rx_stream; - formats = oxfw->rx_stream_formats; - conn = &oxfw->in_conn; + if (stream == &oxfw->rx_stream) { + formats = oxfw->rx_stream_formats; + conn = &oxfw->in_conn; + } else { + formats = oxfw->tx_stream_formats; + conn = &oxfw->out_conn; + } - /* Get stream formation */ + /* Get stream format */ for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { if (formats[i] == NULL) break; @@ -164,78 +172,212 @@ static int start_stream(struct snd_oxfw *oxfw, unsigned int rate, /* Wait first packet */ err = amdtp_stream_wait_callback(stream, CALLBACK_TIMEOUT); if (err < 0) - stop_stream(oxfw); + stop_stream(oxfw, stream); end: return err; } -int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw, unsigned int rate, - unsigned int pcm_channels) +static int check_connection_used_by_others(struct snd_oxfw *oxfw, + struct amdtp_stream *stream) +{ + struct cmp_connection *conn; + bool used; + int err; + + if (stream == &oxfw->tx_stream) + conn = &oxfw->out_conn; + else + conn = &oxfw->in_conn; + + err = cmp_connection_check_used(conn, &used); + if ((err >= 0) && used && !amdtp_stream_running(stream)) { + dev_err(&oxfw->unit->device, + "Connection established by others: %cPCR[%d]\n", + (conn->direction == CMP_OUTPUT) ? 'o' : 'i', + conn->pcr_index); + err = -EBUSY; + } + + return err; +} + +int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream) { + struct cmp_connection *conn; + enum cmp_direction c_dir; + enum amdtp_stream_direction s_dir; + int err; + + if (stream == &oxfw->tx_stream) { + conn = &oxfw->out_conn; + c_dir = CMP_OUTPUT; + s_dir = AMDTP_IN_STREAM; + } else { + conn = &oxfw->in_conn; + c_dir = CMP_INPUT; + s_dir = AMDTP_OUT_STREAM; + } + + mutex_lock(&oxfw->mutex); + + err = cmp_connection_init(conn, oxfw->unit, c_dir, 0); + if (err < 0) + goto end; + + err = amdtp_stream_init(stream, oxfw->unit, s_dir, CIP_NONBLOCKING); + if (err < 0) { + amdtp_stream_destroy(stream); + cmp_connection_destroy(conn); + goto end; + } + + /* OXFW starts to transmit packets with non-zero dbc. */ + if (stream == &oxfw->tx_stream) + oxfw->tx_stream.flags |= CIP_SKIP_INIT_DBC_CHECK; +end: + mutex_unlock(&oxfw->mutex); + return err; +} + +int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream, + unsigned int rate, unsigned int pcm_channels) +{ + struct amdtp_stream *opposite; struct snd_oxfw_stream_formation formation; + enum avc_general_plug_dir dir; + atomic_t *substreams, *opposite_substreams; int err = 0; + if (stream == &oxfw->tx_stream) { + substreams = &oxfw->capture_substreams; + opposite = &oxfw->rx_stream; + opposite_substreams = &oxfw->playback_substreams; + dir = AVC_GENERAL_PLUG_DIR_OUT; + } else { + substreams = &oxfw->playback_substreams; + opposite_substreams = &oxfw->capture_substreams; + + if (oxfw->has_output) + opposite = &oxfw->rx_stream; + else + opposite = NULL; + + dir = AVC_GENERAL_PLUG_DIR_IN; + } + + if (atomic_read(substreams) == 0) + goto end; + mutex_lock(&oxfw->mutex); + /* + * Considering JACK/FFADO streaming: + * TODO: This can be removed hwdep functionality becomes popular. + */ + err = check_connection_used_by_others(oxfw, stream); + if (err < 0) + goto end; + /* packet queueing error */ - if (amdtp_streaming_error(&oxfw->rx_stream)) - stop_stream(oxfw); + if (amdtp_streaming_error(stream)) + stop_stream(oxfw, stream); - err = snd_oxfw_stream_get_current_formation(oxfw, - AVC_GENERAL_PLUG_DIR_IN, - &formation); + err = snd_oxfw_stream_get_current_formation(oxfw, dir, &formation); if (err < 0) goto end; if ((formation.rate != rate) || (formation.pcm != pcm_channels)) { - stop_stream(oxfw); + if (opposite != NULL) { + err = check_connection_used_by_others(oxfw, opposite); + if (err < 0) + goto end; + stop_stream(oxfw, opposite); + } + stop_stream(oxfw, stream); - /* arrange sampling rate */ - err = set_stream_format(oxfw, &oxfw->rx_stream, rate, - pcm_channels); + err = set_stream_format(oxfw, stream, rate, pcm_channels); if (err < 0) { dev_err(&oxfw->unit->device, "fail to set stream format: %d\n", err); goto end; } + + /* Start opposite stream if needed. */ + if (opposite && !amdtp_stream_running(opposite) && + (atomic_read(opposite_substreams) > 0)) { + err = start_stream(oxfw, opposite, rate, 0); + if (err < 0) { + dev_err(&oxfw->unit->device, + "fail to restart stream: %d\n", err); + goto end; + } + } } - err = start_stream(oxfw, rate, pcm_channels); - if (err < 0) - dev_err(&oxfw->unit->device, - "fail to start stream: %d\n", err); + /* Start requested stream. */ + if (!amdtp_stream_running(stream)) { + err = start_stream(oxfw, stream, rate, pcm_channels); + if (err < 0) + dev_err(&oxfw->unit->device, + "fail to start stream: %d\n", err); + } end: mutex_unlock(&oxfw->mutex); return err; } -void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw) +void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream) { + if (((stream == &oxfw->tx_stream) && + (atomic_read(&oxfw->capture_substreams) > 0)) || + ((stream == &oxfw->rx_stream) && + (atomic_read(&oxfw->playback_substreams) > 0))) + return; + mutex_lock(&oxfw->mutex); - stop_stream(oxfw); + stop_stream(oxfw, stream); mutex_unlock(&oxfw->mutex); } -void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw) +void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream) { + struct cmp_connection *conn; + + if (stream == &oxfw->tx_stream) + conn = &oxfw->out_conn; + else + conn = &oxfw->in_conn; + mutex_lock(&oxfw->mutex); - stop_stream(oxfw); + stop_stream(oxfw, stream); - amdtp_stream_destroy(&oxfw->rx_stream); - cmp_connection_destroy(&oxfw->in_conn); + amdtp_stream_destroy(stream); + cmp_connection_destroy(conn); mutex_unlock(&oxfw->mutex); } -void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw) +void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream) { - if (cmp_connection_update(&oxfw->in_conn) < 0) { + struct cmp_connection *conn; + + if (stream == &oxfw->tx_stream) + conn = &oxfw->out_conn; + else + conn = &oxfw->in_conn; + + if (cmp_connection_update(conn) < 0) { mutex_lock(&oxfw->mutex); - stop_stream(oxfw); + stop_stream(oxfw, stream); mutex_unlock(&oxfw->mutex); } else { - amdtp_stream_update(&oxfw->rx_stream); + amdtp_stream_update(stream); } } @@ -420,7 +562,10 @@ static int fill_stream_formats(struct snd_oxfw *oxfw, if (buf == NULL) return -ENOMEM; - formats = oxfw->rx_stream_formats; + if (dir == AVC_GENERAL_PLUG_DIR_OUT) + formats = oxfw->tx_stream_formats; + else + formats = oxfw->rx_stream_formats; /* get first entry */ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES; @@ -493,11 +638,19 @@ int snd_oxfw_stream_discover(struct snd_oxfw *oxfw) "fail to get info for isoc/external in/out plugs: %d\n", err); goto end; - } else if (plugs[0] == 0) { + } else if ((plugs[0] == 0) && (plugs[1] == 0)) { err = -ENOSYS; goto end; } + /* use oPCR[0] if exists */ + if (plugs[1] > 0) { + err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_OUT, 0); + if (err < 0) + goto end; + oxfw->has_output = true; + } + /* use iPCR[0] if exists */ if (plugs[0] > 0) err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_IN, 0); diff --git a/sound/firewire/oxfw/oxfw.c b/sound/firewire/oxfw/oxfw.c index 397cdeb..f029288 100644 --- a/sound/firewire/oxfw/oxfw.c +++ b/sound/firewire/oxfw/oxfw.c @@ -126,8 +126,10 @@ static void oxfw_card_free(struct snd_card *card) struct snd_oxfw *oxfw = card->private_data; unsigned int i; - for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) + for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { + kfree(oxfw->tx_stream_formats[i]); kfree(oxfw->rx_stream_formats[i]); + } mutex_destroy(&oxfw->mutex); } @@ -174,13 +176,20 @@ static int oxfw_probe(struct fw_unit *unit, snd_oxfw_proc_init(oxfw); - err = snd_oxfw_stream_init_simplex(oxfw); + err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->rx_stream); if (err < 0) goto error; + if (oxfw->has_output) { + err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->tx_stream); + if (err < 0) + goto error; + } err = snd_card_register(card); if (err < 0) { - snd_oxfw_stream_destroy_simplex(oxfw); + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); + if (oxfw->has_output) + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); goto error; } dev_set_drvdata(&unit->device, oxfw); @@ -196,14 +205,18 @@ static void oxfw_bus_reset(struct fw_unit *unit) struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); fcp_bus_reset(oxfw->unit); - snd_oxfw_stream_update_simplex(oxfw); + snd_oxfw_stream_update_simplex(oxfw, &oxfw->rx_stream); + if (oxfw->has_output) + snd_oxfw_stream_update_simplex(oxfw, &oxfw->tx_stream); } static void oxfw_remove(struct fw_unit *unit) { struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); - snd_oxfw_stream_destroy_simplex(oxfw); + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); + if (oxfw->has_output) + snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); snd_card_disconnect(oxfw->card); snd_card_free_when_closed(oxfw->card); diff --git a/sound/firewire/oxfw/oxfw.h b/sound/firewire/oxfw/oxfw.h index 433e0c0..fd01178 100644 --- a/sound/firewire/oxfw/oxfw.h +++ b/sound/firewire/oxfw/oxfw.h @@ -43,10 +43,16 @@ struct snd_oxfw { const struct device_info *device_info; struct mutex mutex; + bool has_output; + u8 *tx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES]; u8 *rx_stream_formats[SND_OXFW_STREAM_FORMAT_ENTRIES]; bool assumed; + struct cmp_connection out_conn; struct cmp_connection in_conn; + struct amdtp_stream tx_stream; struct amdtp_stream rx_stream; + atomic_t capture_substreams; + atomic_t playback_substreams; bool mute; s16 volume[6]; @@ -87,12 +93,17 @@ int avc_general_inquiry_sig_fmt(struct fw_unit *unit, unsigned int rate, enum avc_general_plug_dir dir, unsigned short pid); -int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw); -int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw, unsigned int rate, - unsigned int pcm_channels); -void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw); -void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw); -void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw); +int snd_oxfw_stream_init_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream); +int snd_oxfw_stream_start_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream, + unsigned int rate, unsigned int pcm_channels); +void snd_oxfw_stream_stop_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream); +void snd_oxfw_stream_destroy_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream); +void snd_oxfw_stream_update_simplex(struct snd_oxfw *oxfw, + struct amdtp_stream *stream); struct snd_oxfw_stream_formation { unsigned int rate; @@ -104,6 +115,7 @@ int snd_oxfw_stream_parse_format(u8 *format, int snd_oxfw_stream_get_current_formation(struct snd_oxfw *oxfw, enum avc_general_plug_dir dir, struct snd_oxfw_stream_formation *formation); + int snd_oxfw_stream_discover(struct snd_oxfw *oxfw); int snd_oxfw_create_pcm(struct snd_oxfw *oxfw);