summaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp-stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2021-05-20 13:01:54 +0900
committerTakashi Iwai <tiwai@suse.de>2021-05-20 14:01:17 +0200
commitbdaedca74d6293b6ac643a8ebe8231b52bf1171b (patch)
tree3d7d64b6ed2b6111aec0f12f289e702d18e320ae /sound/firewire/amdtp-stream.c
parent9b1fcd9bf802062c1b6c325b7762f4ecdc59f309 (diff)
downloadlinux-bdaedca74d6293b6ac643a8ebe8231b52bf1171b.tar.gz
linux-bdaedca74d6293b6ac643a8ebe8231b52bf1171b.tar.bz2
linux-bdaedca74d6293b6ac643a8ebe8231b52bf1171b.zip
ALSA: firewire-lib: change waking up timing to process packets
When starting AMDTP domain, tasks in process context yields running CPU till all of isochronous context get callback, with an assumption that it's OK to process content of packet. However several isochronous cycles are skipped to transfer rx packets, or the content of rx packets are dropped, to manage the timing to start processing the packets. This commit changes the timing for tasks in process context to wake up when processing content of packet is actually ready. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210520040154.80450-9-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.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index e9bdb609f2eb..a6a7a72a2452 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -107,7 +107,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
INIT_WORK(&s->period_work, pcm_period_work);
s->packet_index = 0;
- init_waitqueue_head(&s->callback_wait);
+ init_waitqueue_head(&s->ready_wait);
s->callbacked = false;
s->fmt = fmt;
@@ -1029,6 +1029,9 @@ static void process_rx_packets_intermediately(struct fw_iso_context *context, u3
}
if (offset < packets) {
+ s->ready_processing = true;
+ wake_up(&s->ready_wait);
+
process_rx_packets(context, tstamp, header_length, ctx_header, private_data);
if (amdtp_streaming_error(s))
return;
@@ -1145,6 +1148,9 @@ static void process_tx_packets_intermediately(struct fw_iso_context *context, u3
}
if (offset < packets) {
+ s->ready_processing = true;
+ wake_up(&s->ready_wait);
+
process_tx_packets(context, tstamp, header_length, ctx_header, s);
if (amdtp_streaming_error(s))
return;
@@ -1286,12 +1292,9 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context,
const __be32 *ctx_header = header;
u32 cycle;
- /*
- * For in-stream, first packet has come.
- * For out-stream, prepared to transmit first packet
- */
+ // For in-stream, first packet has come.
+ // For out-stream, prepared to transmit first packet
s->callbacked = true;
- wake_up(&s->callback_wait);
if (s->direction == AMDTP_IN_STREAM) {
cycle = compute_ohci_cycle_count(ctx_header[1]);
@@ -1464,6 +1467,7 @@ static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
tag |= FW_ISO_CONTEXT_MATCH_TAG0;
s->callbacked = false;
+ s->ready_processing = false;
err = fw_iso_context_start(s->context, -1, 0, tag);
if (err < 0)
goto err_pkt_descs;