From patchwork Fri Jun 11 03:50:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 459183 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 DEB1FC4743D for ; Fri, 11 Jun 2021 03:51:50 +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 3B3B8610E6 for ; Fri, 11 Jun 2021 03:51:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B3B8610E6 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 B4AF31833; Fri, 11 Jun 2021 05:50:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B4AF31833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623383508; bh=zpwedSey2iPVaQsFw7XYv1YPXgYvYPWEzyBJJj3K8HM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=l91o72j+5cbn6nEvJ7YuemRyKbHZEKYhqyDVLxUf1vf25XgA9763h2A3K1zK+TOkt H+NvSIlOFj9wux2OwRkduc0m64+IK7Ht76dkrDjhDpI6Zx3cbWc6ZeiksajNtEl/Ij IrdQYqqTZSvU5/WOk38PaSz+9h4zWYH97f6Ynn60= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31CC6F804BD; Fri, 11 Jun 2021 05:50:25 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AE9D6F804B4; Fri, 11 Jun 2021 05:50:22 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E8054F802A0 for ; Fri, 11 Jun 2021 05:50:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E8054F802A0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="RpcHZ+LX"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="p5wN97c4" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 665021943; Thu, 10 Jun 2021 23:50:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 10 Jun 2021 23:50:11 -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=dASBS8SIufRV3 e4q6dP0/X+IyHfWlNItgGggAGbji4E=; b=RpcHZ+LXEXzpColXPScqDRQgpEpTI y0ZV1w53dy9BOB4lbxbbXplc3lbkTHCEs14Z4aXei3A1DgmKEJiWKZO3OKBm3unC 53+pHGyJwAgzhTRssZ5RYa0YFms3ys/FVt6MG0VHBeSVvuymyvD4sGNcvpNSnbZj bJ/ZC9B3VWO5rIQdRhTmH0YfQFqGk7n1ctflHkD4qA5hN9ScR6r2OjzLymvwg3XK kL+QqcSi2FLwI0mpt+9X1gQteYnbVUysh5/7zgrK2anP+KraRV2vCMmkFiq77gue EONeeaYDTOZ/uBNB4POUahntSCJZrqzuXKjx/eEA/d3iAs67QXnmJnCKg== 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= fm3; bh=dASBS8SIufRV3e4q6dP0/X+IyHfWlNItgGggAGbji4E=; b=p5wN97c4 qxstyKNicPWqlaNeIn2px8rcpMpU2qht2WKxsq9+ZcRB5Ib3Ypv8VhA71lKmPBYd 4TbJePpDclWyA357dEmMpmj788Ryv1l+ZdLNCc14rXJA7IS3Ipu1ZbZApn9z1SRf U5QTaoBKtphF4VUby7hp/Pm6axVFHgRCNMghM/0PKzAOteLccNDP00WsC4kXS2TE uR0eVQtjpJUvqPH3PT/ghFrwrb3eI40Xj38ATGil/pP6ik11w6oIwFv+xPKqhA6W oWMKjkwbjrnGmMp8Fyw2PdNQrV2A7Bfz+zx7pB5AOZWHaI3Nz7YiQn+UqKZnHmen RaCDtG4jY74gKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduiedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihessh grkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Jun 2021 23:50:09 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 1/3] ALSA: bebob: dismiss sleep after breaking connections Date: Fri, 11 Jun 2021 12:50:01 +0900 Message-Id: <20210611035003.26852-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210611035003.26852-1-o-takashi@sakamocchi.jp> References: <20210611035003.26852-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 a commit d3eabe939aee ("ALSA: bebob: expand sleep just after breaking connections for protocol version 1"), a workaround was added for a quirk of freeze in BeBoB protocol version 1. As long as seeing with sequence replay for media clock recovery, the quirk disappears. This commit removes the workaround. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob_stream.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 470c2b70cbfa..6d47c25654e6 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -401,12 +401,6 @@ static void break_both_connections(struct snd_bebob *bebob) { cmp_connection_break(&bebob->in_conn); cmp_connection_break(&bebob->out_conn); - - // 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 start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) From patchwork Fri Jun 11 03:50:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 458556 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 61D7DC4743D for ; Fri, 11 Jun 2021 03:51:46 +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 B270D61357 for ; Fri, 11 Jun 2021 03:51:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B270D61357 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 2E5341840; Fri, 11 Jun 2021 05:50:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2E5341840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623383504; bh=qkScbxKvt+M+ESpOsuf3Ww6xk+asGsP/3RbV+0iIbEY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LMHHzR6aIXdzaogXhGJL9EyYPtuuGLFpHr/Rpda9fxZtRvjCiMAUm9twQ4MagNjOf Iggx6lrNRfMoygMJ0wyLEY7TvHn/tDXd8qZt6ujshZuTdZ+kUPvobe0EveiPYI8eRa iBQ6odbcEX9ByLTNr9yc9Nn4JPZSSWNcQciGMCu8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D7910F802A0; Fri, 11 Jun 2021 05:50:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8D4C8F80276; Fri, 11 Jun 2021 05:50:22 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E16E5F80276 for ; Fri, 11 Jun 2021 05:50:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E16E5F80276 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="pflvsn7R"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="UoMDAL+o" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A73741B98; Thu, 10 Jun 2021 23:50:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 10 Jun 2021 23:50:13 -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=CMi6nwQXnQReD 0V1CCZ75333nlU6hpE84b1egm3r2yM=; b=pflvsn7RjmHDOZmSKabXJc2vV7pTg SJucmYxBH2Jn36EcdjUOl+ikOe4bShNKXAHku4C3X1sfacHdtN4Q1erKUgT6RDun qX49nf7u5+68u6BWPn1IgQXb6GeZIz+TIJB9JhimgZwWqlKzZ5vbHHh5HUP3Gf05 0w0PoA0tEzzJ2u9URgoGswaM8ZqPw6vg/iUP3vM7d13EoUDbb5BePnb1DdJbnqEI oLOYEuF0LKNfcyO8gRHziMbarDSrZqCgn5a+aYPu+GWjhK8FtYR7ZOnNqvcvECxK 4Jw2xo1lYYvV0cotSKNCUWgwuI9FI4KTz3cIjW7DG5mnOdaRKoM7DJUlg== 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= fm3; bh=CMi6nwQXnQReD0V1CCZ75333nlU6hpE84b1egm3r2yM=; b=UoMDAL+o uKq5m+kfRHEYRraw4XIWvNj1S6/acW5AgtZsZU0vbZ1qFGiDoR2THHbPxdcSO5Js Gf7c+IBWYkBrPA8GVI6la9t8c0gx0ejlFD+S2CMnzOQLO2+CWT3qwyk2MCwwcgeV mLwTm1LE7G5xBxrAgBGsv0TsdfR9JNyJVxl7zV0hgvuux9VJ7c3GvgZci+PsRP82 XDYX9qdgt1undeo9wysJEuyY15mq7Ij1Bvh0IhD9fEn+z9cqARnobL2c0dU+XxhM tksdQ8D4XBLGUDchCBJr+TlIoXNNnC0LJPDUY7Q02Gwm5gembrpmUQ1sVqmwXNwc ODmkdKea4VnWSw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduiedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihessh grkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Jun 2021 23:50:12 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 2/3] ALSA: bebob: delete workaround for protocol version 3 Date: Fri, 11 Jun 2021 12:50:02 +0900 Message-Id: <20210611035003.26852-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210611035003.26852-1-o-takashi@sakamocchi.jp> References: <20210611035003.26852-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 a commit c4d860a0d256 ("ALSA: bebob: loosen up severity of checking continuity for BeBoB v3 quirk"), a workaround was added for the quirk in BeBoB protocol version 3 against the discontinuity of data block counter. As long as seeing with sequence replay for media clock recovery, such quirk disappears. This commit deletes the workaround. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob.c | 7 ------- sound/firewire/bebob/bebob.h | 2 -- sound/firewire/bebob/bebob_stream.c | 8 -------- 3 files changed, 17 deletions(-) diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index e7dd112c31c5..25222cc27e43 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -75,7 +75,6 @@ name_device(struct snd_bebob *bebob) u32 hw_id; u32 data[2] = {0}; u32 revision; - u32 version; int err; /* get vendor name from root directory */ @@ -108,12 +107,6 @@ name_device(struct snd_bebob *bebob) if (err < 0) goto end; - err = snd_bebob_read_quad(bebob->unit, INFO_OFFSET_BEBOB_VERSION, - &version); - if (err < 0) - goto end; - bebob->version = version; - strcpy(bebob->card->driver, "BeBoB"); strcpy(bebob->card->shortname, model); strcpy(bebob->card->mixername, model); diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index edd93699ce1a..fc2b9b36159c 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -109,8 +109,6 @@ struct snd_bebob { /* for M-Audio special devices */ void *maudio_special_quirk; - /* 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 6d47c25654e6..02972b32e170 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -456,14 +456,6 @@ static int init_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) } if (stream == &bebob->tx_stream) { - // BeBoB v3 transfers packets with these qurks: - // - In the beginning of streaming, the value of dbc is - // incremented even if no data blocks are transferred. - // - The value of dbc is reset suddenly. - if (bebob->version > 2) - bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC | - CIP_SKIP_DBC_ZERO_CHECK; - // At high sampling rate, M-Audio special firmware transmits // empty packet with the value of dbc incremented by 8 but the // others are valid to IEC 61883-1. From patchwork Fri Jun 11 03:50:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 459182 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 C0A59C4743D for ; Fri, 11 Jun 2021 03:52:38 +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 3B5586023C for ; Fri, 11 Jun 2021 03:52:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B5586023C 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 C1B3C1852; Fri, 11 Jun 2021 05:51:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C1B3C1852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1623383556; bh=Qf9KsPw5Y8bMNh9OIVuZptwJv8Z3tSkY/P4uHNb/HxE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RJ+Q6ag4nHt228OuHSZdUjiBtFbRVIx61mjqjl6f9j8lAlrndWRskfesqE2Cs4tv5 UFC21sGbSU9n8OUSFF8nkNELWAErSUdstzJN28VWWARVQOtJfi/IjNvm/0/NJEC6ch cZqsskUcv5vBdCjdQHMRwC2etJD/GJ9r0rZrO3tg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 340A3F804CF; Fri, 11 Jun 2021 05:50:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F1C54F804D0; Fri, 11 Jun 2021 05:50:28 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AD4FAF802DF for ; Fri, 11 Jun 2021 05:50:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AD4FAF802DF Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="sWjV5In0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="swrPaBX8" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id EB7771BA0; Thu, 10 Jun 2021 23:50:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 10 Jun 2021 23:50:16 -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=bfl/ukndIIF39 wCaiM/5LDPHoETJgNAUOMCfbxMlT70=; b=sWjV5In0mxOXZxNaLhUX6DJgQRZi2 UmQyZSXlshChzUReMMVHWllnFPjfKm9GH/hHK9qqRTEz//9G0x+YQpTwyZg/fGuW OcwTyEp+ZECLScfdzwK8PTqZrfgKdz+m6O1mM7MGaDVZmKDKUtlqc1JIKb2Ol6lr VRxoAesTBToaAgcQI7r9tP1qhiVaELIRlP1VUuKvf7QB72ZYwn20Vt2vMLXfnWDX qoe9usj93LK3vMR0pg/FDUVAsMNzM7rgcjkv4nYHZAPmoeTW/AdW98VIepYJVzim WgWC160ZdCtn8ulaN3uKRHjSpM64pv89dUwkqJvT9+3uUU8W9rmEQdZhw== 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= fm3; bh=bfl/ukndIIF39wCaiM/5LDPHoETJgNAUOMCfbxMlT70=; b=swrPaBX8 4FCrCN67yOt8f1jNAruBVbe8S0k/hCaqIXqO+AuY0w25ArEbT9PAalYu1MA2aSWY iW+wAciZTKWwJ/nSV1br0s9cDYuyQtWk2YXNHj9r0oeNYJT74eJSYAKyzkUV0Uvg 3zYBLMmmw8VqMMVnvn8/HjfoBOAjwKWgjxaB8pPg9uW4i+1e56c/PUTuDsJzraPC UEnxRLs7uI69rU9T2xmKVzp2I8eSNqhew7Xln+kZU3eWzPJ4M5wwWgXiJb60KJZA Cs3gVvYvxveMgivUa5yuaLQG0UF5GdEKG6HekY05PTMQUSWDKMLKg9Yahb2G2+Wb kk+4kqpaT14LAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduiedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihessh grkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Jun 2021 23:50:14 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 3/3] ALSA: bebob: code refactoring for model-dependent quirks Date: Fri, 11 Jun 2021 12:50:03 +0900 Message-Id: <20210611035003.26852-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210611035003.26852-1-o-takashi@sakamocchi.jp> References: <20210611035003.26852-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" This commit adds enumeration and structure member as code refactoring regarding to model-dependent quirks. Signed-off-by: Takashi Sakamoto --- sound/firewire/bebob/bebob.c | 34 ++++++++++++++++++++++++----- sound/firewire/bebob/bebob.h | 8 +++++-- sound/firewire/bebob/bebob_stream.c | 18 +++++++-------- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c index 25222cc27e43..452317e53565 100644 --- a/sound/firewire/bebob/bebob.c +++ b/sound/firewire/bebob/bebob.c @@ -159,6 +159,30 @@ check_audiophile_booted(struct fw_unit *unit) return strncmp(name, "FW Audiophile Bootloader", 24) != 0; } +static int detect_quirks(struct snd_bebob *bebob, const struct ieee1394_device_id *entry) +{ + if (entry->vendor_id == VEN_MAUDIO1) { + switch (entry->model_id) { + case MODEL_MAUDIO_PROFIRELIGHTBRIDGE: + // 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. + bebob->quirks |= SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC; + break; + case MODEL_MAUDIO_FW1814: + case MODEL_MAUDIO_PROJECTMIX: + // At high sampling rate, M-Audio special firmware transmits empty packet + // with the value of dbc incremented by 8. + bebob->quirks |= SND_BEBOB_QUIRK_WRONG_DBC; + break; + default: + break; + } + } + + return 0; +} + static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { unsigned int card_index; @@ -219,6 +243,10 @@ static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *en if (err < 0) goto error; + err = detect_quirks(bebob, entry); + if (err < 0) + goto error; + if (bebob->spec == &maudio_special_spec) { if (entry->model_id == MODEL_MAUDIO_FW1814) err = snd_bebob_maudio_special_discover(bebob, true); @@ -230,12 +258,6 @@ static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *en 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 (entry->vendor_id == VEN_MAUDIO1 && entry->model_id == MODEL_MAUDIO_PROFIRELIGHTBRIDGE) - bebob->discontinuity_quirk = true; - err = snd_bebob_stream_init_duplex(bebob); if (err < 0) goto error; diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index fc2b9b36159c..dff8e25c6ca3 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -75,6 +75,11 @@ struct snd_bebob_spec { const struct snd_bebob_meter_spec *meter; }; +enum snd_bebob_quirk { + SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC, + SND_BEBOB_QUIRK_WRONG_DBC, +}; + struct snd_bebob { struct snd_card *card; struct fw_unit *unit; @@ -84,6 +89,7 @@ struct snd_bebob { spinlock_t lock; const struct snd_bebob_spec *spec; + unsigned int quirks; // Combination of snd_bebob_quirk enumerations. unsigned int midi_input_ports; unsigned int midi_output_ports; @@ -109,8 +115,6 @@ struct snd_bebob { /* for M-Audio special devices */ void *maudio_special_quirk; - bool discontinuity_quirk; - struct amdtp_domain domain; }; diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 02972b32e170..e3e23e42add3 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c @@ -430,6 +430,7 @@ static int start_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) static int init_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) { + unsigned int flags = CIP_BLOCKING; enum amdtp_stream_direction dir_stream; struct cmp_connection *conn; enum cmp_direction dir_conn; @@ -445,24 +446,21 @@ static int init_stream(struct snd_bebob *bebob, struct amdtp_stream *stream) dir_conn = CMP_INPUT; } + if (stream == &bebob->tx_stream) { + if (bebob->quirks & SND_BEBOB_QUIRK_WRONG_DBC) + flags |= CIP_EMPTY_HAS_WRONG_DBC; + } + err = cmp_connection_init(conn, bebob->unit, dir_conn, 0); if (err < 0) return err; - err = amdtp_am824_init(stream, bebob->unit, dir_stream, CIP_BLOCKING); + err = amdtp_am824_init(stream, bebob->unit, dir_stream, flags); if (err < 0) { cmp_connection_destroy(conn); return err; } - if (stream == &bebob->tx_stream) { - // At high sampling rate, M-Audio special firmware transmits - // empty packet with the value of dbc incremented by 8 but the - // others are valid to IEC 61883-1. - if (bebob->maudio_special_quirk) - bebob->tx_stream.flags |= CIP_EMPTY_HAS_WRONG_DBC; - } - return 0; } @@ -630,7 +628,7 @@ int snd_bebob_stream_start_duplex(struct snd_bebob *bebob) if (err < 0) goto error; - if (!bebob->discontinuity_quirk) + if (!(bebob->quirks & SND_BEBOB_QUIRK_INITIAL_DISCONTINUOUS_DBC)) tx_init_skip_cycles = 0; else tx_init_skip_cycles = 16000;