Commit 13d11f14 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-lib: code refactoring for transfer delay

In later commit, transfer delay is used in both IR and IT contexts. This
commit refactors regardless of transfer delay.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210522013303.49596-7-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c9f3ac2a
...@@ -294,17 +294,11 @@ int amdtp_stream_set_parameters(struct amdtp_stream *s, unsigned int rate, ...@@ -294,17 +294,11 @@ int amdtp_stream_set_parameters(struct amdtp_stream *s, unsigned int rate,
s->syt_interval = amdtp_syt_intervals[sfc]; s->syt_interval = amdtp_syt_intervals[sfc];
// default buffering in the device. // default buffering in the device.
if (s->direction == AMDTP_OUT_STREAM) { s->transfer_delay = TRANSFER_DELAY_TICKS - TICKS_PER_CYCLE;
s->ctx_data.rx.transfer_delay =
TRANSFER_DELAY_TICKS - TICKS_PER_CYCLE; // additional buffering needed to adjust for no-data packets.
if (s->flags & CIP_BLOCKING)
if (s->flags & CIP_BLOCKING) { s->transfer_delay += TICKS_PER_SECOND * s->syt_interval / rate;
// additional buffering needed to adjust for no-data
// packets.
s->ctx_data.rx.transfer_delay +=
TICKS_PER_SECOND * s->syt_interval / rate;
}
}
return 0; return 0;
} }
...@@ -897,12 +891,10 @@ static void generate_pkt_descs(struct amdtp_stream *s, const __be32 *ctx_header, ...@@ -897,12 +891,10 @@ static void generate_pkt_descs(struct amdtp_stream *s, const __be32 *ctx_header,
desc->cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size); desc->cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size);
if (aware_syt && seq->syt_offset != CIP_SYT_NO_INFO) { if (aware_syt && seq->syt_offset != CIP_SYT_NO_INFO)
desc->syt = compute_syt(seq->syt_offset, desc->cycle, desc->syt = compute_syt(seq->syt_offset, desc->cycle, s->transfer_delay);
s->ctx_data.rx.transfer_delay); else
} else {
desc->syt = CIP_SYT_NO_INFO; desc->syt = CIP_SYT_NO_INFO;
}
desc->data_blocks = seq->data_blocks; desc->data_blocks = seq->data_blocks;
......
...@@ -140,15 +140,13 @@ struct amdtp_stream { ...@@ -140,15 +140,13 @@ struct amdtp_stream {
unsigned int dbc_interval; unsigned int dbc_interval;
} tx; } tx;
struct { struct {
// To calculate CIP data blocks and tstamp.
unsigned int transfer_delay;
// To generate CIP header. // To generate CIP header.
unsigned int fdf; unsigned int fdf;
// To generate constant hardware IRQ. // To generate constant hardware IRQ.
unsigned int event_count; unsigned int event_count;
// To calculate CIP data blocks and tstamp.
struct { struct {
struct seq_desc *descs; struct seq_desc *descs;
unsigned int size; unsigned int size;
...@@ -169,7 +167,8 @@ struct amdtp_stream { ...@@ -169,7 +167,8 @@ struct amdtp_stream {
unsigned int sph; unsigned int sph;
unsigned int fmt; unsigned int fmt;
/* Internal flags. */ // Internal flags.
unsigned int transfer_delay;
enum cip_sfc sfc; enum cip_sfc sfc;
unsigned int syt_interval; unsigned int syt_interval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment