aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-05-22 10:33:01 +0900
committerTakashi Iwai <tiwai@suse.de>2021-05-22 08:47:42 +0200
commitc79b7158b04a96694a63a6cf9a5d07a95ea2d3a4 (patch)
tree9ba7133753023fa7ba4a164b4b76b2a3f17a75a0 /sound/firewire
parentALSA: firewire-lib: code refactoring for generation of packet descriptors (diff)
downloadlinux-dev-c79b7158b04a96694a63a6cf9a5d07a95ea2d3a4.tar.xz
linux-dev-c79b7158b04a96694a63a6cf9a5d07a95ea2d3a4.zip
ALSA: firewire-lib: code refactoring for generation of syt sequence
This commit dissolves sequence generator in terms of syt offsets for packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210522013303.49596-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/amdtp-stream.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 354512a350b7..77ae75e79a43 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -441,8 +441,30 @@ static unsigned int calculate_syt_offset(unsigned int *last_syt_offset,
return syt_offset;
}
+static void pool_ideal_syt_offsets(struct amdtp_stream *s, struct seq_desc *descs,
+ const unsigned int seq_size, unsigned int seq_tail,
+ unsigned int count)
+{
+ const enum cip_sfc sfc = s->sfc;
+ unsigned int last = s->ctx_data.rx.last_syt_offset;
+ unsigned int state = s->ctx_data.rx.syt_offset_state;
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ struct seq_desc *desc = descs + seq_tail;
+
+ desc->syt_offset = calculate_syt_offset(&last, &state, sfc);
+
+ seq_tail = (seq_tail + 1) % seq_size;
+ }
+
+ s->ctx_data.rx.last_syt_offset = last;
+ s->ctx_data.rx.syt_offset_state = state;
+}
+
static void pool_ideal_seq_descs(struct amdtp_stream *s, unsigned int count)
{
+ struct seq_desc *descs = s->ctx_data.rx.seq.descs;
unsigned int seq_tail = s->ctx_data.rx.seq.tail;
const unsigned int seq_size = s->ctx_data.rx.seq.size;
const unsigned int syt_interval = s->syt_interval;
@@ -450,11 +472,11 @@ static void pool_ideal_seq_descs(struct amdtp_stream *s, unsigned int count)
const bool is_blocking = !!(s->flags & CIP_BLOCKING);
int i;
+ pool_ideal_syt_offsets(s, descs, seq_size, seq_tail, count);
+
for (i = 0; i < count; ++i) {
struct seq_desc *desc = s->ctx_data.rx.seq.descs + seq_tail;
- desc->syt_offset = calculate_syt_offset(&s->ctx_data.rx.last_syt_offset,
- &s->ctx_data.rx.syt_offset_state, sfc);
desc->data_blocks = calculate_data_blocks(&s->ctx_data.rx.data_block_state,
is_blocking, desc->syt_offset == CIP_SYT_NO_INFO,
syt_interval, sfc);