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 06/20] ALSA: firewire-lib: add syt_override member for some protocols
Date: Mon, 22 Jul 2019 12:36:56 +0900	[thread overview]
Message-ID: <20190722033710.28107-7-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20190722033710.28107-1-o-takashi@sakamocchi.jp>

Some protocols don't use syt field of CIP header to represent
presentation timestamp. For such protocol, ALSA IEC 61883-1/6
packet streaming engine uses a pointer into local variable for
the value of syt to call data block processing layer. However,
it can decide the value when initializing packet streaming
layer.

This commit adds 'syt_override' member for packet streaming
layer.

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

diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 3435bef97a8b..6242240cd8ee 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -104,6 +104,9 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
 	s->fmt = fmt;
 	s->process_data_blocks = process_data_blocks;
 
+	if (dir == AMDTP_OUT_STREAM)
+		s->ctx_data.rx.syt_override = -1;
+
 	return 0;
 }
 EXPORT_SYMBOL(amdtp_stream_init);
@@ -717,6 +720,9 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp,
 		if (s->flags & CIP_DBC_IS_END_EVENT)
 			dbc = (dbc + data_blocks) & 0xff;
 
+		if (s->ctx_data.rx.syt_override >= 0)
+			syt = s->ctx_data.rx.syt_override;
+
 		build_it_pkt_header(s, cycle, &template.params, data_blocks,
 				    dbc, syt, i);
 
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h
index 762ac3c7e902..5b9d4212e202 100644
--- a/sound/firewire/amdtp-stream.h
+++ b/sound/firewire/amdtp-stream.h
@@ -133,6 +133,7 @@ struct amdtp_stream {
 
 			// To generate CIP header.
 			unsigned int fdf;
+			int syt_override;
 		} rx;
 	} ctx_data;
 
diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c
index 9693f37a0032..683873699885 100644
--- a/sound/firewire/motu/amdtp-motu.c
+++ b/sound/firewire/motu/amdtp-motu.c
@@ -428,7 +428,13 @@ int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
 		return err;
 
 	s->sph = 1;
-	s->ctx_data.rx.fdf = MOTU_FDF_AM824;
+
+	if (dir == AMDTP_OUT_STREAM) {
+		// Use fixed value for FDF field.
+		s->ctx_data.rx.fdf = MOTU_FDF_AM824;
+		// Not used.
+		s->ctx_data.rx.syt_override = 0xffff;
+	}
 
 	return 0;
 }
diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c
index 3a4d1f855f79..8fba6fb8ba8a 100644
--- a/sound/firewire/tascam/amdtp-tascam.c
+++ b/sound/firewire/tascam/amdtp-tascam.c
@@ -220,8 +220,12 @@ int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit,
 	if (err < 0)
 		return 0;
 
-	/* Use fixed value for FDF field. */
-	s->ctx_data.rx.fdf = 0x00;
+	if (dir == AMDTP_OUT_STREAM) {
+		// Use fixed value for FDF field.
+		s->ctx_data.rx.fdf = 0x00;
+		// Not used.
+		s->ctx_data.rx.syt_override = 0x0000;
+	}
 
 	/* This protocol uses fixed number of data channels for PCM samples. */
 	p = s->protocol;
-- 
2.20.1

  parent reply	other threads:[~2019-07-22  3:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22  3:36 [PATCH 00/20] ALSA: firewire-lib: use packet descriptor to represent sequence of packet Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 01/20] ALSA: firewire-lib: obsolete ctx_data.tx.first_dbc with CIP_UNALIGHED_DBC flag Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 02/20] ALSA: firewire-lib: pass data block count as an argument to tracepoints event Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 03/20] ALSA: firewire-lib: pass data block counter to data block processing layer Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 04/20] ALSA: firewire-lib: operate data block counter in top level of processing for IT context Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 05/20] ALSA: firewire-lib: operate data block counter in top level of processing for IR context Takashi Sakamoto
2019-07-22  3:36 ` Takashi Sakamoto [this message]
2019-07-22  3:36 ` [PATCH 07/20] ALSA: firewire-lib: pass no syt information to data block processing layer Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 08/20] ALSA: firewire-lib: add list of packet descriptor Takashi Sakamoto
2019-07-22  3:36 ` [PATCH 09/20] ALSA: firewire-lib: use packet descriptor for IT context Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 10/20] ALSA: firewire-lib: use packet descriptor for IR context Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 11/20] ALSA: firewire-lib: code refactoring to process PCM substream Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 12/20] ALSA: firewire-lib: code refactoring to process context payloads Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 13/20] ALSA: firewire-lib: pass packet descriptor to data block processing layer Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 14/20] ALSA: firewire-lib: code refactoring for AM824 " Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 15/20] ALSA: firewire-digi00x: code refactoring for DOT " Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 16/20] ALSA: firewire-tascam: code refactoring for TASCAM " Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 17/20] ALSA: firewire-motu: code refactoring for MOTU " Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 18/20] ALSA: fireface: code refactoring for FF " Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 19/20] ALSA: firewire-lib: process payload of isoc context according to packet descriptors Takashi Sakamoto
2019-07-22  3:37 ` [PATCH 20/20] ALSA: firewire-motu: more code refactoring for MOTU data block processing layer Takashi Sakamoto
2019-07-22 14:12 ` [PATCH 00/20] ALSA: firewire-lib: use packet descriptor to represent sequence of packet 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=20190722033710.28107-7-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.