diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2021-05-22 04:32:58 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-05-22 09:46:41 +0300 |
commit | 8070d2652e735585d31a50ff4f9bbaf2b5a49b10 (patch) | |
tree | 7e4a3e293b5da5c381f918d5568f2c2d0e53f288 /sound/firewire | |
parent | 344f0f821a7ee77832f04451e616f313b7d93f1a (diff) | |
download | linux-8070d2652e735585d31a50ff4f9bbaf2b5a49b10.tar.xz |
ALSA: firewire-lib: add flag to unaware of syt in CIP header
Many devices are unaware of syt field in rx CIP for playback timing.
This commit adds a flag to cancel processing syt field. Actually,
syt calculation is required to decide the number of events per rx packet.
The flag put 0xffff to CIP header of rx packet. On the other hand,
The value of syt field in CIP header of tx packet is unavailable. The
sequence of packet descriptor for tx packet includes 0 for the offset
of syt field to avoid computation.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210522013303.49596-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r-- | sound/firewire/amdtp-stream.c | 27 | ||||
-rw-r--r-- | sound/firewire/amdtp-stream.h | 4 | ||||
-rw-r--r-- | sound/firewire/motu/amdtp-motu.c | 4 | ||||
-rw-r--r-- | sound/firewire/tascam/amdtp-tascam.c | 6 |
4 files changed, 16 insertions, 25 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 3713188aac25..7e763f46e5a4 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -113,9 +113,6 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, s->fmt = fmt; s->process_ctx_payloads = process_ctx_payloads; - if (dir == AMDTP_OUT_STREAM) - s->ctx_data.rx.syt_override = -1; - return 0; } EXPORT_SYMBOL(amdtp_stream_init); @@ -638,7 +635,8 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, *data_block_counter = dbc; - *syt = cip_header[1] & CIP_SYT_MASK; + if (!(s->flags & CIP_UNAWARE_SYT)) + *syt = cip_header[1] & CIP_SYT_MASK; return 0; } @@ -836,22 +834,23 @@ static void generate_pkt_descs(struct amdtp_stream *s, struct pkt_desc *descs, { unsigned int dbc = s->data_block_counter; unsigned int seq_index = s->ctx_data.rx.seq_index; + bool aware_syt = !(s->flags & CIP_UNAWARE_SYT); int i; for (i = 0; i < packets; ++i) { struct pkt_desc *desc = descs + i; unsigned int index = (s->packet_index + i) % s->queue_size; const struct seq_desc *seq = seq_descs + seq_index; - unsigned int syt; desc->cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size); - syt = seq->syt_offset; - if (syt != CIP_SYT_NO_INFO) { - syt = compute_syt(syt, desc->cycle, - s->ctx_data.rx.transfer_delay); + if (aware_syt && seq->syt_offset != CIP_SYT_NO_INFO) { + desc->syt = compute_syt(seq->syt_offset, desc->cycle, + s->ctx_data.rx.transfer_delay); + } else { + desc->syt = CIP_SYT_NO_INFO; } - desc->syt = syt; + desc->data_blocks = seq->data_blocks; if (s->flags & CIP_DBC_IS_END_EVENT) @@ -924,21 +923,15 @@ static void process_rx_packets(struct fw_iso_context *context, u32 tstamp, size_ for (i = 0; i < packets; ++i) { const struct pkt_desc *desc = s->pkt_descs + i; - unsigned int syt; struct { struct fw_iso_packet params; __be32 header[CIP_HEADER_QUADLETS]; } template = { {0}, {0} }; bool sched_irq = false; - if (s->ctx_data.rx.syt_override < 0) - syt = desc->syt; - else - syt = s->ctx_data.rx.syt_override; - build_it_pkt_header(s, desc->cycle, &template.params, pkt_header_length, desc->data_blocks, desc->data_block_counter, - syt, i); + desc->syt, i); if (s == s->domain->irq_target) { event_count += desc->data_blocks; diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index b362a6499265..6c4d277dc0dd 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -35,6 +35,8 @@ * @CIP_NO_HEADERS: a lack of headers in packets * @CIP_UNALIGHED_DBC: Only for in-stream. The value of dbc is not alighed to * the value of current SYT_INTERVAL; e.g. initial value is not zero. + * @CIP_UNAWARE_SYT: For outgoing packet, the value in SYT field of CIP is 0xffff. + * For incoming packet, the value in SYT field of CIP is not handled. */ enum cip_flags { CIP_NONBLOCKING = 0x00, @@ -48,6 +50,7 @@ enum cip_flags { CIP_HEADER_WITHOUT_EOH = 0x80, CIP_NO_HEADER = 0x100, CIP_UNALIGHED_DBC = 0x200, + CIP_UNAWARE_SYT = 0x400, }; /** @@ -143,7 +146,6 @@ struct amdtp_stream { // To generate CIP header. unsigned int fdf; - int syt_override; // To generate constant hardware IRQ. unsigned int event_count; diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c index 9ccde07d6295..18bf433f43b6 100644 --- a/sound/firewire/motu/amdtp-motu.c +++ b/sound/firewire/motu/amdtp-motu.c @@ -441,7 +441,7 @@ int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit, { amdtp_stream_process_ctx_payloads_t process_ctx_payloads; int fmt = CIP_FMT_MOTU; - int flags = CIP_BLOCKING; + unsigned int flags = CIP_BLOCKING | CIP_UNAWARE_SYT; int err; if (dir == AMDTP_IN_STREAM) { @@ -479,8 +479,6 @@ int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit, 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; diff --git a/sound/firewire/tascam/amdtp-tascam.c b/sound/firewire/tascam/amdtp-tascam.c index f823a2ab3544..64d66a802545 100644 --- a/sound/firewire/tascam/amdtp-tascam.c +++ b/sound/firewire/tascam/amdtp-tascam.c @@ -228,6 +228,7 @@ int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit, enum amdtp_stream_direction dir, unsigned int pcm_channels) { amdtp_stream_process_ctx_payloads_t process_ctx_payloads; + unsigned int flags = CIP_NONBLOCKING | CIP_SKIP_DBC_ZERO_CHECK | CIP_UNAWARE_SYT; struct amdtp_tscm *p; unsigned int fmt; int err; @@ -240,8 +241,7 @@ int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit, process_ctx_payloads = process_it_ctx_payloads; } - err = amdtp_stream_init(s, unit, dir, - CIP_NONBLOCKING | CIP_SKIP_DBC_ZERO_CHECK, fmt, + err = amdtp_stream_init(s, unit, dir, flags, fmt, process_ctx_payloads, sizeof(struct amdtp_tscm)); if (err < 0) return 0; @@ -249,8 +249,6 @@ int amdtp_tscm_init(struct amdtp_stream *s, struct fw_unit *unit, 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. */ |