From patchwork Fri Nov 23 04:13:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10695027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D43A5A4 for ; Fri, 23 Nov 2018 04:13:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BC6D2BCD8 for ; Fri, 23 Nov 2018 04:13:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FEF72BD0A; Fri, 23 Nov 2018 04:13:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1E642BCD8 for ; Fri, 23 Nov 2018 04:13:46 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4DD4A267A70; Fri, 23 Nov 2018 05:13:39 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C8C78267961; Fri, 23 Nov 2018 05:13:35 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by alsa0.perex.cz (Postfix) with ESMTP id DB04926786E for ; Fri, 23 Nov 2018 05:13:33 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id c72so2754312pfc.6 for ; Thu, 22 Nov 2018 20:13:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0JsuyWEQhhJvoRhQYtQrZBR/fiT9wZ+jue514yi9CEw=; b=IKeZRAxlhFKolDLqldk9LisMCSFJUaqs2DiLp33SQB+Mv9o2gwMl9L7x9MZ14JoVJw BHf8YISuWCtxWjo62IWdWUJ8EiLlCpLUr5poqi2iUpQSt0SyIRVJR4d2viHcRZKqp17R 3mTEZNZyAxAHJ5luEa2WmPRpE2XO5tqK+vqcpI0pShCM3gnXxke7BJ5ipWECkMnsbTI4 XFCLdLuilDmEMHbyBOQNZ9XhK5/pLQAMA7bbTrclgaVj5n1qQLCMCm4t5OtvjFzzKXja lCdjQSaONoV0pOrdwnbnDqNn3KC0Dzg3JIzZlqiT2LSa38R/Lj2SkgIa1wSYjwcDy5eA 37tQ== X-Gm-Message-State: AA+aEWZMSPjgED5nfOB2MemVf0juguPCmyaOHkIDlmzgVh9FRZlatdee RnQxTnCtVGOQNbQ/LIqMz9c= X-Google-Smtp-Source: AFSGD/UDZFPxDH4sQ7v/mzxtBkz18nDGlftXkCn2bQRS2rQxmDCx/9rtluO9f9JlydzOBvxbHv50bw== X-Received: by 2002:a63:5153:: with SMTP id r19mr12555724pgl.281.1542946412769; Thu, 22 Nov 2018 20:13:32 -0800 (PST) Received: from localhost.localdomain ([2405:6580:9660:3200:4919:eeb8:ecba:c7a8]) by smtp.gmail.com with ESMTPSA id r83sm82199559pfc.115.2018.11.22.20.13.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 20:13:32 -0800 (PST) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Fri, 23 Nov 2018 13:13:03 +0900 Message-Id: <20181123041307.22980-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123041307.22980-1-o-takashi@sakamocchi.jp> References: <20181123041307.22980-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: sbahling@suse.com, alsa-devel@alsa-project.org, ffado-devel@lists.sourceforge.net Subject: [alsa-devel] [PATCH 1/5] ALSA: firewire-tascam: pick up data of state from tx isochronous pakcets X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Units of TASCAM FireWire series multiplex PCM frames and state of control surface into the same tx isochronous packets. One isochronous packet includes a part of the state in a quadlet data. An image of the state consists of 64 quadlet data. This commit demultiplexes the state from tx isochronous packets. Signed-off-by: Takashi Sakamoto --- include/uapi/sound/firewire.h | 2 ++ sound/firewire/tascam/amdtp-tascam.c | 17 ++++++++++++++++- sound/firewire/tascam/tascam.h | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h index f0a547d86679..b9bc4bb1756b 100644 --- a/include/uapi/sound/firewire.h +++ b/include/uapi/sound/firewire.h @@ -88,4 +88,6 @@ struct snd_firewire_get_info { * Returns -EBUSY if the driver is already streaming. */ +#define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64 + #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */ diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c index ab482423c165..516cb931fd5e 100644 --- a/sound/firewire/tascam/amdtp-tascam.c +++ b/sound/firewire/tascam/amdtp-tascam.c @@ -117,6 +117,21 @@ int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s, return amdtp_stream_add_pcm_hw_constraints(s, runtime); } +static void read_status_messages(struct amdtp_stream *s, + __be32 *buffer, unsigned int data_blocks) +{ + struct snd_tscm *tscm = container_of(s, struct snd_tscm, tx_stream); + int i; + + for (i = 0; i < data_blocks; i++) { + unsigned int index; + + index = be32_to_cpu(buffer[0]) % SNDRV_FIREWIRE_TASCAM_STATE_COUNT; + tscm->state[index] = buffer[s->data_block_quadlets - 1]; + buffer += s->data_block_quadlets; + } +} + static unsigned int process_tx_data_blocks(struct amdtp_stream *s, __be32 *buffer, unsigned int data_blocks, @@ -128,7 +143,7 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s, if (data_blocks > 0 && pcm) read_pcm_s32(s, pcm, buffer, data_blocks); - /* A place holder for control messages. */ + read_status_messages(s, buffer, data_blocks); return data_blocks; } diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h index a5bd167eb5d9..c710496a99cf 100644 --- a/sound/firewire/tascam/tascam.h +++ b/sound/firewire/tascam/tascam.h @@ -89,6 +89,9 @@ struct snd_tscm { /* For MIDI message outgoing transactions. */ struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX]; + + // A cache of status information in tx isoc packets. + __be32 state[SNDRV_FIREWIRE_TASCAM_STATE_COUNT]; }; #define TSCM_ADDR_BASE 0xffff00000000ull