From patchwork Mon May 31 02:51: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: 451467 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, URIBL_BLOCKED, 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 0C774C47092 for ; Mon, 31 May 2021 02:54:35 +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 78A7B61220 for ; Mon, 31 May 2021 02:54:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78A7B61220 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 0668F84D; Mon, 31 May 2021 04:53:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0668F84D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1622429673; bh=4gRZ4qRqPkHvvZRFWJDfXPgUMUt0tzz8L8Pdb+OPI8o=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=itTDy2FJBic9YHtZ49rbVsr/YVNREpnXoXbtINjqybzBnQOG51KlbQEnRD2+k9kJq Ie7ySd9VMf/HCikrX0Sn2Cw1nC3Mm+dpkeRNMDYI3qRXVWL8TX6iS73k7HeXC2Y0yx M6d6n+7z1zWNEF2WwQ8w/2a7kQhm+ObwiPLfbe80= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EBF8AF804CF; Mon, 31 May 2021 04:51:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0C706F80161; Mon, 31 May 2021 04:51:25 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 87A61F80161 for ; Mon, 31 May 2021 04:51:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 87A61F80161 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="yFiB8Jhp"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xh917GLK" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B2DB85C007A; Sun, 30 May 2021 22:51:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 30 May 2021 22:51: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=qHbSruROp/+oa 9Tcoi0XwY2p7XRXm6YocMyxo7fIxqY=; b=yFiB8Jhpnd/sDh8QieDWDrljBxeL0 teg6APT2nrWi8bp9Wml38MxBfmDuM26lqfvxjsUf7kCXZ2FUhKpjVut09pLXzGJa eEnsDrw+bW+HZkLaunm7BpadVCiMeQ9SSS/6VinDSlNEqpuB7+4r/bZq2HGW+5Qu JJ+bqItHGqd/EqlHdcwvIuu3SZSOWzmV93FALrTd0Z1UyrJFTqtZ1J8OL5cKKD3a BJHBGwRQmH3AY5eRgR6YX0k++dGLDK72ZnyU2nxx/3pKmzPE6jjVfjkqF+CgaJQq FqPj5ZZgqQRAd7LDLvPTfc4rCp4JgoO1mFcKsIpIIJ45k//Q9IBs0j0AA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=qHbSruROp/+oa9Tcoi0XwY2p7XRXm6YocMyxo7fIxqY=; b=Xh917GLK EnEhXjrmmrg4aXEuSdfQd02ji4+xvmuyigt6YqneYAx0gTl9MlibdBh58TJklwpm sicm/6CkTVaqmB9uvTTuvPPZw8kjqetSqu62aR5+IrDXkFwuSBsh2v1pBPxMEFfS euhOBFEyK1Hsp77D5Qm13pGMQA6U3yrnkREzKHL+gTw4o6NDgcoXYHXaP5gHuzu7 ms46CyExCQQ+UC6HO5Oemdl4/22qQUXD2XU6rrC8nvBS8MqGCzmY7noWW5AxtkJ/ iHtT0D7VuFTuYQNB/t65zd9hpZdwv97B+2eudADAi80AX+cVD3rECFB9Bhc8FSZq TIFYbSSCs0G2Zg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdelvddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihessh grkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 30 May 2021 22:51:12 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 4/6] ALSA: firewire-digi00x: perform sequence replay for media clock recovery Date: Mon, 31 May 2021 11:51:01 +0900 Message-Id: <20210531025103.17880-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210531025103.17880-1-o-takashi@sakamocchi.jp> References: <20210531025103.17880-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 takes ALSA firewire-digi00x driver to perform sequence replay for media clock recovery. All of models in Digidesign digi00x family don't transfer isochronous packets till receiving isochronous packets. The on-the-fly mode is used for the purpose. They don't interpret presentation time expressed in syt field of received CIP, therefore the sequence of the number of data blocks per packet is important for media clock recovery. The sequence replay is tested with below models: * Digidesign Digi 002 * Digidesign Digi 002 Rack * Digidesign Digi 003 * Digidesign Digi 003 Rack Signed-off-by: Takashi Sakamoto --- sound/firewire/digi00x/amdtp-dot.c | 9 +++------ sound/firewire/digi00x/digi00x-stream.c | 8 ++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sound/firewire/digi00x/amdtp-dot.c b/sound/firewire/digi00x/amdtp-dot.c index 398c57a6fb43..59b86c8d89e1 100644 --- a/sound/firewire/digi00x/amdtp-dot.c +++ b/sound/firewire/digi00x/amdtp-dot.c @@ -396,16 +396,13 @@ int amdtp_dot_init(struct amdtp_stream *s, struct fw_unit *unit, enum amdtp_stream_direction dir) { amdtp_stream_process_ctx_payloads_t process_ctx_payloads; - unsigned int flags; + unsigned int flags = CIP_NONBLOCKING | CIP_UNAWARE_SYT; // Use different mode between incoming/outgoing. - if (dir == AMDTP_IN_STREAM) { - flags = CIP_NONBLOCKING; + if (dir == AMDTP_IN_STREAM) process_ctx_payloads = process_ir_ctx_payloads; - } else { - flags = CIP_BLOCKING; + else process_ctx_payloads = process_it_ctx_payloads; - } return amdtp_stream_init(s, unit, dir, flags, CIP_FMT_AM, process_ctx_payloads, sizeof(struct amdtp_dot)); diff --git a/sound/firewire/digi00x/digi00x-stream.c b/sound/firewire/digi00x/digi00x-stream.c index 2019f6533477..a15f55b0dce3 100644 --- a/sound/firewire/digi00x/digi00x-stream.c +++ b/sound/firewire/digi00x/digi00x-stream.c @@ -7,7 +7,7 @@ #include "digi00x.h" -#define READY_TIMEOUT_MS 500 +#define READY_TIMEOUT_MS 200 const unsigned int snd_dg00x_stream_rates[SND_DG00X_RATE_COUNT] = { [SND_DG00X_RATE_44100] = 44100, @@ -375,7 +375,11 @@ int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x) if (err < 0) goto error; - err = amdtp_domain_start(&dg00x->domain, 0, false, false); + // NOTE: The device doesn't start packet transmission till receiving any packet. + // It ignores presentation time expressed by the value of syt field of CIP header + // in received packets. The sequence of the number of data blocks per packet is + // important for media clock recovery. + err = amdtp_domain_start(&dg00x->domain, 0, true, true); if (err < 0) goto error;