From patchwork Wed Jun 23 07:59:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339249 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 87870C4743C for ; Wed, 23 Jun 2021 08:01:00 +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 3FA22611BF for ; Wed, 23 Jun 2021 08:00:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FA22611BF 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 A208384B; Wed, 23 Jun 2021 10:00:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A208384B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435256; bh=69Oe3yqW7dlpNqnDVIHtI0rhu73SIaWT3vII6hdni/c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bXFyDUH7jpYqV5Zf/bepDaZO+SHgPH65XLX3JN+lB9G8aM3bgiocaB+iAfDgx32je o1NynGCamt9lSYddTcxkYBEOJBptyfQ4px+3btewNodsLZou0XRF/LR7WAxlBGTlpI a2ENo7mc78FxvcrQ3cJepNr76Krk5VCTfPstBWFU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 18A2BF80290; Wed, 23 Jun 2021 10:00:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2A505F804D6; Wed, 23 Jun 2021 10:00:04 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 466B4F8016B for ; Wed, 23 Jun 2021 09:59:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 466B4F8016B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="vC5a/0eg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HcZkZlO3" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id BF34310C3; Wed, 23 Jun 2021 03:59:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 23 Jun 2021 03:59:50 -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=3TsDp33sfVx6E MKeXkP20fK0hEeW7lxWsjYmgocDB0A=; b=vC5a/0egQat8hQbvaJXnUQzjqr8h0 54yBCK29hQAuOTGGBwfJh7hfWDYhGX4idMVv2EQME95uPb4vTYIg0qKXWmXbpbnm Y2q62qyfXoMJtD87ChRJ/N8EiTXeDeAK+M+B4Y+bIisuPHZI7i7L1xSPx2ntNSE4 lhiiSTIH8Hi/9hLWSDKffBVPuAqrUU1PR36noXIBMZBZ3nW1WU9b3wdctYR3N7mo vwwkdHXTSKetxRNnC+ghvAkHbKkWhDJXOGE6NYnJowi/9/mOvw5noQjWlf5lTB+A lRhsSaBcru8NM8VN5T1hCNui6kZG0ZFGOi9KRcPrM+Eztka77YxWw+W5Q== 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=3TsDp33sfVx6EMKeXkP20fK0hEeW7lxWsjYmgocDB0A=; b=HcZkZlO3 yN8F/NFQZcGTFVf3uLRjwLfDA/EdNhmrTskOTrcyuYTUXZmR0lN85SF1ADA3qKbQ RPJZ7Y84aztHufQSG4V8Vj3XkJUtfw+EBDAS7p2BqgoBBbNw2AuJx+IYws5ROEx+ NvmeQsMw7PnRckmcmndfICaRy733H5je14e41CLCbI5+BaW+OOdo+azK95M7f4i1 uoVR2oegLM4IkeXazOxVmH6XPyjQqMGlOF1s9gm6mfNn5v1m90oqOIba5Yr0by9h 5PLXBF+IDIoQiiAqQKqZt2BnYl7Ve2KDCvMshewCh04zTL9h4QUbKnrCkL3Zz3T/ XNp5JPYMrLVUDA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:48 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 1/9] ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol Date: Wed, 23 Jun 2021 16:59:33 +0900 Message-Id: <20210623075941.72562-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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 in protocol version 2 has a register with flag for IEC 60958 signal detection as source of sampling clock without discrimination between coaxial and optical interfaces. On the other hand, current implementation of driver manage to interpret type of signal on optical interface instead. This commit fixes the detection of optical/coaxial interface for S/PDIF signal. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v2.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index 784073aa1026..f0a0ecad4d74 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -86,24 +86,23 @@ static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; break; case 1: + *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; + break; + case 2: { __be32 reg; // To check the configuration of optical interface. - int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, - ®, sizeof(reg)); + int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, ®, sizeof(reg)); if (err < 0) return err; - if (be32_to_cpu(reg) & 0x00000200) + if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == V2_OPT_IFACE_MODE_SPDIF) *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; else - *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; break; } - case 2: - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; - break; case 3: *src = SND_MOTU_CLOCK_SOURCE_SPH; break; From patchwork Wed Jun 23 07:59:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339251 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 EF8CAC4743C for ; Wed, 23 Jun 2021 08:01: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 B16AB611BF for ; Wed, 23 Jun 2021 08:01:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B16AB611BF 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 E76D2165E; Wed, 23 Jun 2021 10:00:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E76D2165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435308; bh=1icCz1B8NfdXKnEWXzMnEaCf8gjb1sc0KLk11t41ppg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=D0/sFvqGiseX8z4ALBLPIC9c8YjgU+YyfTCgcAZhczWm8dwNmh9f1P6ajucFwy+3s GchtrQFIlGp1+No0nbQKCqTpVkQhykj3HiV3Y9YO9U3PqkdN0zMsNa0D0cDeH3MLxp zj4vyTOEr+96u7rkixb44pzYY/6+iJYl9/8q7MKE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AB465F804DA; Wed, 23 Jun 2021 10:00:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 463B3F8016B; Wed, 23 Jun 2021 10:00:04 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 48D41F800E1 for ; Wed, 23 Jun 2021 09:59:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48D41F800E1 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="kb+UZcym"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="sTI6Sw+j" Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 1246410B6; Wed, 23 Jun 2021 03:59:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 23 Jun 2021 03:59:52 -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=m0PtSTI8J237a bH0tBrNIVD2Ab3bfTcN1b+rGhFmslo=; b=kb+UZcymkdTSUGfqNxYucSoDHGJ7N i+ZBGVybjs9Ca5v1duoOGltrrGmf+RrW9iFoJXDJddiEQehcN/wVBh577VkfRtv+ bO49fCrl9ANuiM+AxJc9PgoQdwM7bBGMj2P1A4FV3oAB/jjOPbyVH9HD3jFXgxyL 55PXmyYi+zOguZ4NIJKAZ4fdRklXuS2Dp9qWneEX8HHsuBTIHfiDjpaGumjv1XUR vqoYpyitZeHzyjCoevOOf+4FTsKISaaPMQA/TptJg5wlPSInlXFop6cI0CEQTiKq nfpn+vo6zO5VUwqxUh04UP1ybEY6c2yRZLJ5D/Pq00lMCsdSLtdx/x5Mw== 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=m0PtSTI8J237abH0tBrNIVD2Ab3bfTcN1b+rGhFmslo=; b=sTI6Sw+j m/8Bl5cZx1BgA7hfNCYKwzutT4fMzde6QDqKcKcXLHKGnpAUbEN2HnPFLglqmV8s 0aWb922c3MUklnCtHxTPZOS3OF9wk0XbNvoksbylDgwKQfTSfCQuL6h8LN6gEQLJ 9juzS88Km0edQLVfA+uJ08w3n2hdPiazbQEFtSXXiCo349s9EETWulb3FNE56iOs tDh5iNIuFf1d3xqGfjvGmdnmnlUbUgIdkvp/HJBQ7Mr0FIruBJTS/qmBkCf/6Y2u 8XwfAcyKfeUW3iyDj6HAwwBReZ58TNfx8MmGzSkgzJ2TMxEAOLHm88b1avVkPx1h xohlk8/qYhXMHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:50 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 2/9] ALSA: firewire-motu: code refactoring for detection of clock source in v2 protocol Date: Wed, 23 Jun 2021 16:59:34 +0900 Message-Id: <20210623075941.72562-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" Current implementation of driver has two similar helper functions for source detection of sampling clock. This commit merges them as a code refactoring. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v2.c | 68 ++++++++------------------ 1 file changed, 21 insertions(+), 47 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index f0a0ecad4d74..7b69a8ef6b3d 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -78,10 +78,10 @@ int snd_motu_protocol_v2_set_clock_rate(struct snd_motu *motu, sizeof(reg)); } -static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, - enum snd_motu_clock_source *src) +static int get_clock_source(struct snd_motu *motu, u32 data, + enum snd_motu_clock_source *src) { - switch (data) { + switch (data & V2_CLOCK_SRC_MASK) { case 0: *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; break; @@ -90,17 +90,26 @@ static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, break; case 2: { - __be32 reg; + bool support_iec60958_on_opt = (motu->spec == &snd_motu_spec_828mk2 || + motu->spec == &snd_motu_spec_traveler); - // To check the configuration of optical interface. - int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, ®, sizeof(reg)); - if (err < 0) - return err; - - if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == V2_OPT_IFACE_MODE_SPDIF) - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; - else + if (!support_iec60958_on_opt) { *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; + } else { + __be32 reg; + + // To check the configuration of optical interface. + int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, ®, + sizeof(reg)); + if (err < 0) + return err; + + if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == + V2_OPT_IFACE_MODE_SPDIF) + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; + else + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; + } break; } case 3: @@ -120,41 +129,6 @@ static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, return 0; } -static int v2_detect_clock_source(struct snd_motu *motu, u32 data, - enum snd_motu_clock_source *src) -{ - switch (data) { - case 0: - *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; - break; - case 2: - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; - break; - case 3: - *src = SND_MOTU_CLOCK_SOURCE_SPH; - break; - case 4: - *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC; - break; - default: - *src = SND_MOTU_CLOCK_SOURCE_UNKNOWN; - break; - } - - return 0; -} - -static int get_clock_source(struct snd_motu *motu, u32 data, - enum snd_motu_clock_source *src) -{ - data &= V2_CLOCK_SRC_MASK; - if (motu->spec == &snd_motu_spec_828mk2 || - motu->spec == &snd_motu_spec_traveler) - return detect_clock_source_optical_model(motu, data, src); - else - return v2_detect_clock_source(motu, data, src); -} - int snd_motu_protocol_v2_get_clock_source(struct snd_motu *motu, enum snd_motu_clock_source *src) { From patchwork Wed Jun 23 07:59:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339267 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 653BBC4743C for ; Wed, 23 Jun 2021 08:03:00 +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 E336D61185 for ; Wed, 23 Jun 2021 08:02:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E336D61185 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 7AFE6166C; Wed, 23 Jun 2021 10:02:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7AFE6166C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435378; bh=3E5VmMcjtmzm+NBJFVyPRrDjm7jd1OhIPwQ5EkP0azc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Hbauza2KO77g2XSGpC+eOzHIEuzsELcGGDQUoNBKJkoOyOY3O8XgFJ+bceRnx6zNq vG+UaM+l1SaMzLgFcc10WT7fgbD6nir8y4BtzzTcxRRikKtM4iuP7u/y5ufzsRC5t1 5ftYUENoiJ8V0UXkrtiiFBijb9KTvCE4SZ6XruO8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D1956F804FA; Wed, 23 Jun 2021 10:00:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C940AF804E5; Wed, 23 Jun 2021 10:00:11 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 640B6F801DB for ; Wed, 23 Jun 2021 09:59:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 640B6F801DB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="Cv9ZbCe+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="w2C6+2rb" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 1CED110C5; Wed, 23 Jun 2021 03:59:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 23 Jun 2021 03:59: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=QddMEkT+Cm/s/ APAugD3MPE0QMSr32/aWaEb3lrl6hc=; b=Cv9ZbCe+Fm480BkmgqAqec/PURWAa xWu2nqSq+ZvJK4B9yhPCv6MdrXUy3IXbfsZnQbgyWQWKT3nxekNbpxsN2O0eeN5a xFdZ1IRTSiISqBVg2Ih+x0r0+CnXq//wlv0QUie8Ytone/K7gf9qWStqnOv1DPz4 HguKpUMhTTRsRNxp0lc1ieLuP/oS27A2HoLffjg67zsn4cvQgjAaNdssuJ+QDjBT X2RyOUWIPDnG3SxfCfgNsu7UNZrtrs99jsonUdYeAj21pcLqEaBfl2XNBnWkXieG /BERTs+DSHlmRJTzTvj4Dk435Cb9Mnf4tCufcFAQKM2M55Joa1skF0Qgg== 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=QddMEkT+Cm/s/APAugD3MPE0QMSr32/aWaEb3lrl6hc=; b=w2C6+2rb kMkPh1hiCvqS/w2tc0MKnp2Uo4Ygpsn51YpoMt4R5rk1rPs+/noBZOoVLfFvhIWP KRn+ADCxxIV2rlJSS7//K1W9M3+EGqF4wTHfMN8Pk9pSLvYE3YoqGqUCgcNc93HH tLI8hSAwKRiZ6As5cAv7jBrBJCX7IYZRSfCshYR2SI9/laHCH01jpAnrr007glPi c2U2lzANa6NouS8s7S+PRrLC6aJHeTP4cpnA+6sz1ea1jdOnUKRezc75/0gNn0ny MOPS4jJOgLOBEuMSMEdn3Nomm2rOHIx5+FZSQpeL0yU2xd6i7MbWdcecOOfxAw2f t040Bw8cBEmeqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:52 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 3/9] ALSA: firewire-motu: add support for AES/EBU clock source in v2 protocol Date: Wed, 23 Jun 2021 16:59:35 +0900 Message-Id: <20210623075941.72562-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" Although MOTU Traveler supports AES/EBU source for sampling clock, current implementation of driver doesn't code it. This commit adds support for AES/EBU source in protocol version 2. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index 7b69a8ef6b3d..7893cc73e983 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -121,6 +121,9 @@ static int get_clock_source(struct snd_motu *motu, u32 data, case 5: *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_DSUB; break; + case 7: + *src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR; + break; default: *src = SND_MOTU_CLOCK_SOURCE_UNKNOWN; break; From patchwork Wed Jun 23 07:59:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339255 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 53AD0C48BC2 for ; Wed, 23 Jun 2021 08:02:30 +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 8350960FEE for ; Wed, 23 Jun 2021 08:02:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8350960FEE 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 ECE6284C; Wed, 23 Jun 2021 10:01:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ECE6284C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435348; bh=fTNoj04QocHKi0X/ecxZkr/pxUXCA/JghnKdQKDrGQg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=K7B7+PquCGjSNuguVHb0zbopAl0d2zC0ef+Wtfr8Q3xsukih+mKmWngWpo25ecyc5 CYdytRlWn3yGeZTizdjD/jcsxDM1/jRRVDlmY+as8bdQmaySkB5tXWw2KmD/ZyudRn 8z3eK5v1rjBChDqH4zFeSbIG2Tx9gx6+OGGnEeew= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EDD69F804E2; Wed, 23 Jun 2021 10:00:11 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 50F1FF804E6; Wed, 23 Jun 2021 10:00:10 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D5CAFF8016D for ; Wed, 23 Jun 2021 09:59:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D5CAFF8016D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="SM09ARAd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kSfQu7R4" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 2AAA01036; Wed, 23 Jun 2021 03:59:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 23 Jun 2021 03:59:56 -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=/u8S7v2lJsCJn jwdwaF5QhfIFE0IS24rwXHQsyo8i+w=; b=SM09ARAdUKA+pYXxVyvFmRIeHy9Qk 0UobFqkcziGsURAAfiYQE+K07Zqqet2veC2WdjqQogj0uGPwhhZx349TjzQiA/oK NrCwVwhqJheiZJ8sNXLhCh6Ry792fcLcbIsMF5teoyhCW0UMIk2K9+nY0TuAMpLe R2Cf9Ew2HdBD9flEVhqRonzMd+aWuiPuI5dTKZrSxbAVOanwp/AKLDS5l8XQlCZk rZ7Ed88GvT2bqIMUUO+AG+nRkYEtQnrv5JxlrqkW3xsa+rLnOKxsVRlRjFV+6ghl aAB+qAtV4px4TlnmmD7J7L5acUEtwNJqQ9kDZWxtajQOACeh7J+k4d8ww== 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=/u8S7v2lJsCJnjwdwaF5QhfIFE0IS24rwXHQsyo8i+w=; b=kSfQu7R4 2X/c9CPrvHZLGrK+hSndSSzXfwCeZkJb53U4rLHaEo2b3DEWmQ7fK+EaluJXGLLf oS3VSBTIc2Rt/bwF14e7Vd+SC8k6Ww+xWy/AD3+WDj7CJHYUTta+xj03fxd3z/Fb WSW6QiswardK62ZBeJhCnApLxQAkTlAVXgfMJiqdOLV7aWSFAmLPvcf4HbOIh6JJ mVLIeDCz5HIPc06try1fFwspxnR3O9cSJSZZ8OVDaY1oXv7GHXnw0AxPJkjIm34O d9osxuCwXvUwGWXTPZj031s0xCea6hKf/jJsl1fYpoeBDGnbZfwELffAedOQeZJl 7UyaJeF2oJ5TZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:54 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 4/9] ALSA: firewire-motu: use macro instead of magic number for clock source in v2 protocol Date: Wed, 23 Jun 2021 16:59:36 +0900 Message-Id: <20210623075941.72562-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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 a series of macro for source of sampling clock in version 2 protocol. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v2.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index 7893cc73e983..8865308c2c8e 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -12,6 +12,13 @@ #define V2_CLOCK_RATE_SHIFT 3 #define V2_CLOCK_SRC_MASK 0x00000007 #define V2_CLOCK_SRC_SHIFT 0 +#define V2_CLOCK_SRC_AESEBU_ON_XLR 0x07 +#define V2_CLOCK_SRC_ADAT_ON_DSUB 0x05 +#define V2_CLOCK_SRC_WORD_ON_BNC 0x04 +#define V2_CLOCK_SRC_SPH 0x03 +#define V2_CLOCK_SRC_SPDIF 0x02 // on either coaxial or optical +#define V2_CLOCK_SRC_ADAT_ON_OPT 0x01 +#define V2_CLOCK_SRC_INTERNAL 0x00 #define V2_CLOCK_FETCH_ENABLE 0x02000000 #define V2_CLOCK_MODEL_SPECIFIC 0x04000000 @@ -82,13 +89,13 @@ static int get_clock_source(struct snd_motu *motu, u32 data, enum snd_motu_clock_source *src) { switch (data & V2_CLOCK_SRC_MASK) { - case 0: + case V2_CLOCK_SRC_INTERNAL: *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; break; - case 1: + case V2_CLOCK_SRC_ADAT_ON_OPT: *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; break; - case 2: + case V2_CLOCK_SRC_SPDIF: { bool support_iec60958_on_opt = (motu->spec == &snd_motu_spec_828mk2 || motu->spec == &snd_motu_spec_traveler); @@ -112,16 +119,16 @@ static int get_clock_source(struct snd_motu *motu, u32 data, } break; } - case 3: + case V2_CLOCK_SRC_SPH: *src = SND_MOTU_CLOCK_SOURCE_SPH; break; - case 4: + case V2_CLOCK_SRC_WORD_ON_BNC: *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC; break; - case 5: + case V2_CLOCK_SRC_ADAT_ON_DSUB: *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_DSUB; break; - case 7: + case V2_CLOCK_SRC_AESEBU_ON_XLR: *src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR; break; default: From patchwork Wed Jun 23 07:59:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339269 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 A31E8C4743C for ; Wed, 23 Jun 2021 08:03:20 +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 2B36060FEE for ; Wed, 23 Jun 2021 08:03:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B36060FEE 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 91AEE166F; Wed, 23 Jun 2021 10:02:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 91AEE166F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435398; bh=g0vn32DNepJneY8Myao8mIp+iG8XcyVC59GzTXkvlpU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=MDfi15+JP3cAif9ITWS8SexHM1xiZ+UVf1OHThDYGdC3gHNhLYZ7zsh/KXMciJKMz fSFP1SbYx1/ek+chezbge3OYgVIcGaOQPAIQq2lDMp60f5roW7i4WOuosCngSWFS0h FiV1CVM0nRDSJlKK5Qz/HpwMfwydMGGBPasL0OJE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A3345F804FB; Wed, 23 Jun 2021 10:00:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D667F804E7; Wed, 23 Jun 2021 10:00:12 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5464BF801D5 for ; Wed, 23 Jun 2021 10:00:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5464BF801D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="KbIptk2c"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vjddERoP" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 4A26210C8; Wed, 23 Jun 2021 03:59:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 23 Jun 2021 03:59: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=bgM+BBaiYgnlx KK+lDh3YhTF6GAJBpRYHulmrUHniZE=; b=KbIptk2cIjmQD4OZyL4JJCRTQBXX4 YTPBD2dbjvR2mQ6m6qW/3nUlYE8bVb/oHn3+PVYMRUIHZump7nNs68s1/QjE7hzp 4DK5Y2wRc7ZlgkdJXhx4VcKTt2VWwRHllAeD5mp3P0v5NByTvtUbzT/GroxhccSl QQHdJKfH3h4pGmcG79iBj8ylbSW/LojZ5jIFIvmJKKfcCyCDe/Yi6L64uO/PFf6S fpFyDxSkmoEDQpddSmZo5XT0oF68PMcJSHyiFsemfWoXrNKsmEuZ+tq/xQrfnz9K PdVhHIwps6B8yQ8L1eeHvuI7Wl/shnPxbRaMNJ3+axQaLDvr/VxgBh8mg== 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=bgM+BBaiYgnlxKK+lDh3YhTF6GAJBpRYHulmrUHniZE=; b=vjddERoP O8/YEFufJCUiYFgUI4oJ2GSGNXUaR1vdwR+1lhEYXh/IkPjlEQHGYqj3B92WAX+S iv/ZAbHaynQdzeK+oY4Mcc06Y2VELnibeRUasGohwSQQoWC1X2exRQmhPMO0cvw9 5Fiuk1hj1qYx7wJnF9/ExQsY1nGhlDp5aZkKw54dFIXPMbaNuihcTKCzGqc68h7U BffUizxEl9Bjarl46JTazgaWBhq3e9QibuUqEl+O6cUP8oRT/dl3EhUgnVWfinZD htz7bjldIX8v5D5INAT0Pz8ksV/BOXJpOA33Qbb7azPcjYRq0DflYFMQD69AIBKF bWR2ywx1Kx9UqQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:56 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 5/9] ALSA: firewire-motu: code refactoring for packet format detection in v2 protocol Date: Wed, 23 Jun 2021 16:59:37 +0900 Message-Id: <20210623075941.72562-6-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" Current implementation of driver has several similar helper functions for packet format detection in protocol version 2. This commit merges them as code refactoring. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v2.c | 79 +++++++------------------- 1 file changed, 20 insertions(+), 59 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index 8865308c2c8e..93d5df1ae550 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -218,59 +218,9 @@ int snd_motu_protocol_v2_switch_fetching_mode(struct snd_motu *motu, } } -static int detect_packet_formats_828mk2(struct snd_motu *motu, u32 data) -{ - if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->tx_packet_formats.pcm_chunks[0] += 8; - motu->tx_packet_formats.pcm_chunks[1] += 4; - } - - if (((data & V2_OPT_OUT_IFACE_MASK) >> V2_OPT_OUT_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->rx_packet_formats.pcm_chunks[0] += 8; - motu->rx_packet_formats.pcm_chunks[1] += 4; - } - - return 0; -} - -static int detect_packet_formats_traveler(struct snd_motu *motu, u32 data) -{ - if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->tx_packet_formats.pcm_chunks[0] += 8; - motu->tx_packet_formats.pcm_chunks[1] += 4; - } - - if (((data & V2_OPT_OUT_IFACE_MASK) >> V2_OPT_OUT_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->rx_packet_formats.pcm_chunks[0] += 8; - motu->rx_packet_formats.pcm_chunks[1] += 4; - } - - return 0; -} - -static int detect_packet_formats_8pre(struct snd_motu *motu, u32 data) -{ - if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->tx_packet_formats.pcm_chunks[0] += 8; - motu->tx_packet_formats.pcm_chunks[1] += 8; - } - - if (((data & V2_OPT_OUT_IFACE_MASK) >> V2_OPT_OUT_IFACE_SHIFT) == - V2_OPT_IFACE_MODE_ADAT) { - motu->rx_packet_formats.pcm_chunks[0] += 8; - motu->rx_packet_formats.pcm_chunks[1] += 8; - } - - return 0; -} - int snd_motu_protocol_v2_cache_packet_formats(struct snd_motu *motu) { + bool has_two_opt_ifaces = (motu->spec == &snd_motu_spec_8pre); __be32 reg; u32 data; int err; @@ -294,14 +244,25 @@ int snd_motu_protocol_v2_cache_packet_formats(struct snd_motu *motu) motu->spec->rx_fixed_pcm_chunks, sizeof(motu->rx_packet_formats.pcm_chunks)); - if (motu->spec == &snd_motu_spec_828mk2) - return detect_packet_formats_828mk2(motu, data); - else if (motu->spec == &snd_motu_spec_traveler) - return detect_packet_formats_traveler(motu, data); - else if (motu->spec == &snd_motu_spec_8pre) - return detect_packet_formats_8pre(motu, data); - else - return 0; + if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == V2_OPT_IFACE_MODE_ADAT) { + motu->tx_packet_formats.pcm_chunks[0] += 8; + + if (!has_two_opt_ifaces) + motu->tx_packet_formats.pcm_chunks[1] += 4; + else + motu->tx_packet_formats.pcm_chunks[1] += 8; + } + + if (((data & V2_OPT_OUT_IFACE_MASK) >> V2_OPT_OUT_IFACE_SHIFT) == V2_OPT_IFACE_MODE_ADAT) { + motu->rx_packet_formats.pcm_chunks[0] += 8; + + if (!has_two_opt_ifaces) + motu->rx_packet_formats.pcm_chunks[1] += 4; + else + motu->rx_packet_formats.pcm_chunks[1] += 8; + } + + return 0; } const struct snd_motu_spec snd_motu_spec_828mk2 = { From patchwork Wed Jun 23 07:59:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339275 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 E5D94C4743C for ; Wed, 23 Jun 2021 08:04:13 +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 6A07F60FEE for ; Wed, 23 Jun 2021 08:04:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A07F60FEE 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 083C8167A; Wed, 23 Jun 2021 10:03:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 083C8167A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435452; bh=JdM9pavdIbCq5Z39552H8Ecu1LfiXc6Hj841GcFTGlE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dY6V4ALQrvFcBz74Z7O1kRJ34staw+kPY16N+FgCpAXdMwIhv97uYz4StOVqSbhAf zT+zpNyvbs0r8b8D9SnGAfRrS/mpao00wG+kOl6+Qc/4PEBrp1yeW4K6kMCG3FIPbq 6vEd/s1m4LjZebk+Rx1IBnu9U6m+qwBqH4JmKhn0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6CC47F804B0; Wed, 23 Jun 2021 10:01:41 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C483CF804DF; Wed, 23 Jun 2021 10:01:38 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E55B8F804B0 for ; Wed, 23 Jun 2021 10:00:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E55B8F804B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="dbmeKqvQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XmC2yl2S" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 4A50010B6; Wed, 23 Jun 2021 04:00:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 23 Jun 2021 04:00:00 -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=cZvbA7HJg/yrZ QKqzAoWYW3siIam0Njwr9/Wp1izCzU=; b=dbmeKqvQOOIifMOdv1qs/sIZtUczk VXeQntRVnfw8hjVM8+1glChOuuheuY8DAp+1sddPYC5UHUqxSLAEdDu9tNpFb4Ox DEdMsSFCzl9rpyKNdPizzF9RPJRMiYyYtTV0XijeayUVIaZMRET9XUTUY2PT08kz gNBZWIJftDj30qXcco0Zb9OwTMzfrFq2kNRwlyjVjpJnBQ1HKqj56heX4Kzrwc8l QsN1Xgf+0JqmRx4qPwWU8ibgKc2HDjw5dEl7JsypFEeR1XW+DS89vWU7ZdZ+jNk6 KEmztIjD6m0eD8v9gN6SfVJi0yQnKxD43on7K9swcq0zhet/Dmb6z3OJg== 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=cZvbA7HJg/yrZQKqzAoWYW3siIam0Njwr9/Wp1izCzU=; b=XmC2yl2S xSbmVJuJB4HpVWIT/THX0hOGiK7Bzi5qIFcCsI/TFqNHQm03s5YDAXFmkdew0uZY U2l6n6jzRk/G626j7CjQBlKD4ly5ObqRa73ma3G1VDge1oloPMXB3S7TK6oTSO4H IKMKQVBjcJPQPNKdoEy4MWCq4mQBE/EqhqPbRdtNgKZtaZMdwGVfrSUwCr7KZVEW CGiS54xPEUD2ZHNBr7eNn2oqvrU0kad61eU0Do8LGE0VgpWugLDJKL/+VUYFWDFZ a8RRe4gmSjxymOJqL7mF4sn79Aret7NIAqMnkRxtBRY94meWzwthUz1ZcxJ1c9n2 umbg1tzCn00V5A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 03:59:58 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 6/9] ALSA: firewire-motu: code refactoring for source detection of sampling clock in v3 protocol Date: Wed, 23 Jun 2021 16:59:38 +0900 Message-Id: <20210623075941.72562-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" Current implementation of driver has two similar helper functions for source detection of sampling clock. This commit merges them as a code refactoring. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v3.c | 59 ++++++-------------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v3.c b/sound/firewire/motu/motu-protocol-v3.c index 77e61e89770b..ab113651107b 100644 --- a/sound/firewire/motu/motu-protocol-v3.c +++ b/sound/firewire/motu/motu-protocol-v3.c @@ -97,9 +97,19 @@ int snd_motu_protocol_v3_set_clock_rate(struct snd_motu *motu, return 0; } -static int detect_clock_source_828mk3(struct snd_motu *motu, u32 data, - enum snd_motu_clock_source *src) +int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu, + enum snd_motu_clock_source *src) { + __be32 reg; + u32 data; + int err; + + err = snd_motu_transaction_read(motu, V3_CLOCK_STATUS_OFFSET, ®, + sizeof(reg)); + if (err < 0) + return err; + data = be32_to_cpu(reg) & V3_CLOCK_SOURCE_MASK; + switch (data) { case 0x00: *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; @@ -118,7 +128,6 @@ static int detect_clock_source_828mk3(struct snd_motu *motu, u32 data, { __be32 reg; u32 options; - int err; err = snd_motu_transaction_read(motu, V3_OPT_IFACE_MODE_OFFSET, ®, sizeof(reg)); @@ -137,7 +146,6 @@ static int detect_clock_source_828mk3(struct snd_motu *motu, u32 data, else *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT_B; } - break; } default: @@ -148,49 +156,6 @@ static int detect_clock_source_828mk3(struct snd_motu *motu, u32 data, return 0; } -static int v3_detect_clock_source(struct snd_motu *motu, u32 data, - enum snd_motu_clock_source *src) -{ - switch (data) { - case 0x00: - *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; - break; - case 0x01: - *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC; - break; - case 0x02: - *src = SND_MOTU_CLOCK_SOURCE_SPH; - break; - case 0x10: - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; - break; - default: - *src = SND_MOTU_CLOCK_SOURCE_UNKNOWN; - break; - } - - return 0; -} - -int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu, - enum snd_motu_clock_source *src) -{ - __be32 reg; - u32 data; - int err; - - err = snd_motu_transaction_read(motu, V3_CLOCK_STATUS_OFFSET, ®, - sizeof(reg)); - if (err < 0) - return err; - data = be32_to_cpu(reg) & V3_CLOCK_SOURCE_MASK; - - if (motu->spec == &snd_motu_spec_828mk3_fw || motu->spec == &snd_motu_spec_828mk3_hybrid) - return detect_clock_source_828mk3(motu, data, src); - else - return v3_detect_clock_source(motu, data, src); -} - int snd_motu_protocol_v3_switch_fetching_mode(struct snd_motu *motu, bool enable) { From patchwork Wed Jun 23 07:59:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339273 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 7CDBBC4743C for ; Wed, 23 Jun 2021 08:03:59 +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 02BFE61185 for ; Wed, 23 Jun 2021 08:03:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02BFE61185 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 900FB167B; Wed, 23 Jun 2021 10:03:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 900FB167B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435437; bh=WLOrkjQnDtj0gioStvNhO9QkhCqMiaK4wqcEJPlY52U=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YcAwM0muGRDl2qgz100Iih7LVHqRAy780hZV4mWo8t4lCaKNbkjxHCGjooHQgtvwJ 7TLtaBjGIbRsAm+r5Ahj1DskA8HBlNOtkvscHHzo4ODq4Bs+wFNd+yg+sDXs152ghq AwSOMku9xExAQ+c4H/MxSuIbz4eOeexXSahbz5/k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 57443F8016D; Wed, 23 Jun 2021 10:01:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8830F800B5; Wed, 23 Jun 2021 10:01:38 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0B5D0F8016B for ; Wed, 23 Jun 2021 10:00:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0B5D0F8016B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="x5SUrStn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GEgUFmwR" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 5CDF310CB; Wed, 23 Jun 2021 04:00:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 23 Jun 2021 04:00:02 -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=wEz1U8uSpYMst cUi949swWU0DVoPNO8nkou+azSgQ3Y=; b=x5SUrStnOkoZ8K/8K/N5pjbrSq1kc cMZ2JrQWBNcKfAY36QcRD6XSAFYMZRkPl0UZTJdfs3/p/kZXGQo0MHajVpa6/Doh rq4XgCvNrhnPIqrqyE4iOaOmcAForqZhYmZWat+T5aoGyqM1b6GmKNW1frTXp+H7 PfJxO91RdHX6Ism3sx9mz/CWQYvq8h3gqBRlvdvJUYSRRDD9bKJdUEZk07Vj65Wi TIII9k+a7u48SxM2q9WoLCc9MONnsXHmM5Cc+cFPOikMjlZdEfv/mQAqXkDAOZE6 1wJaLb7qM9hXYCvvehKmzUaxgjxLpvCzSaJQTCDqzrBsKgB3IB4ZcDA7Q== 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=wEz1U8uSpYMstcUi949swWU0DVoPNO8nkou+azSgQ3Y=; b=GEgUFmwR nxj+iw9pYTQRhs6FxFA48M+A19GUODZc9ztrP+1O3RcaYg/j3LiGMENZK871A8Kl YliaaDB6FY0+rLM2WUNAMBmz+101sCEBt1QFtO72qWU7MSa1nGDhPGanU4m4A0mL TzRsKAGOfxzLSDyCp7lAHCWfqyUS6FpGfQJsykphUgEl1hEI4+hb3cIzS4b0CW7g ILRu3dyuwdegEy/yEfCSSnpf95CNgaTz+vPi8VZGFG9cfgckJmdA1gu+x0Xj6gN4 lvcPEVQhps64Jgl6764BtScEwAb/mh+68JQYeAykE7iXk3ijCiFL9g4DcIgT2sRo eI8eIDbOCWL7Yg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 04:00:00 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 7/9] ALSA: firewire-motu: use macro instead of magic number for clock source in v3 protocol Date: Wed, 23 Jun 2021 16:59:39 +0900 Message-Id: <20210623075941.72562-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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 a series of macro for source of sampling clock in version 3 protocol. Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v3.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v3.c b/sound/firewire/motu/motu-protocol-v3.c index ab113651107b..56e4504e7ec9 100644 --- a/sound/firewire/motu/motu-protocol-v3.c +++ b/sound/firewire/motu/motu-protocol-v3.c @@ -13,6 +13,12 @@ #define V3_CLOCK_RATE_MASK 0x0000ff00 #define V3_CLOCK_RATE_SHIFT 8 #define V3_CLOCK_SOURCE_MASK 0x000000ff +#define V3_CLOCK_SRC_INTERNAL 0x00 +#define V3_CLOCK_SRC_WORD_ON_BNC 0x01 +#define V3_CLOCK_SRC_SPH 0x02 +#define V3_CLOCK_SRC_SPDIF_ON_COAX 0x10 +#define V3_CLOCK_SRC_OPT_IFACE_A 0x18 +#define V3_CLOCK_SRC_OPT_IFACE_B 0x19 #define V3_OPT_IFACE_MODE_OFFSET 0x0c94 #define V3_ENABLE_OPT_IN_IFACE_A 0x00000001 @@ -111,20 +117,20 @@ int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu, data = be32_to_cpu(reg) & V3_CLOCK_SOURCE_MASK; switch (data) { - case 0x00: + case V3_CLOCK_SRC_INTERNAL: *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; break; - case 0x01: + case V3_CLOCK_SRC_WORD_ON_BNC: *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC; break; - case 0x02: + case V3_CLOCK_SRC_SPH: *src = SND_MOTU_CLOCK_SOURCE_SPH; break; - case 0x10: + case V3_CLOCK_SRC_SPDIF_ON_COAX: *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; break; - case 0x18: - case 0x19: + case V3_CLOCK_SRC_OPT_IFACE_A: + case V3_CLOCK_SRC_OPT_IFACE_B: { __be32 reg; u32 options; @@ -135,7 +141,7 @@ int snd_motu_protocol_v3_get_clock_source(struct snd_motu *motu, return err; options = be32_to_cpu(reg); - if (data == 0x18) { + if (data == V3_CLOCK_SRC_OPT_IFACE_A) { if (options & V3_NO_ADAT_OPT_IN_IFACE_A) *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A; else From patchwork Wed Jun 23 07:59:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339277 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 D2966C4743C for ; Wed, 23 Jun 2021 08:04:43 +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 529C5601FF for ; Wed, 23 Jun 2021 08:04:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 529C5601FF 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 E3A361674; Wed, 23 Jun 2021 10:03:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E3A361674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435482; bh=NrIRB5hbWvNe4rws55gqe50YZS2IW0tjQdgyuC9VulE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=X3iwUdZJ72TVwtFuEJjTSKHs95tjtgBLzExFaO9dkHLwRqwgGNgxEPKJTy30LLPwi FOJ1q7N5ei/iSIL9M6Q27++ta+CutltsIDvrORrL+CqVHpxBZ2prIdptiwHh/eDhiN USn+vp/9Cuek+c+LMI9M4z9+lgOcBRmRTHEeWnkg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2C98CF80507; Wed, 23 Jun 2021 10:01:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CBF89F80290; Wed, 23 Jun 2021 10:01:38 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 27A88F804D8 for ; Wed, 23 Jun 2021 10:00:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27A88F804D8 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="yjSKi1P2"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bT6VZaA+" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 6A1B510B6; Wed, 23 Jun 2021 04:00:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 23 Jun 2021 04:00:04 -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=dJGhOpZB+MWwh 4MZBe7ZBkYPSO0TEr90sHKwrNbIGA8=; b=yjSKi1P2N08d0gf/AWf02pKBAevpX pa5YxMN0bzVZ/8/OTKtKuzFqsxl9exZQpXqNa/QcGnbYYAZCcXSaGDfx+nYvD/Dr 2yfS9t5ZrRQxbJnIUeCng+pf5tq0mAB0UTbmAtANjOjYYMBcQR05fV3MP/SDnCyt OAErnN2xCWm+7D9JdaJRWFxLEw+0fcZkuOcBAyqDI2fTXIhymHe86y9S+iGxrlEk Nf5v1oJzKfgEnqF9MNJthmg5gkuSyktP9AHpvf/Lh40OikAXSeJj3Boxmk/qANvI r0XYecQ6Lb5rynsqv0KQ6LJ4zDz9g0HfEgVKIfuyW0leQlm9Crw5TcnfQ== 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=dJGhOpZB+MWwh4MZBe7ZBkYPSO0TEr90sHKwrNbIGA8=; b=bT6VZaA+ Y0ROOVABdBpiJuBIm+hPQOyM+i1hCy5qp4EeoxpgglW1ciLuPKjseLGIfX40tM1Y /DDaSX+hIjRD643TJsTPPaIuSfIIXUDv0RetqdetM3ASw3e9Ls6U4DttI8bZomYz lNzPOir6jCtG6CD44aeBoiBK7ObQy0Nfpogg9IFcZZETCsQ9DGrD6rt8ZTeda8Lf YNCWY8rDwK25B9pgDzhMFw6gogCBHC1WtBQHzVemstNO9V2VJYReJVQucJz8LDii 1EOqeNRRpTUAyk7TfOCmx+f/I9XAZHGqDWYTYUkWgMZSIw25YHdfUjHl3N2KKXnC ipNugdiHSTAXzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 04:00:02 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 8/9] ALSA: firewire-motu: fix register handling for 828 Date: Wed, 23 Jun 2021 16:59:40 +0900 Message-Id: <20210623075941.72562-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" After further investigation, I find out some mistakes for 828 about its register. This commit fixes it. Fixes: d13d6b284d8b ("ALSA: firewire-motu: add support for MOTU 828") Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v1.c | 53 +++++++++++++++++--------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v1.c b/sound/firewire/motu/motu-protocol-v1.c index 65209e617e10..3b766615a9ee 100644 --- a/sound/firewire/motu/motu-protocol-v1.c +++ b/sound/firewire/motu/motu-protocol-v1.c @@ -19,7 +19,7 @@ // 0x00004000: mode of optical output interface. // 0x00004000: for S/PDIF signal. // 0x00000000: disabled or for ADAT signal. -// 0x00003f40: monitor input mode. +// 0x00003f00: monitor input mode. // 0x00000800: analog-1/2 // 0x00001a00: analog-3/4 // 0x00002c00: analog-5/6 @@ -32,26 +32,32 @@ // 0x00002d00: analog-6 // 0x00003600: analog-7 // 0x00003f00: analog-8 -// 0x00000040: disabled +// 0x00000080: enable stream input. +// 0x00000040: disable monitor input. +// 0x00000008: enable main out. // 0x00000004: rate of sampling clock. // 0x00000004: 48.0 kHz // 0x00000000: 44.1 kHz // 0x00000023: source of sampling clock. +// 0x00000003: source packet header (SPH) // 0x00000002: S/PDIF on optical/coaxial interface. // 0x00000021: ADAT on optical interface // 0x00000001: ADAT on Dsub 9pin -// 0x00000000: internal or SMPTE +// 0x00000000: internal #define CLK_828_STATUS_OFFSET 0x0b00 #define CLK_828_STATUS_MASK 0x0000ffff #define CLK_828_STATUS_FLAG_OPT_IN_IFACE_IS_SPDIF 0x00008000 #define CLK_828_STATUS_FLAG_OPT_OUT_IFACE_IS_SPDIF 0x00004000 #define CLK_828_STATUS_FLAG_FETCH_PCM_FRAMES 0x00000080 -#define CLK_828_STATUS_FLAG_SRC_IS_NOT_FROM_ADAT_DSUB 0x00000020 -#define CLK_828_STATUS_FLAG_OUTPUT_MUTE 0x00000008 +#define CLK_828_STATUS_FLAG_ENABLE_OUTPUT 0x00000008 #define CLK_828_STATUS_FLAG_RATE_48000 0x00000004 -#define CLK_828_STATUS_FLAG_SRC_SPDIF_ON_OPT_OR_COAX 0x00000002 -#define CLK_828_STATUS_FLAG_SRC_ADAT_ON_OPT_OR_DSUB 0x00000001 +#define CLK_828_STATUS_MASK_SRC 0x00000023 +#define CLK_828_STATUS_FLAG_SRC_ADAT_ON_OPT 0x00000021 +#define CLK_828_STATUS_FLAG_SRC_SPH 0x00000003 +#define CLK_828_STATUS_FLAG_SRC_SPDIF 0x00000002 +#define CLK_828_STATUS_FLAG_SRC_ADAT_ON_DSUB 0x00000001 +#define CLK_828_STATUS_FLAG_SRC_INTERNAL 0x00000000 // Status register for MOTU 896 (0x'ffff'f000'0b14). // @@ -249,18 +255,29 @@ static int get_clock_source_828(struct snd_motu *motu, enum snd_motu_clock_sourc return err; data = be32_to_cpu(reg) & CLK_828_STATUS_MASK; - if (data & CLK_828_STATUS_FLAG_SRC_ADAT_ON_OPT_OR_DSUB) { - if (data & CLK_828_STATUS_FLAG_SRC_IS_NOT_FROM_ADAT_DSUB) - *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; - else - *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_DSUB; - } else if (data & CLK_828_STATUS_FLAG_SRC_SPDIF_ON_OPT_OR_COAX) { + switch (data & CLK_828_STATUS_MASK_SRC) { + case CLK_828_STATUS_FLAG_SRC_ADAT_ON_OPT: + *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; + break; + case CLK_828_STATUS_FLAG_SRC_SPH: + *src = SND_MOTU_CLOCK_SOURCE_SPH; + break; + case CLK_828_STATUS_FLAG_SRC_SPDIF: + { if (data & CLK_828_STATUS_FLAG_OPT_IN_IFACE_IS_SPDIF) - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; - else *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; - } else { + else + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; + break; + } + case CLK_828_STATUS_FLAG_SRC_ADAT_ON_DSUB: + *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_DSUB; + break; + case CLK_828_STATUS_FLAG_SRC_INTERNAL: *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; + break; + default: + return -ENXIO; } return 0; @@ -321,13 +338,13 @@ static int switch_fetching_mode_828(struct snd_motu *motu, bool enable) return err; data = be32_to_cpu(reg) & CLK_828_STATUS_MASK; - data &= ~(CLK_828_STATUS_FLAG_FETCH_PCM_FRAMES | CLK_828_STATUS_FLAG_OUTPUT_MUTE); + data &= ~(CLK_828_STATUS_FLAG_FETCH_PCM_FRAMES | CLK_828_STATUS_FLAG_ENABLE_OUTPUT); if (enable) { // This transaction should be initiated after the device receives batch of packets // since the device voluntarily mutes outputs. As a workaround, yield processor over // 100 msec. msleep(100); - data |= CLK_828_STATUS_FLAG_FETCH_PCM_FRAMES | CLK_828_STATUS_FLAG_OUTPUT_MUTE; + data |= CLK_828_STATUS_FLAG_FETCH_PCM_FRAMES | CLK_828_STATUS_FLAG_ENABLE_OUTPUT; } reg = cpu_to_be32(data); From patchwork Wed Jun 23 07:59:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 12339271 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 F27C4C4743C for ; Wed, 23 Jun 2021 08:03:34 +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 7ABCD60FEE for ; Wed, 23 Jun 2021 08:03:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7ABCD60FEE 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 0CFD41672; Wed, 23 Jun 2021 10:02:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0CFD41672 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1624435413; bh=uKuUbEoJJ9PasAf0bIqrAO1JUVq3/Os5YGTTvuDNDn0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=O7UdsLQ7DAP4GwbfcwbwmNIGYd4E8jbNdG8e+yGF5pvjydiT+jMoYs/12lbYSuGGe DbBt//4pC/1dKlckw8KGjyHNo/vc4UIcsuNGu3Mka/FoFC7MqMR1C7ct6lSGEqAcKU 5p/P/9f9YeZjUVZXg2sDuLfV2m0IDY22GUM3Pkdw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8A6B3F804FD; Wed, 23 Jun 2021 10:00:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D05F8F804EB; Wed, 23 Jun 2021 10:00:15 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2CFA0F804E4 for ; Wed, 23 Jun 2021 10:00:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2CFA0F804E4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="CXgV3rv+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lIYA2Uld" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 8166610C6; Wed, 23 Jun 2021 04:00:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 23 Jun 2021 04:00:07 -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=WIJWu0FLrM2ac 3hhH9t625EWYjm1NpmZuKBrZ12XXik=; b=CXgV3rv+ZAP0LxfYxf7oaVVASfCbe nBLaLjN9ngC+kU0HL5KI178TKhxU9UBC8bCCRS3ENCGr21IyMt6HGddcW6/TyiK/ vCvkpub9obXT7edgGDf3lSYL/4ceLBooA/vTV0olhtb4LGdLeID+tdybrsK98pF6 TuWfw7NpNvPfa/rw+EW+vRJVHirEkN/THPglTLzFh++u0RgAPBUJCd6LRpTJ2XfD oLmC+3cspG2UGAzZOIAZOrfzStSK5nMwSko0JZ2KuaMBeTBirLJbQuh8KLsrfp93 EwUb3U+S3xXD2gd1teTBycj63EdwV4CZ4fzD8/Lz2oADWQz/rHIY3lo8A== 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=WIJWu0FLrM2ac3hhH9t625EWYjm1NpmZuKBrZ12XXik=; b=lIYA2Uld SAVRP+l/34XsBpoc0deYneJarQZ+scQthFTI6ixGfa99eS7OASHzhRazxI7ZV3wk XWcd50xik1Ma/Ruy+HV1HxWa2Jda0HMyk35SglFWxKTPqMXozyRa0I8qkoWkCW/P jc+b6LorlQFud2bH/KT7qBDsj4zTB+Q21Tcx8kMpQecku7jXV/cAuQYUFrfI6iMu xld1PFd29S3iocDzM6meeKhnrplhH9pS4MJ/vi1WZLgQM6mFLv6gIVLm2RxDwDnn d9dq2VI78kUnlEU0f470ampwVOaKgRBXQk6toVReaXVLWORGKgeCJ21N4e+dDazT nj9RA6SznXDqAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpeevfefffe ektefgveegfeelheffhfeujedtjeevtefhkeevkedtjeejvddtjefhjeenucevlhhushht vghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 23 Jun 2021 04:00:04 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 9/9] ALSA: firewire-motu: fix register handling for 896 Date: Wed, 23 Jun 2021 16:59:41 +0900 Message-Id: <20210623075941.72562-10-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp> References: <20210623075941.72562-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" After further investigation, I find out some mistakes for 896 about its register. This commit fixes it. Fixes: b431f16f1685 ("ALSA: firewire-motu: add support for MOTU 896") Signed-off-by: Takashi Sakamoto --- sound/firewire/motu/motu-protocol-v1.c | 33 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v1.c b/sound/firewire/motu/motu-protocol-v1.c index 3b766615a9ee..f1d6a326dc07 100644 --- a/sound/firewire/motu/motu-protocol-v1.c +++ b/sound/firewire/motu/motu-protocol-v1.c @@ -61,13 +61,21 @@ // Status register for MOTU 896 (0x'ffff'f000'0b14). // -// 0x20000000: fetch PCM frames from communication IC to DAC. +// 0xf0000000: enable physical and stream input to DAC. +// 0x80000000: disable +// 0x40000000: disable +// 0x20000000: enable (prior to the other bits) +// 0x10000000: disable +// 0x00000000: disable // 0x08000000: speed of word clock signal output on BNC interface. -// 0x00000000: follow to system clock. -// 0x08000000: half of system clock. -// 0x01000000: Route main output to headphone output. -// 0x00ffff00: input to monitor. -// 0x00000000: none +// 0x00000000: force to low rate (44.1/48.0 kHz). +// 0x08000000: follow to system clock. +// 0x04000000: something relevant to clock. +// 0x03000000: enable output. +// 0x02000000: enabled irreversibly once standing unless the device voluntarily disables it. +// 0x01000000: enabled irreversibly once standing unless the device voluntarily disables it. +// 0x00ffff00: monitor input mode. +// 0x00000000: disabled // 0x00004800: analog-1/2 // 0x00005a00: analog-3/4 // 0x00006c00: analog-5/6 @@ -83,7 +91,7 @@ // 0x00007f00: analog-8 // 0x00104000: AES/EBU-1 // 0x00104900: AES/EBU-2 -// 0x00000060: sample rate conversin for AES/EBU input/output. +// 0x00000060: sample rate conversion for AES/EBU input/output. // 0x00000000: None // 0x00000020: input signal is converted to system rate // 0x00000040: output is slave to input, ignoring system rate @@ -97,16 +105,18 @@ // 0x00000000: internal // 0x00000001: ADAT on optical interface // 0x00000002: AES/EBU on XLR +// 0x00000003: source packet header (SPH) // 0x00000004: word clock on BNC // 0x00000005: ADAT on Dsub 9pin #define CLK_896_STATUS_OFFSET 0x0b14 #define CLK_896_STATUS_FLAG_FETCH_ENABLE 0x20000000 -#define CLK_896_STATUS_FLAG_MAIN_TO_HP 0x01000000 +#define CLK_896_STATUS_FLAG_OUTPUT_ON 0x03000000 #define CLK_896_STATUS_MASK_SRC 0x00000007 #define CLK_896_STATUS_FLAG_SRC_INTERNAL 0x00000000 #define CLK_896_STATUS_FLAG_SRC_ADAT_ON_OPT 0x00000001 #define CLK_896_STATUS_FLAG_SRC_AESEBU 0x00000002 +#define CLK_896_STATUS_FLAG_SRC_SPH 0x00000003 #define CLK_896_STATUS_FLAG_SRC_WORD 0x00000004 #define CLK_896_STATUS_FLAG_SRC_ADAT_ON_DSUB 0x00000005 #define CLK_896_STATUS_MASK_RATE 0x00000018 @@ -304,6 +314,9 @@ static int get_clock_source_896(struct snd_motu *motu, enum snd_motu_clock_sourc case CLK_896_STATUS_FLAG_SRC_AESEBU: *src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR; break; + case CLK_896_STATUS_FLAG_SRC_SPH: + *src = SND_MOTU_CLOCK_SOURCE_SPH; + break; case CLK_896_STATUS_FLAG_SRC_WORD: *src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC; break; @@ -362,9 +375,9 @@ static int switch_fetching_mode_896(struct snd_motu *motu, bool enable) return err; data = be32_to_cpu(reg); - data &= ~(CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP); + data &= ~CLK_896_STATUS_FLAG_FETCH_ENABLE; if (enable) - data |= (CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP); + data |= CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_OUTPUT_ON; reg = cpu_to_be32(data); return snd_motu_transaction_write(motu, CLK_896_STATUS_OFFSET, ®, sizeof(reg));