From patchwork Fri Nov 1 13:13:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 11223117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEB4E1599 for ; Fri, 1 Nov 2019 13:17:03 +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 5D6B4217F9 for ; Fri, 1 Nov 2019 13:17:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Bc8/DLKj"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="R4Z+OMPy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="O6Bgcfv6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D6B4217F9 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 97A2B211D; Fri, 1 Nov 2019 14:16:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 97A2B211D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572614221; bh=NBYAMqARmNGV0pGuo/8USA7GV+G5oxMkxIOJNZZ5eOw=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Bc8/DLKjXtp9YzxZtqiJ2EC6PvBGOtSMxA72tUskx4jNVJMS0DhJDwLr0JV3Y47x7 M6syL9LFW2GgMHhC17mvtA4dACidxu04Kqu00kt3KMorxqmTQt5tDZ69I4AwVHgQOt qYkzu0V2ChjZrdtnIwoBZgj93TEZ79AP7VEvTMy0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 25FA5F8060E; Fri, 1 Nov 2019 14:13:49 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id CA49CF80610; Fri, 1 Nov 2019 14:13:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C995BF80363 for ; Fri, 1 Nov 2019 14:13:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C995BF80363 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="R4Z+OMPy"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="O6Bgcfv6" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E97FE51A; Fri, 1 Nov 2019 09:13:29 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 01 Nov 2019 09:13:30 -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=fm2; bh=lRezLPOVDrLBj K9efvAw9sNrIn/q/TOPBhKJ6DDrteU=; b=R4Z+OMPyPshghI00qvGYWRnqBGSis hS4td+QdV+X97NeV8X8GlFl4wWhCS/MHs5LUR3TBdEqMOdKmmN0m+lVpyb3nfFoH pgCJTgUdpsvHDjHFDvQzUsmDtCit90FLpdkK/kt/Sn7v6xJmDLg/eES+Uvqpe2qr P5LzuNwUnzOJ/LBMR0z0fafIx7mQYaR0kSL0aqR6RMh4XQoYY8BKUEKbPCyPGYjg Pd7lZXhxx6AEHK6ZNp1flx+p2J4kSVavB1815JUXn8I9I+rJNceWxJkBTuq44yJr DUg3fmgoRnLYfeekr+qXTBj/43ItZ7KQznqJv35cL/tJWRIVTbYiNUGpQ== 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= fm1; bh=lRezLPOVDrLBjK9efvAw9sNrIn/q/TOPBhKJ6DDrteU=; b=O6Bgcfv6 9mMqUO6GnZIjhXLNoc2cGTWZaDkTdF3DHPaYkmlJMxnMyAxc9DIAbIRszgAxOeIE GpVrQ1rbelY0sHkWfAu5zMxvXlhzgdVHdnogXYzBB+IKnUjwcCnTiK3hZIB/w70/ qDsNswjfLXop4GyqWlKkIvuf22bKqPFn3XwtCtOdRmCM/Chvm+ANIspne7CM8smC t/sZO8/wWGPyUgfti/HUxlU5aVMfIBt8moEecSpfwRzqc1QpkxN+UroOYCNosuYn zebsAxbxV2mVOxY+CRQHsTbDH5kO+OGHjJAS/3170xAalzpdcX4La79SyXgVnO91 I5mIkvYbEBRc/w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtjedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecukfhppedugedrfedrjeehrddukedune curfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghh ihdrjhhpnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from workstation.flets-east.jp (ae075181.dynamic.ppp.asahi-net.or.jp [14.3.75.181]) by mail.messagingengine.com (Postfix) with ESMTPA id 5A2E13060062; Fri, 1 Nov 2019 09:13:28 -0400 (EDT) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 1 Nov 2019 22:13:21 +0900 Message-Id: <20191101131323.17300-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191101131323.17300-1-o-takashi@sakamocchi.jp> References: <20191101131323.17300-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/3] ALSA: bebob: expand sleep just after breaking connections for protocol version 1 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" As long as I investigated, some devices with BeBoB protocol version 1 can be freezed during several hundreds milliseconds after breaking connections. When accessing during the freezed time, any transaction is corrupted. In the worst case, the device is going to reboot. I can see this issue in: * Roland FA-66 * M-Audio FireWire Solo This commit expands sleep just after breaking connections to avoid the freezed time as much as possible. I note that the freeze/reboot behaviour is similar to below models: * Focusrite Saffire Pro 10 I/O * Focusrite Saffire Pro 26 I/O The above models certainly reboot after breaking connections. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_stream.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index f7f0db5aa811..1b264d0d63eb 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -415,15 +415,16 @@ static int make_both_connections(struct snd_bebob *bebob) return 0; } -static void -break_both_connections(struct snd_bebob *bebob) +static void break_both_connections(struct snd_bebob *bebob) { cmp_connection_break(&bebob->in_conn); cmp_connection_break(&bebob->out_conn); - /* These models seems to be in transition state for a longer time. */ - if (bebob->maudio_special_quirk != NULL) - msleep(200); + // These models seem to be in transition state for a longer time. When + // accessing in the state, any transactions is corrupted. In the worst + // case, the device is going to reboot. + if (bebob->version < 2) + msleep(600); } static int From patchwork Fri Nov 1 13:13:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 11223113 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D0761599 for ; Fri, 1 Nov 2019 13:15:28 +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 C1AA8208E3 for ; Fri, 1 Nov 2019 13:15:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="FkZY45av"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="R42TaIFB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CL+ioZG0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1AA8208E3 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 EB5722142; Fri, 1 Nov 2019 14:14:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EB5722142 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572614125; bh=fokyf7KQEMMzH/XwA2Tvk6TOdYL9Vty8TxzfsPSraeU=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FkZY45av/7X2poda69tUfYa5Jn4jId+dKpeowzJC4CatvFt2H4z7Nn+G+0xQJlfMs nm7SSG4MP3NAhGD1b9Vdx+YsRziaMi2aZORFa+dWvJDwTQ4i5sEHiBva3BSQUgVwUw CJEIEs4HNv0gdq6Im4QygrwMgvAPphnkCzW66Fvs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3B3E4F805AE; Fri, 1 Nov 2019 14:13:42 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id C9746F80120; Fri, 1 Nov 2019 14:13:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A25E1F80120 for ; Fri, 1 Nov 2019 14:13:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A25E1F80120 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="R42TaIFB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CL+ioZG0" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 75CCD5B1; Fri, 1 Nov 2019 09:13:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 01 Nov 2019 09:13:31 -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=fm2; bh=WHyKWXobZuX8t vqw34vRlKPWgKIcrLVnJLgeng7GMys=; b=R42TaIFBjmP1m6cU1dnkWSquiNFaC mjMFrI/vcsU93lneUwZ8kGf98ZAFB1SIHetXcW/T0vZ+5ctoe6zmAqoMODTixXTj lKtzDkwJsiEF1rsOSyAldEvKQk5ab3is0T8DxEwTStNbfMNxft2yHcT22+XuPi1K qRw9g/ACPpA8IzRJOHFIvdrTgGnrSmavRSwlY6Fam7Y6ZNBz1mzK2DTvj2HHYeDm FF3z1xSiEjxQsK3YTvk8gdx8PRSWxZy0aHWf91ytksSvSpsVgznxJ+/gc3ICRxQh IffyrQA13ICy+7xN7o4QKK9UKNnc/WeRH+zI+OkYCK09jpqdsEa4ctSCw== 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= fm1; bh=WHyKWXobZuX8tvqw34vRlKPWgKIcrLVnJLgeng7GMys=; b=CL+ioZG0 ss1hlNn9s9YEkN1Eack6+p8SHNsUFW0L2H9V+UR7M/Yv253LSfYSSfjLWA+8S3ao hnI/IqLOyznSeM3FGe/yxHnP6exvkrqfYarp6T3gxuWtgQS2cw45C4srYaVV8o4Z E9auX4BHsYrGyIwQo0Ix2+12Bl9zmYZkQLlI4wDKc+IXt0tKahkUL6y7hitIPegK ecuPPZBJw0dygXMcR6vuX1lZtDt9CTU9VvZkj2Oun8RF3//T3SW8Sop9TNMTkg86 xYvHNUktdGq3Ag4YZ5W7a1Y+JCErRc+HYDzEx7eCjzsr8URzSnPJ7btbXgF87rj+ 5Q9DAEgL8jA9Aw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtjedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecukfhppedugedrfedrjeehrddukedune curfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghh ihdrjhhpnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from workstation.flets-east.jp (ae075181.dynamic.ppp.asahi-net.or.jp [14.3.75.181]) by mail.messagingengine.com (Postfix) with ESMTPA id CC450306005B; Fri, 1 Nov 2019 09:13:29 -0400 (EDT) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 1 Nov 2019 22:13:22 +0900 Message-Id: <20191101131323.17300-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191101131323.17300-1-o-takashi@sakamocchi.jp> References: <20191101131323.17300-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/3] ALSA: bebob: expand delay of start for IR context just for version 3 firmware 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" As long as I investigated, there's some cases about the delay for device between establishing OUTPUT_PLUG and transmitting first isoc packet. For devices which support BeBoB protocol version 1 can transmit the packet within several hundred milliseconds, while for devices which support BeBoB protocol version 3 can transmit the packet within 2 seconds. Devices with protocol version 1: * Edirol FA-66 * Yamaha GO46 * Terratec Phase x24 FW * M-Audio FireWire AudioPhile * M-Audio FireWire Solo * M-Audio FireWire 1814 * M-Audio FireWire 410 * Focusrite Saffire Pro 26 I/O Devices with protocol version 3: * M-Audio Profire Lightbridge * Behringer FCA610 * Phonic Firefly 202 At present ALSA bebob driver postpones starting IR context during 1.5 sec for all of supported devices. The delay is too long for devices with protocol version 1, while it's not enough for devices with protocol version 3. This commit improves the delay for these protocols. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_stream.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 1b264d0d63eb..895a113635af 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -7,7 +7,7 @@ #include "./bebob.h" -#define CALLBACK_TIMEOUT 2000 +#define CALLBACK_TIMEOUT 2500 #define FW_ISO_RESOURCE_DELAY 1000 /* @@ -639,6 +639,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (!amdtp_stream_running(&bebob->rx_stream)) { unsigned int curr_rate; + unsigned int ir_delay_cycle; if (bebob->maudio_special_quirk) { err = bebob->spec->rate->get(bebob, &curr_rate); @@ -660,13 +661,18 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) // The device postpones start of transmission mostly for 1 sec // after receives packets firstly. For safe, IR context starts - // 1.5 sec (=12000 cycles) later. This is within 2.0 sec - // (=CALLBACK_TIMEOUT). + // 0.4 sec (=3200 cycles) later to version 1 or 2 firmware, + // 2.0 sec (=16000 cycles) for version 3 firmware. This is + // within 2.5 sec (=CALLBACK_TIMEOUT). // Furthermore, some devices transfer isoc packets with // discontinuous counter in the beginning of packet streaming. // The delay has an effect to avoid detection of this // discontinuity. - err = amdtp_domain_start(&bebob->domain, 12000); + if (bebob->version < 2) + ir_delay_cycle = 3200; + else + ir_delay_cycle = 16000; + err = amdtp_domain_start(&bebob->domain, ir_delay_cycle); if (err < 0) goto error; From patchwork Fri Nov 1 13:13:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 11223111 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E3F31599 for ; Fri, 1 Nov 2019 13:14:33 +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 603CD208E3 for ; Fri, 1 Nov 2019 13:14:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="e+UDgrcw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="doXTU6v4"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="yoE9yTp7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 603CD208E3 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 151062091; Fri, 1 Nov 2019 14:13:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 151062091 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1572614070; bh=2zdGsF7So1CJQx03rdOsxt4S5PhC6jx+Fsx8wZw1aRE=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=e+UDgrcw4AApiU5cr+FcaAAhQcu8pDBqWK9/+1HSevXXqBt+ReAvkUCE4eGMCJlTI XlkvioyQi8K/Rxpk7KcTyYWLagBUgCWehw6cVlHZrEgTcBjuQfKCMIsaLza1qPPRCX a7sqkNrl5VnorKKv8sQsLsD4cinqwYTC42ItnUxE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6356CF8015A; Fri, 1 Nov 2019 14:13:39 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF331F8015A; Fri, 1 Nov 2019 14:13:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,PRX_BODY_65,SPF_HELO_PASS,SPF_PASS,SURBL_BLOCKED,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 43C52F8015A for ; Fri, 1 Nov 2019 14:13:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 43C52F8015A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="doXTU6v4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="yoE9yTp7" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id F2F2C53F; Fri, 1 Nov 2019 09:13:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 01 Nov 2019 09:13:33 -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=fm2; bh=ym4LnTXJMcQh8 96GFTBtagLoosqChgAga6wpKleqTYQ=; b=doXTU6v4Dglg3TzwPR3fxrEx5iP5h 5S/uNLvcOd048BeyyCCmJKFbhW5z5+cHFDIi0p7+XSXJ7p+7qKLT+XM0mRf36FcM wObr4WHIfFiDuqWoagf4j5yoe7Ejl25WHOlJppe96K3nu7KMIrwsJ5i9Cue0njKn dKnL1pLplHIOMnrIFOAOuxLsd4CvtSnOEbq+6llguFkp8xQD7vJUikKRMAHNFHrd N18HZI59pQKjCiqwQ329ikMF6friauKFz/l6sk37nTDz4pq6QZTQN4pJdVXGvmJG kyAwOGUNI3+eSS7iDbUKAFLPsdm4TJiP9gzpBCath2LGnghuUjmtkH2RQ== 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= fm1; bh=ym4LnTXJMcQh896GFTBtagLoosqChgAga6wpKleqTYQ=; b=yoE9yTp7 4VYwzMcLpJWpYyiTzsCJ3/3dxzw02L+ls24LrQ5f7Yah0NSJiBCq5tC8Wz9tihMa Y5TsRtMH1NPHLt1bMIy/AhGjAQxIIyNIpu99SYrrcYSdV534yO5jmHzPcX8nUrDx /NsM8W/KLZ7HbA2OeYaWNfyQQ4RO8g2N3hD6k4Dzd4dfIsTp5C7K3vumAi/wL+gJ hQ29Ku55NqEru3G6D2waqLD+4Mr8zhUqVPJkcaE73l+xSDZFGxNWcXnCr5fgcghZ FzIU/wcsFB8yxZJdDzn81pmKFXWGI8Qin5aDJQBdL7vhE5bP7tr0qGcn6AbYI3kp N7GEvAlIwSw3fg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtjedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecukfhppedugedrfedrjeehrddukedune curfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrghkrghmohgttghh ihdrjhhpnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from workstation.flets-east.jp (ae075181.dynamic.ppp.asahi-net.or.jp [14.3.75.181]) by mail.messagingengine.com (Postfix) with ESMTPA id 4BA5B3060057; Fri, 1 Nov 2019 09:13:31 -0400 (EDT) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 1 Nov 2019 22:13:23 +0900 Message-Id: <20191101131323.17300-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191101131323.17300-1-o-takashi@sakamocchi.jp> References: <20191101131323.17300-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 3/3] ALSA: bebob: link the order of establishing connections and Syt-match clock mode 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" Originally BeBeB ASICs and firmware supports clock mode to synchronizing to syt field of received isoc packet. This mode is known as 'SYT Match' slightly described in IEC 61883-6 (but no detail mechanisms). In this mode, drivers can control sampling clock in device. Driver for Windows and macOS uses this feature to perform synchronization for devices on the same bus. In this mode, a plug of Music subunit for synchronization is connected to a plug of isoc unit for incoming packet streaming, then the order to establish connections is INPUT_PLUG first, OUTPUT_PLUG second. This commit implements the above. Actually each device works with its own clock for sampling, therefore the original design is hardly implemented to vendor's products. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_stream.c | 51 +++++++++++++---------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 895a113635af..bbae04793c50 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -398,23 +398,6 @@ check_connection_used_by_others(struct snd_bebob *bebob, struct amdtp_stream *s) return err; } -static int make_both_connections(struct snd_bebob *bebob) -{ - int err = 0; - - err = cmp_connection_establish(&bebob->out_conn); - if (err < 0) - return err; - - err = cmp_connection_establish(&bebob->in_conn); - if (err < 0) { - cmp_connection_break(&bebob->out_conn); - return err; - } - - return 0; -} - static void break_both_connections(struct snd_bebob *bebob) { cmp_connection_break(&bebob->in_conn); @@ -427,8 +410,7 @@ static void break_both_connections(struct snd_bebob *bebob) msleep(600); } -static int -start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) +static int start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) { struct cmp_connection *conn; int err = 0; @@ -438,18 +420,19 @@ start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) else conn = &bebob->out_conn; - /* channel mapping */ + // channel mapping. if (bebob->maudio_special_quirk == NULL) { err = map_data_channels(bebob, stream); if (err < 0) - goto end; + return err; } - // start amdtp stream. - err = amdtp_domain_add_stream(&bebob->domain, stream, - conn->resources.channel, conn->speed); -end: - return err; + err = cmp_connection_establish(conn); + if (err < 0) + return err; + + return amdtp_domain_add_stream(&bebob->domain, stream, + conn->resources.channel, conn->speed); } static int init_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) @@ -638,6 +621,8 @@ 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 ir_delay_cycle; @@ -647,15 +632,23 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) return err; } - err = make_both_connections(bebob); + err = snd_bebob_stream_get_clock_src(bebob, &src); if (err < 0) return err; - err = start_stream(bebob, &bebob->rx_stream); + 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); if (err < 0) goto error; - err = start_stream(bebob, &bebob->tx_stream); + err = start_stream(bebob, slave); if (err < 0) goto error;