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, ffado-devel@lists.sf.net
Subject: [PATCH 07/19] firewire-lib: enable CIP_DBC_IS_END_EVENT for both directions of stream
Date: Sun, 29 Jan 2017 12:54:05 +0900	[thread overview]
Message-ID: <20170129035417.2095-8-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20170129035417.2095-1-o-takashi@sakamocchi.jp>

Commit c8bdf49b9935("ALSA: fireworks/firewire-lib: Add a quirk for the
meaning of dbc") adds CIP_DBC_IS_END_EVENT flag just for tx packets.
However, MOTU FireWire series has this quirk for rx packets.

This commit allows both directions with the flag.

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

diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 65c5ed7..f9d12f4 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -426,6 +426,10 @@ static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle,
 	data_blocks = calculate_data_blocks(s, syt);
 	pcm_frames = s->process_data_blocks(s, buffer + 2, data_blocks, &syt);
 
+	if (s->flags & CIP_DBC_IS_END_EVENT)
+		s->data_block_counter =
+				(s->data_block_counter + data_blocks) & 0xff;
+
 	buffer[0] = cpu_to_be32(ACCESS_ONCE(s->source_node_id_field) |
 				(s->data_block_quadlets << CIP_DBS_SHIFT) |
 				((s->sph << CIP_SPH_SHIFT) & CIP_SPH_MASK) |
@@ -435,7 +439,9 @@ static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle,
 				((s->fdf << CIP_FDF_SHIFT) & CIP_FDF_MASK) |
 				(syt & CIP_SYT_MASK));
 
-	s->data_block_counter = (s->data_block_counter + data_blocks) & 0xff;
+	if (!(s->flags & CIP_DBC_IS_END_EVENT))
+		s->data_block_counter =
+				(s->data_block_counter + data_blocks) & 0xff;
 	payload_length = 8 + data_blocks * 4 * s->data_block_quadlets;
 
 	trace_out_packet(s, cycle, buffer, payload_length, index);
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h
index 679053d..d2a3163 100644
--- a/sound/firewire/amdtp-stream.h
+++ b/sound/firewire/amdtp-stream.h
@@ -18,8 +18,8 @@
  *	SYT_INTERVAL samples, with these two types alternating so that
  *	the overall sample rate comes out right.
  * @CIP_EMPTY_WITH_TAG0: Only for in-stream. Empty in-packets have TAG0.
- * @CIP_DBC_IS_END_EVENT: Only for in-stream. The value of dbc in an in-packet
- *	corresponds to the end of event in the packet. Out of IEC 61883.
+ * @CIP_DBC_IS_END_EVENT: The value of dbc in an packet corresponds to the end
+ * of event in the packet. Out of IEC 61883.
  * @CIP_WRONG_DBS: Only for in-stream. The value of dbs is wrong in in-packets.
  *	The value of data_block_quadlets is used instead of reported value.
  * @CIP_SKIP_DBC_ZERO_CHECK: Only for in-stream.  Packets with zero in dbc is
-- 
2.9.3

  parent reply	other threads:[~2017-01-29  3:54 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-29  3:53 [PATCH 00/19][RFC v2] ALSA: firewire-motu: new driver for MOTU FireWire series Takashi Sakamoto
2017-01-29  3:53 ` [PATCH 01/19] firewire-motu: add skeleton for Mark of the unicorn (MOTU) " Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 02/19] firewire-motu: postpone sound card registration Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 03/19] firewire-motu: add a structure for model-dependent parameters Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 04/19] firewire-motu: add an abstraction layer for three types of protocols Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 05/19] firewire-lib: record cycle count for the first packet Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 06/19] firewire-lib: add support for source packet header field in CIP header Takashi Sakamoto
2017-01-29  3:54 ` Takashi Sakamoto [this message]
2017-01-29  3:54 ` [PATCH 08/19] firewire-motu: add MOTU specific protocol layer Takashi Sakamoto
2017-01-29 13:16   ` [FFADO-devel] " Jonathan Woithe
2017-01-30  3:50     ` Takashi Sakamoto
2017-01-30  5:04       ` Jonathan Woithe
2017-01-30  6:11         ` Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 09/19] firewire-motu: handle transactions specific for MOTU FireWire models Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 10/19] firewire-motu: add stream management functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 11/19] firewire-motu: add proc node to show current statuc of clock and packet formats Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 12/19] firewire-motu: add PCM functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 13/19] firewire-motu: add MIDI functionality Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 14/19] firewire-motu: add hwdep interface Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 15/19] firewire-motu: enable to read transaction cache via " Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 16/19] firewire-motu: add support for MOTU 828 as a model with protocol version 1 Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 17/19] firewire-motu: add support for MOTU 828mk2 as a model with protocol version 2 Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 18/19] firewire-lib: add a quirk of packet without valid EOH in CIP format Takashi Sakamoto
2017-01-29  3:54 ` [PATCH 19/19] firewire-motu: add support for MOTU 828mk3 (FireWire/Hybrid) as a model with protocol version 3 Takashi Sakamoto
2017-01-29 13:22 ` [FFADO-devel] [PATCH 00/19][RFC v2] ALSA: firewire-motu: new driver for MOTU FireWire series Jonathan Woithe
2017-01-30  3:09   ` Takashi Sakamoto
2017-01-29 13:34 ` [FFADO-devel] " Jonathan Woithe
2017-01-30  3:17   ` Takashi Sakamoto

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=20170129035417.2095-8-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=ffado-devel@lists.sf.net \
    --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.