summaryrefslogtreecommitdiff
path: root/sound/firewire/amdtp-stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-05-22 10:32:58 +0900
committerTakashi Iwai <tiwai@suse.de>2021-05-22 08:46:41 +0200
commit8070d2652e735585d31a50ff4f9bbaf2b5a49b10 (patch)
tree7e4a3e293b5da5c381f918d5568f2c2d0e53f288 /sound/firewire/amdtp-stream.c
parent344f0f821a7ee77832f04451e616f313b7d93f1a (diff)
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/amdtp-stream.c')
-rw-r--r--sound/firewire/amdtp-stream.c27
1 files changed, 10 insertions, 17 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;