All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 10/14] ALSA: firewire-motu: use table-based calculation of packet formats for stream management
Date: Tue, 19 May 2020 20:16:37 +0900	[thread overview]
Message-ID: <20200519111641.123211-11-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20200519111641.123211-1-o-takashi@sakamocchi.jp>

This commit uses table-based calculation of packet formats for stream
management.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/motu/amdtp-motu.c  | 12 ++++--------
 sound/firewire/motu/motu-stream.c |  4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c
index 17c9ea8eb4c8..edb31ac26868 100644
--- a/sound/firewire/motu/amdtp-motu.c
+++ b/sound/firewire/motu/amdtp-motu.c
@@ -76,15 +76,11 @@ int amdtp_motu_set_parameters(struct amdtp_stream *s, unsigned int rate,
 	if (i == ARRAY_SIZE(snd_motu_clock_rates))
 		return -EINVAL;
 
-	pcm_chunks = formats->fixed_part_pcm_chunks[mode] +
-		     formats->differed_part_pcm_chunks[mode];
+	// Each data block includes SPH in its head. Data chunks follow with
+	// 3 byte alignment. Padding follows with zero to conform to quadlet
+	// alignment.
+	pcm_chunks = formats->pcm_chunks[mode];
 	data_chunks = formats->msg_chunks + pcm_chunks;
-
-	/*
-	 * Each data block includes SPH in its head. Data chunks follow with
-	 * 3 byte alignment. Padding follows with zero to conform to quadlet
-	 * alignment.
-	 */
 	data_block_quadlets = 1 + DIV_ROUND_UP(data_chunks * 3, 4);
 
 	err = amdtp_stream_set_parameters(s, rate, data_block_quadlets);
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c
index 87a8d9016f83..2028c5419f6f 100644
--- a/sound/firewire/motu/motu-stream.c
+++ b/sound/firewire/motu/motu-stream.c
@@ -201,9 +201,9 @@ static int ensure_packet_formats(struct snd_motu *motu)
 	data &= ~(TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS |
 		  RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS|
 		  TX_PACKET_TRANSMISSION_SPEED_MASK);
-	if (motu->tx_packet_formats.differed_part_pcm_chunks[0] == 0)
+	if (motu->spec->tx_fixed_pcm_chunks[0] == motu->tx_packet_formats.pcm_chunks[0])
 		data |= TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
-	if (motu->rx_packet_formats.differed_part_pcm_chunks[0] == 0)
+	if (motu->spec->rx_fixed_pcm_chunks[0] == motu->rx_packet_formats.pcm_chunks[0])
 		data |= RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
 	data |= fw_parent_device(motu->unit)->max_speed;
 
-- 
2.25.1


  parent reply	other threads:[~2020-05-19 11:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 11:16 [PATCH 00/14] ALSA: firewire-motu: code refactoring to obsolete protocol structure Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 01/14] ALSA: firewire-motu: move spec data to v2 protocol file Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 02/14] ALSA: firewire-motu: move spec data to v3 " Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 03/14] ALSA: firewire-motu: localize protocol data Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 04/14] ALSA: firewire-motu: add wrapper functions for protocol-dependent operations Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 05/14] ALSA: firewire-motu: drop protocol structure Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 06/14] ALSA: firewire-motu: add model-specific table of chunk count Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 07/14] ALSA: firewire-motu: add alternative functions to detect packet format for protocol v2 Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 08/14] ALSA: firewire-motu: add alternative functions to detect packet format for protocol v3 Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 09/14] ALSA: firewire-motu: use table-based calculation of packet formats for proc Takashi Sakamoto
2020-05-19 11:16 ` Takashi Sakamoto [this message]
2020-05-19 11:16 ` [PATCH 11/14] ALSA: firewire-motu: remove obsoleted codes Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 12/14] ALSA: firewire-motu: refactoring protocol v2 for clock source getter Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 13/14] ALSA: firewire-motu: refactoring protocol v3 " Takashi Sakamoto
2020-05-19 11:16 ` [PATCH 14/14] ALSA: firewire-motu: refactoring protocol v2 for fetching mode switch Takashi Sakamoto
2020-05-22 14:53 ` [PATCH 00/14] ALSA: firewire-motu: code refactoring to obsolete protocol structure Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200519111641.123211-11-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.