diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2014-04-25 09:44:48 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-05-26 08:13:44 -0400 |
commit | ccccad8646fad5f86f09adb040e02ca1a838585c (patch) | |
tree | 539472a8db665f9c2d5967cfb318e3f677ff20c4 | |
parent | 83d8d72dffa87a6dcecce229617273be62ec5bc0 (diff) |
ALSA: firewire-lib: Give syt value as parameter to handle_out_packet()
For duplex streams with synchronization, drivers should pick up
'presentation timestamp' from in-packets and use the timestamp for
out-packets. This commit is preparation for this.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/amdtp.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index a4553ec1b63e..24e9a961fe7e 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c | |||
@@ -257,7 +257,9 @@ static unsigned int calculate_data_blocks(struct amdtp_stream *s) | |||
257 | { | 257 | { |
258 | unsigned int phase, data_blocks; | 258 | unsigned int phase, data_blocks; |
259 | 259 | ||
260 | if (!cip_sfc_is_base_44100(s->sfc)) { | 260 | if (s->flags & CIP_BLOCKING) |
261 | data_blocks = s->syt_interval; | ||
262 | else if (!cip_sfc_is_base_44100(s->sfc)) { | ||
261 | /* Sample_rate / 8000 is an integer, and precomputed. */ | 263 | /* Sample_rate / 8000 is an integer, and precomputed. */ |
262 | data_blocks = s->data_block_state; | 264 | data_blocks = s->data_block_state; |
263 | } else { | 265 | } else { |
@@ -616,26 +618,22 @@ static inline int queue_in_packet(struct amdtp_stream *s) | |||
616 | amdtp_stream_get_max_payload(s), false); | 618 | amdtp_stream_get_max_payload(s), false); |
617 | } | 619 | } |
618 | 620 | ||
619 | static void handle_out_packet(struct amdtp_stream *s, unsigned int cycle) | 621 | static void handle_out_packet(struct amdtp_stream *s, unsigned int syt) |
620 | { | 622 | { |
621 | __be32 *buffer; | 623 | __be32 *buffer; |
622 | unsigned int index, data_blocks, syt, payload_length; | 624 | unsigned int data_blocks, payload_length; |
623 | struct snd_pcm_substream *pcm; | 625 | struct snd_pcm_substream *pcm; |
624 | 626 | ||
625 | if (s->packet_index < 0) | 627 | if (s->packet_index < 0) |
626 | return; | 628 | return; |
627 | index = s->packet_index; | ||
628 | 629 | ||
629 | /* this module generate empty packet for 'no data' */ | 630 | /* this module generate empty packet for 'no data' */ |
630 | syt = calculate_syt(s, cycle); | 631 | if (!(s->flags & CIP_BLOCKING) || (syt != CIP_SYT_NO_INFO)) |
631 | if (!(s->flags & CIP_BLOCKING)) | ||
632 | data_blocks = calculate_data_blocks(s); | 632 | data_blocks = calculate_data_blocks(s); |
633 | else if (syt != CIP_SYT_NO_INFO) | ||
634 | data_blocks = s->syt_interval; | ||
635 | else | 633 | else |
636 | data_blocks = 0; | 634 | data_blocks = 0; |
637 | 635 | ||
638 | buffer = s->buffer.packets[index].buffer; | 636 | buffer = s->buffer.packets[s->packet_index].buffer; |
639 | buffer[0] = cpu_to_be32(ACCESS_ONCE(s->source_node_id_field) | | 637 | buffer[0] = cpu_to_be32(ACCESS_ONCE(s->source_node_id_field) | |
640 | (s->data_block_quadlets << AMDTP_DBS_SHIFT) | | 638 | (s->data_block_quadlets << AMDTP_DBS_SHIFT) | |
641 | s->data_block_counter); | 639 | s->data_block_counter); |
@@ -746,7 +744,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 cycle, | |||
746 | void *private_data) | 744 | void *private_data) |
747 | { | 745 | { |
748 | struct amdtp_stream *s = private_data; | 746 | struct amdtp_stream *s = private_data; |
749 | unsigned int i, packets = header_length / 4; | 747 | unsigned int i, syt, packets = header_length / 4; |
750 | 748 | ||
751 | /* | 749 | /* |
752 | * Compute the cycle of the last queued packet. | 750 | * Compute the cycle of the last queued packet. |
@@ -755,8 +753,10 @@ static void out_stream_callback(struct fw_iso_context *context, u32 cycle, | |||
755 | */ | 753 | */ |
756 | cycle += QUEUE_LENGTH - packets; | 754 | cycle += QUEUE_LENGTH - packets; |
757 | 755 | ||
758 | for (i = 0; i < packets; ++i) | 756 | for (i = 0; i < packets; ++i) { |
759 | handle_out_packet(s, ++cycle); | 757 | syt = calculate_syt(s, ++cycle); |
758 | handle_out_packet(s, syt); | ||
759 | } | ||
760 | fw_iso_context_queue_flush(s->context); | 760 | fw_iso_context_queue_flush(s->context); |
761 | } | 761 | } |
762 | 762 | ||