]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: firewire-lib: add syt_override member for some protocols
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 22 Jul 2019 03:36:56 +0000 (12:36 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 22 Jul 2019 14:05:00 +0000 (16:05 +0200)
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c
sound/firewire/amdtp-stream.h
sound/firewire/motu/amdtp-motu.c
sound/firewire/tascam/amdtp-tascam.c

index 3435bef97a8b9fb2d98fd5fac086ba4486abc342..6242240cd8eec06684af927cbbc2f62ff466b934 100644 (file)
@@ -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);
 
index 762ac3c7e9023efc06dd3155dc7434fd465fd408..5b9d4212e202fe75f77657d4341bbbeaab2b2a2b 100644 (file)
@@ -133,6 +133,7 @@ struct amdtp_stream {
 
                        // To generate CIP header.
                        unsigned int fdf;
+                       int syt_override;
                } rx;
        } ctx_data;
 
index 9693f37a0032c9fa0af5c17c855266d9887ca5bd..68387369988511ee091052b88f6205f09889b82a 100644 (file)
@@ -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;
 }
index 3a4d1f855f7993ccaba1a4faee2635486a707eeb..8fba6fb8ba8a35371967287278dda163cefbb11e 100644 (file)
@@ -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;