From patchwork Mon May 24 03:13:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 447389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7830EC47082 for ; Mon, 24 May 2021 03:15:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 492EE6109E for ; Mon, 24 May 2021 03:15:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 492EE6109E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 95D621687; Mon, 24 May 2021 05:14:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 95D621687 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621826144; bh=OL+Nu6wWe1W0tzmT94RzmaskUu1EKvJIprnxU2amXrQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Fzs/s4y8+iyyF5T53GoH01zawPinZS1vjd9UWgN9vcz54SN7/d2aVrSdLwCYLPDcf qRLfkWjyRyeaRwvaayUAfcdnZVr4EijxrQoC36sN4TCDXbeCgU6KGrc2ySbaRu8Dkx TmgWy0ZhGVZndQlowFSVsm6cJvsX3kpmZNfbTGFo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 36106F802C4; Mon, 24 May 2021 05:14:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C75AF8021D; Mon, 24 May 2021 05:14:02 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1A7E6F8021D for ; Mon, 24 May 2021 05:13:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1A7E6F8021D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="NTlN3bBF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PrHClSgI" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 63D2E5C0118; Sun, 23 May 2021 23:13:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 23 May 2021 23:13:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=ZD34z3xpdPVs1 H4y9s7B5OeZw0txBY4ZaoNH067TNeM=; b=NTlN3bBFztM6RCFnBeJLDPIpqhseL 0Ucp5rNlb9hSnjnvmi7b99WGFVaboa37pI5aSlVzjX5jjG9Zx0vg982qJrW53x/j uDJ2g8voeWuZRIA7CB+EC9sghekdL6MCx5JWCpmEFdCKCP6ql8v+9RflDbnwXI/3 wAz/Fn4cCXfpRmoOxy6a3Sx5Np5+oamStpgkz0b8LhLPTIx7LNjq1LGAhON76s1f CpAGMkozYg0qaf+sbf+eqmTuMOQjdogSPksVqYnYnlgFTOPszU2rVL+J51WYJUKj Yj7vHcTZ9CqxdfEENhMENU4EcuPOle8ADE1llBGSEgFY63D+keUBOP08A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=ZD34z3xpdPVs1H4y9s7B5OeZw0txBY4ZaoNH067TNeM=; b=PrHClSgI P//C5cW0dcF1qTOCKLmrIDRB19u3NHjtIdQ/e7kP90TdrCn4lADJZCHtKpVq0Xpt kEK78fjhJwIu7ZNxQ9jfauaH0Gcy/0aiYZ8HcFBF+EVlijL5jf3jLSdkFua/ITEo bO2gYj3wvLpAyRkcUh7puZ1wC7VfQLV51w5b1/VvUQUnVeLoTRggxzZV5q5wiJUN XlBvHzhMGaRxzYiQLqEyuyAHjXm5594fLrLQkYbcxchj/RJzzxODBDbC9n40OEzE T2hM3ijD64VywPD7oOdlUaen+zoCReZTolTirxKmX/jBoLhj4AWY5e/l2ubEYtaA gHnhORq9N5NYCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 May 2021 23:13:52 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH v2 1/4] ALSA: firewire-lib: drop initial NODATA or empty packet Date: Mon, 24 May 2021 12:13:43 +0900 Message-Id: <20210524031346.50539-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210524031346.50539-1-o-takashi@sakamocchi.jp> References: <20210524031346.50539-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The devices based on BeBoB ASICs or the devices in Tascam FireWire series transfer a batch of NODATA packet or empty packet in the beginning of packet streaming. To avoid processing them, current implementation uses an option to skip processing content of tx packet during some initial cycles. However, the hard-coded number is not enough useful. This commit drops content of packets till the packet includes any event firstly. The function of option is to skip processing content of tx packet with any event after dropping. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 136 ++++++++++++++++++++++++---------- sound/firewire/amdtp-stream.h | 3 + 2 files changed, 100 insertions(+), 39 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 6dceb8cd6e0c..84608b856322 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -49,8 +49,10 @@ #define CIP_FMT_MASK 0x3f000000 #define CIP_FDF_MASK 0x00ff0000 #define CIP_FDF_SHIFT 16 +#define CIP_FDF_NO_DATA 0xff #define CIP_SYT_MASK 0x0000ffff #define CIP_SYT_NO_INFO 0xffff +#define CIP_NO_DATA ((CIP_FDF_NO_DATA << CIP_FDF_SHIFT) | CIP_SYT_NO_INFO) #define CIP_HEADER_SIZE (sizeof(__be32) * CIP_HEADER_QUADLETS) @@ -1198,6 +1200,99 @@ static void process_tx_packets_intermediately(struct fw_iso_context *context, u3 } } +static void drop_tx_packets_initially(struct fw_iso_context *context, u32 tstamp, + size_t header_length, void *header, void *private_data) +{ + struct amdtp_stream *s = private_data; + struct amdtp_domain *d = s->domain; + __be32 *ctx_header; + unsigned int count; + unsigned int events; + int i; + + if (s->packet_index < 0) + return; + + count = header_length / s->ctx_data.tx.ctx_header_size; + + // Attempt to detect any event in the batch of packets. + events = 0; + ctx_header = header; + for (i = 0; i < count; ++i) { + unsigned int payload_quads = + (be32_to_cpu(*ctx_header) >> ISO_DATA_LENGTH_SHIFT) / sizeof(__be32); + unsigned int data_blocks; + + if (s->flags & CIP_NO_HEADER) { + data_blocks = payload_quads / s->data_block_quadlets; + } else { + __be32 *cip_headers = ctx_header + IR_CTX_HEADER_DEFAULT_QUADLETS; + + if (payload_quads < CIP_HEADER_QUADLETS) { + data_blocks = 0; + } else { + payload_quads -= CIP_HEADER_QUADLETS; + + if (s->flags & CIP_UNAWARE_SYT) { + data_blocks = payload_quads / s->data_block_quadlets; + } else { + u32 cip1 = be32_to_cpu(cip_headers[1]); + + // NODATA packet can includes any data blocks but they are + // not available as event. + if ((cip1 & CIP_NO_DATA) == CIP_NO_DATA) + data_blocks = 0; + else + data_blocks = payload_quads / s->data_block_quadlets; + } + } + } + + events += data_blocks; + + ctx_header += s->ctx_data.tx.ctx_header_size / sizeof(__be32); + } + + drop_tx_packets(context, tstamp, header_length, header, s); + + if (events > 0) + s->ctx_data.tx.event_starts = true; + + // Decide the cycle count to begin processing content of packet in IR contexts. + { + unsigned int stream_count = 0; + unsigned int event_starts_count = 0; + unsigned int cycle = UINT_MAX; + + list_for_each_entry(s, &d->streams, list) { + if (s->direction == AMDTP_IN_STREAM) { + ++stream_count; + if (s->ctx_data.tx.event_starts) + ++event_starts_count; + } + } + + if (stream_count == event_starts_count) { + unsigned int next_cycle; + + list_for_each_entry(s, &d->streams, list) { + if (s->direction != AMDTP_IN_STREAM) + continue; + + next_cycle = increment_ohci_cycle_count(s->next_cycle, + d->processing_cycle.tx_init_skip); + if (cycle == UINT_MAX || + compare_ohci_cycle_count(next_cycle, cycle) > 0) + cycle = next_cycle; + + s->context->callback.sc = process_tx_packets_intermediately; + } + + d->processing_cycle.tx_start = cycle; + } + } +} + static void process_ctxs_in_domain(struct amdtp_domain *d) { struct amdtp_stream *s; @@ -1277,20 +1372,14 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, { struct amdtp_stream *s = private_data; struct amdtp_domain *d = s->domain; - const __be32 *ctx_header = header; - u32 cycle; // For in-stream, first packet has come. // For out-stream, prepared to transmit first packet s->callbacked = true; if (s->direction == AMDTP_IN_STREAM) { - cycle = compute_ohci_cycle_count(ctx_header[1]); - - context->callback.sc = drop_tx_packets; + context->callback.sc = drop_tx_packets_initially; } else { - cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size); - if (s == d->irq_target) context->callback.sc = irq_target_callback_skip; else @@ -1298,38 +1387,6 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, } context->callback.sc(context, tstamp, header_length, header, s); - - // Decide the cycle count to begin processing content of packet in IR contexts. - if (s->direction == AMDTP_IN_STREAM) { - unsigned int stream_count = 0; - unsigned int callbacked_count = 0; - - list_for_each_entry(s, &d->streams, list) { - if (s->direction == AMDTP_IN_STREAM) { - ++stream_count; - if (s->callbacked) - ++callbacked_count; - } - } - - if (stream_count == callbacked_count) { - unsigned int next_cycle; - - list_for_each_entry(s, &d->streams, list) { - if (s->direction != AMDTP_IN_STREAM) - continue; - - next_cycle = increment_ohci_cycle_count(s->next_cycle, - d->processing_cycle.tx_init_skip); - if (compare_ohci_cycle_count(next_cycle, cycle) > 0) - cycle = next_cycle; - - s->context->callback.sc = process_tx_packets_intermediately; - } - - d->processing_cycle.tx_start = cycle; - } - } } /** @@ -1409,6 +1466,7 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed, if (s->direction == AMDTP_IN_STREAM) { s->ctx_data.tx.max_ctx_payload_length = max_ctx_payload_size; s->ctx_data.tx.ctx_header_size = ctx_header_size; + s->ctx_data.tx.event_starts = false; } else { static const struct { unsigned int data_block; diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index 467d5021624b..d3ba2e1c1522 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -138,6 +138,9 @@ struct amdtp_stream { // Fixed interval of dbc between previos/current // packets. unsigned int dbc_interval; + + // The device starts multiplexing events to the packet. + bool event_starts; } tx; struct { // To generate CIP header. From patchwork Mon May 24 03:13:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 446482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57076C47080 for ; Mon, 24 May 2021 03:15:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A53B66109E for ; Mon, 24 May 2021 03:15:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A53B66109E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2990A1697; Mon, 24 May 2021 05:14:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2990A1697 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621826149; bh=Ke+2tzFzl9y9p1oDXkdXtn997PaoN3rOSMIHcfZ+oB4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lMeF+L+dn1gk/+I3d8wNhWPO31K6jJinr2J2A2B24Z1bQn7vTeu4aozmmRYuChwyS 4JbTOH6gasPFzghQjG4sviyXwf/iUZmicRZhs1tlbHnBD9o3+BQvkffgYrjXen8J1Q d4x/xCwTcQmnOVdOqUpNADpqncZJaUAkZ5P+UcAs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 081F1F80137; Mon, 24 May 2021 05:14:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1BA05F8042F; Mon, 24 May 2021 05:14:06 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A169CF80137 for ; Mon, 24 May 2021 05:13:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A169CF80137 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="P+6zasU+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="orbZHFLq" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D6DAA5C011B; Sun, 23 May 2021 23:13:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 23 May 2021 23:13:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=cGf7iftU6iqAz sGi2Vc+kz0f8+HmFkwkviHJ2L41SfQ=; b=P+6zasU+XpbRMtXrNcBBho8Nd2Ah6 koczi5RLAWv1tI6eE4//bXcnf5ZRBS8oa8RE00rXXg+RWAjnlx3xXBiwSrL1EdYQ R8voh4vYsbRhSE5p7Q0DBPI+SDbcZNz+rfZzxNeq60htW2tG+h397KN1AeKv0Vht OGAyc8fuP9uoZv8y6NfTReiL2TiWpK3c28owKYmZIlxE1WeyXPGODvgakeDnn71x ZEpzOHA020Mkmf/EuQgjOD6BBKJzInekJmtTPuAc34IS07RLUZSnV0vPMmtJl+gg 22TN6vHQOG22BPXME0AoozrPq0gvehx8Avd50QibTUAoD41hp4/rvRWdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=cGf7iftU6iqAzsGi2Vc+kz0f8+HmFkwkviHJ2L41SfQ=; b=orbZHFLq GLeW3gCDMrJk6UGDDScAE/UCJm51+7MolgiS2qHHmOXYRc7+VZRRPwcDsFp4QyF2 12fNOKXfNdfk3jMJmFZjOxU4dCHvfupPYLR0oPbHT5+oi47/LDSdld31YjF7UrKS qZimm91lw7l8xh5Ddh4iIkxz07uUedu2SQIhht2PYznRL/UkNMqkQz7UX6+xPc1u SQSl2TMdwX50Dxt1fk+OobAu4grlCAbMVNha7mm4ttzh80CRP8e9YMFSZf7L68GU kKSdlQktjclq1joT2sZaNpEStdBU2KHdQGh6x3bvqqgWjLf1i2a4CXvFpsLsaiSU OAsKaZcreFEMsw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 May 2021 23:13:53 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH v2 2/4] ALSA: firewire-lib: obsolete callbacked member Date: Mon, 24 May 2021 12:13:44 +0900 Message-Id: <20210524031346.50539-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210524031346.50539-1-o-takashi@sakamocchi.jp> References: <20210524031346.50539-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The member of callbacked in AMDTP stream structure is not used anymore. Instead, ready_processing member is used to wake up yielding task of user process. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 9 ++------- sound/firewire/amdtp-stream.h | 3 +-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 84608b856322..68ffbc33f692 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -110,7 +110,6 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, s->packet_index = 0; init_waitqueue_head(&s->ready_wait); - s->callbacked = false; s->fmt = fmt; s->process_ctx_payloads = process_ctx_payloads; @@ -1365,7 +1364,8 @@ static void irq_target_callback_skip(struct fw_iso_context *context, u32 tstamp, d->processing_cycle.rx_start = cycle; } -// this is executed one time. +// This is executed one time. For in-stream, first packet has come. For out-stream, prepared to +// transmit first packet. static void amdtp_stream_first_callback(struct fw_iso_context *context, u32 tstamp, size_t header_length, void *header, void *private_data) @@ -1373,10 +1373,6 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, struct amdtp_stream *s = private_data; struct amdtp_domain *d = s->domain; - // For in-stream, first packet has come. - // For out-stream, prepared to transmit first packet - s->callbacked = true; - if (s->direction == AMDTP_IN_STREAM) { context->callback.sc = drop_tx_packets_initially; } else { @@ -1536,7 +1532,6 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed, if ((s->flags & CIP_EMPTY_WITH_TAG0) || (s->flags & CIP_NO_HEADER)) tag |= FW_ISO_CONTEXT_MATCH_TAG0; - s->callbacked = false; s->ready_processing = false; err = fw_iso_context_start(s->context, -1, 0, tag); if (err < 0) diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index d3ba2e1c1522..34294776f9e8 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -183,8 +183,7 @@ struct amdtp_stream { // To start processing content of packets at the same cycle in several contexts for // each direction. - bool callbacked:1; - bool ready_processing:1; + bool ready_processing; wait_queue_head_t ready_wait; unsigned int next_cycle; From patchwork Mon May 24 03:13:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 447388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ABFAC47082 for ; Mon, 24 May 2021 03:16:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E5946115C for ; Mon, 24 May 2021 03:16:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E5946115C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E82E0169E; Mon, 24 May 2021 05:15:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E82E0169E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621826185; bh=2HKbwmLItnyLHxb6UNvNXTC2QmycER1Xe42JDNCx2w8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=IPhr5EdzE0lQflXe6C+5X5raDqmhr5Zr5JKjChVUFKnkHyKL9Ul4quTPb7uxcd1Bt W5fglsH9OMFFT0T8nfwQKhHhYy5gjQvrJHehESB4dPApELqBfa8egoaQQpApNz84Hr 8F0NwD/v4TzemdWG14Uc+zlQqEcDWRqkMyutorl0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9F59CF80260; Mon, 24 May 2021 05:14:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 72562F8042F; Mon, 24 May 2021 05:14:06 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 24858F8022B for ; Mon, 24 May 2021 05:13:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 24858F8022B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="vIH64yu4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ECnrdLFr" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5F3725C0114; Sun, 23 May 2021 23:13:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 23 May 2021 23:13:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=EIpaXupRyAsD2 1Jvw+kdoUnr/ocjFTK8yb9n6jnR8QI=; b=vIH64yu433W93fw7TUAuqJviYjzCH 2cXgoMePtQyE8SKnWzc9+JEpk21Ul3w4slPg1kjp7rfd+ZlT2ndpFp9AM4lp82ZC fm8/x8m41WlRDgDzDcD1klFnLpm9hHDZkZZm/nuM9pD6oaJzVDufIzc38kbo3kho 7oti2RsasKfpTtzwq3ogEGPV0kcGbB93sLjzwNodYtXLKZuFKxw6dS6E3cfdUrnH /WU36hNWHbtmd6QtNKySrY5u44H8lQ97dM0bRvQtaqLBwF13FcRyPcBNEo/KSmWB 1sbWXCRW3qk8mke32YVv3ZuOLAmalSPvX0SPYnfB0pzwUKb8ArvKCB1vA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=EIpaXupRyAsD21Jvw+kdoUnr/ocjFTK8yb9n6jnR8QI=; b=ECnrdLFr YFLjzZ5quwN8ECB7pAc3LwNucVfBA5rDClFTC78TsBN2PYbqLATiTplJ/UyI55lw 6jW/uYkVkzffdwe61HJSbHnCHN87Y2B7P/tNt4VqCv/TjVJql2768hT4OJ5jcrrI 7WnuWy+7sz2O3t2lUaAf+r6WhH4wMZR49lYkl8wVOu1N9F6aY4Z47Zuhh7vE5nz8 OYjLrbrz1WlU+Qk0YBl6TpAOU6RGKKbW8Hkj/+emVzeJgJWKqqE1hOy0izHR8cQY IYkOrEclSgJH/THTihBwfjkz5YSMydXeV7bEm5DUF40AM/9Q7THhZb04M/JJ54fY IeRekitGdzPNQA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 May 2021 23:13:55 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH v2 3/4] ALSA: bebob: cancel switching connection order Date: Mon, 24 May 2021 12:13:45 +0900 Message-Id: <20210524031346.50539-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210524031346.50539-1-o-takashi@sakamocchi.jp> References: <20210524031346.50539-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The order to establish connection seems to be meaningless. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_stream.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index df764171f84b..975670a29a72 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -623,7 +623,6 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (!amdtp_stream_running(&bebob->rx_stream)) { enum snd_bebob_clock_type src; - struct amdtp_stream *master, *slave; unsigned int curr_rate; unsigned int tx_init_skip_cycles; @@ -637,19 +636,11 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (err < 0) return err; - if (src != SND_BEBOB_CLOCK_TYPE_SYT) { - master = &bebob->tx_stream; - slave = &bebob->rx_stream; - } else { - master = &bebob->rx_stream; - slave = &bebob->tx_stream; - } - - err = start_stream(bebob, master); + err = start_stream(bebob, &bebob->rx_stream); if (err < 0) goto error; - err = start_stream(bebob, slave); + err = start_stream(bebob, &bebob->tx_stream); if (err < 0) goto error; From patchwork Mon May 24 03:13:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 446481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AE2DC47080 for ; Mon, 24 May 2021 03:16:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB9696101E for ; Mon, 24 May 2021 03:16:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB9696101E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5DC40836; Mon, 24 May 2021 05:15:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5DC40836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621826197; bh=hRatnXg7jqCuPaLs6n449MH3ZPeX9RziChkj871bb7A=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XBknahj1vWsO05m6G3KzfffBTpEYQnbgpKBeI+LGFyyOauOWt1A+8WtVhfyVzjNSh 81Rq2AREh21ji3rGnrWonCORW7JVrguNs2uJA7lPvy4LKv4ExsDgYLofiWjmCLgRoH HQzP/uFKDJ0uJgjqe06vjuUFTebbzOQBnr5zYTGg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32F70F8049C; Mon, 24 May 2021 05:14:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7A5AFF80137; Mon, 24 May 2021 05:14:06 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 71EE8F80260 for ; Mon, 24 May 2021 05:13:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 71EE8F80260 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="WkjZYZnS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vXLpxxiU" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B249B5C011B; Sun, 23 May 2021 23:13:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 23 May 2021 23:13:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=t1orP0CsnTksR Db98nAaKJLpKlhFXWDERsIQfcjRKl4=; b=WkjZYZnSAnA1T9sQQd5msLHn91i8J 4JpFf2USMcupe77ODEFGkQwMy+ELklBuCgJdmH17893dtj+Nrw2FmqiebCIAitOp F0/iyvGDEvoTndmI64ed7i/ofRQvwoi+IOT9M5fL8WJf+mJumOGRpFJsEV5B64nE iPjokSdBngXsE9snpN8nnOfm8PXRlLo2zTM8FQmqluUYrswlK+cnnKxTXowSrFsx Mo2TDCeqbr6wJnJ3i+g3hGzdK9T7+JWaSH1wBniQ18F1jyrHaMpOMZ54ljSedtXk ZHtDUX0bbaqK+3tatwQr30/Yiq7SL1H9/rnmAtT0iNGnrWc9pmgl7gpyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=t1orP0CsnTksRDb98nAaKJLpKlhFXWDERsIQfcjRKl4=; b=vXLpxxiU nSQ/a83g2WjPU/JHsmWj8DYdP+Hj6OlOVSbh/pB3Z/2CmGn68R0rWORzpgi7Vd6C Y/pZvmcRKFMbSUfKllqPG4uuX/ZN2BJW2ifynbN6MH5YW43RUJCDYs16rjUGuMRZ 7TXPvagF9D4HoUymB+kCBsm+aTfQ77w8WlP7KI5cbhy15fHRUikcUphCAgDn7jdc 7s/mgGTCYd9V7TJ/fRiCu0nPXe3Lr0qTaH+EErF7Vjlmgs6kXHzBad1l7cS3dvxa Q4GB3TA2daZKMHi7eo85OZHJQCO+qAKcgxUow0Tqb4SJmJUsAZlL6CuVsGH+GuIw OfoKg7r4p9KPCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejkedgfeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 May 2021 23:13:57 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH v2 4/4] ALSA: bebob: distinguish M-Audio ProFire Lightbridge quirk Date: Mon, 24 May 2021 12:13:46 +0900 Message-Id: <20210524031346.50539-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210524031346.50539-1-o-takashi@sakamocchi.jp> References: <20210524031346.50539-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In former commit, ALSA IEC 61883-1/6 packet streaming engine drops initial tx packets till the packet includes any event. This allows ALSA bebob driver not to give option to skip initial packet since the engine does drop the initial packet. However, M-Audio ProFire Lightbridge has a quirk to stop packet transmission after start multiplexing event to the packet. After several thousands cycles, it restart packet transmission again. This commit specializes the usage of initial skip option for the model. Additionally, this commit expands timeout enough to wait processing content of tx packet. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob.c | 10 +++++++++- sound/firewire/bebob/bebob.h | 1 + sound/firewire/bebob/bebob_stream.c | 12 +++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 90e98a6d1546..5938aa325f5e 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -64,6 +64,7 @@ static DECLARE_BITMAP(devices_used, SNDRV_CARDS); #define MODEL_MAUDIO_AUDIOPHILE_BOTH 0x00010060 #define MODEL_MAUDIO_FW1814 0x00010071 #define MODEL_MAUDIO_PROJECTMIX 0x00010091 +#define MODEL_MAUDIO_PROFIRELIGHTBRIDGE 0x000100a1 static int name_device(struct snd_bebob *bebob) @@ -210,6 +211,13 @@ do_registration(struct work_struct *work) if (err < 0) goto error; + // M-Audio ProFire Lightbridge has a quirk to transfer packets with discontinuous cycle or + // data block counter in early stage of packet streaming. The cycle span from the first + // packet with event is variable. + if (bebob->entry->vendor_id == VEN_MAUDIO1 && + bebob->entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE) + bebob->discontinuity_quirk = true; + err = snd_bebob_stream_init_duplex(bebob); if (err < 0) goto error; @@ -476,7 +484,7 @@ static const struct ieee1394_device_id bebob_id_table[] = { /* M-Audio NRV10 */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x00010081, &maudio_nrv10_spec), /* M-Audio, ProFireLightbridge */ - SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x000100a1, &spec_normal), + SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, MODEL_MAUDIO_PROFIRELIGHTBRIDGE, &spec_normal), /* Firewire 1814 */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, 0x00010070, NULL), /* bootloader */ SND_BEBOB_DEV_ENTRY(VEN_MAUDIO1, MODEL_MAUDIO_FW1814, diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index 4e0ed84adbee..cba6793bfdb2 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -115,6 +115,7 @@ struct snd_bebob { /* For BeBoB version quirk. */ unsigned int version; + bool discontinuity_quirk; struct amdtp_domain domain; }; diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 975670a29a72..91306da1bafe 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -7,7 +7,7 @@ #include "./bebob.h" -#define READY_TIMEOUT_MS 2500 +#define READY_TIMEOUT_MS 4000 /* * NOTE; @@ -644,12 +644,14 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (err < 0) goto error; - // Some devices transfer isoc packets with discontinuous counter in the beginning - // of packet streaming. - if (bebob->version < 2) - tx_init_skip_cycles = 3200; + if (!bebob->discontinuity_quirk) + tx_init_skip_cycles = 0; else tx_init_skip_cycles = 16000; + + // MEMO: In the early stage of packet streaming, the device transfers NODATA packets. + // After several hundred cycles, it begins to multiplex event into the packet with + // syt information. err = amdtp_domain_start(&bebob->domain, tx_init_skip_cycles); if (err < 0) goto error;