diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-03-22 21:30:15 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-03-28 12:33:24 +0200 |
commit | a04513f8b1980e7ddd9082461aceaf8b3e8f4981 (patch) | |
tree | cacb1f98f5650c58664294310d76119362695285 /sound/firewire/amdtp-stream.c | |
parent | 59f6482c2183fc3b3e42e0e2ae83a347ee6346c5 (diff) | |
download | linux-stable-a04513f8b1980e7ddd9082461aceaf8b3e8f4981.tar.gz linux-stable-a04513f8b1980e7ddd9082461aceaf8b3e8f4981.tar.bz2 linux-stable-a04513f8b1980e7ddd9082461aceaf8b3e8f4981.zip |
ALSA: firewire-lib: record cycle count for the first packet
Currently, packet streaming layer passes generated SYT value to data block
processing layer. However, this is not enough in a case that the data block
processing layer generates time stamps by its own ways.
For out-packet stream, the packet streaming layer guarantees 8,000 times
calls of data block processing layers per sec. Therefore, when cycle count
of the first packet is recorded, data block processing layers can calculate
own time stamps with the recorded value.
For the reason, this commit allows packet streaming layer to record the
first cycle count. Each data block processing layer can read the count by
accessing a member of structure for packet streaming layer.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/amdtp-stream.c')
-rw-r--r-- | sound/firewire/amdtp-stream.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 00060c4a9deb..371cf978fbed 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -671,6 +671,8 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, void *header, void *private_data) { struct amdtp_stream *s = private_data; + u32 cycle; + unsigned int packets; /* * For in-stream, first packet has come. @@ -679,10 +681,19 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, s->callbacked = true; wake_up(&s->callback_wait); - if (s->direction == AMDTP_IN_STREAM) + cycle = compute_cycle_count(tstamp); + + if (s->direction == AMDTP_IN_STREAM) { + packets = header_length / IN_PACKET_HEADER_SIZE; + cycle = decrement_cycle_count(cycle, packets); context->callback.sc = in_stream_callback; - else + } else { + packets = header_length / 4; + cycle = increment_cycle_count(cycle, QUEUE_LENGTH - packets); context->callback.sc = out_stream_callback; + } + + s->start_cycle = cycle; context->callback.sc(context, tstamp, header_length, header, s); } |