summaryrefslogtreecommitdiff
path: root/sound/firewire/motu
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-07-22 12:37:10 +0900
committerTakashi Iwai <tiwai@suse.de>2019-07-22 16:05:13 +0200
commitd2d5a6b0253d30ef04d513447cdd00df4fa627c3 (patch)
tree580f68b783db11a1e1151ed6b7e210c84ee6d809 /sound/firewire/motu
parent9a738ad1b1a64ef6d8271d8d42d715b75db6eb0d (diff)
ALSA: firewire-motu: more code refactoring for MOTU data block processing layer
MOTU data block processing layer has some tracepoints events. This commit is code refactoring to split probing the events from processing data blocks. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu')
-rw-r--r--sound/firewire/motu/amdtp-motu.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c
index 05a6e218b0ad..0fd36e469ad0 100644
--- a/sound/firewire/motu/amdtp-motu.c
+++ b/sound/firewire/motu/amdtp-motu.c
@@ -310,6 +310,22 @@ static void __maybe_unused copy_message(u64 *frames, __be32 *buffer,
}
}
+static void probe_tracepoints_events(struct amdtp_stream *s,
+ const struct pkt_desc *descs,
+ unsigned int packets)
+{
+ int i;
+
+ for (i = 0; i < packets; ++i) {
+ const struct pkt_desc *desc = descs + i;
+ __be32 *buf = desc->ctx_payload;
+ unsigned int data_blocks = desc->data_blocks;
+
+ trace_data_block_sph(s, data_blocks, buf);
+ trace_data_block_message(s, data_blocks, buf);
+ }
+}
+
static unsigned int process_ir_ctx_payloads(struct amdtp_stream *s,
const struct pkt_desc *descs,
unsigned int packets,
@@ -319,23 +335,26 @@ static unsigned int process_ir_ctx_payloads(struct amdtp_stream *s,
unsigned int pcm_frames = 0;
int i;
+ // For data block processing.
for (i = 0; i < packets; ++i) {
const struct pkt_desc *desc = descs + i;
__be32 *buf = desc->ctx_payload;
unsigned int data_blocks = desc->data_blocks;
- trace_data_block_sph(s, data_blocks, buf);
- trace_data_block_message(s, data_blocks, buf);
-
- if (p->midi_ports)
- read_midi_messages(s, buf, data_blocks);
-
if (pcm) {
read_pcm_s32(s, pcm, buf, data_blocks, pcm_frames);
pcm_frames += data_blocks;
}
+
+ if (p->midi_ports)
+ read_midi_messages(s, buf, data_blocks);
}
+ // For tracepoints.
+ if (trace_data_block_sph_enabled() ||
+ trace_data_block_message_enabled())
+ probe_tracepoints_events(s, descs, packets);
+
return pcm_frames;
}
@@ -390,16 +409,12 @@ static unsigned int process_it_ctx_payloads(struct amdtp_stream *s,
unsigned int pcm_frames = 0;
int i;
+ // For data block processing.
for (i = 0; i < packets; ++i) {
const struct pkt_desc *desc = descs + i;
__be32 *buf = desc->ctx_payload;
unsigned int data_blocks = desc->data_blocks;
- // TODO: how to interact control messages between userspace?
-
- if (p->midi_ports)
- write_midi_messages(s, buf, data_blocks);
-
if (pcm) {
write_pcm_s32(s, pcm, buf, data_blocks, pcm_frames);
pcm_frames += data_blocks;
@@ -407,12 +422,19 @@ static unsigned int process_it_ctx_payloads(struct amdtp_stream *s,
write_pcm_silence(s, buf, data_blocks);
}
- write_sph(s, buf, data_blocks);
+ if (p->midi_ports)
+ write_midi_messages(s, buf, data_blocks);
- trace_data_block_sph(s, data_blocks, buf);
- trace_data_block_message(s, data_blocks, buf);
+ // TODO: how to interact control messages between userspace?
+
+ write_sph(s, buf, data_blocks);
}
+ // For tracepoints.
+ if (trace_data_block_sph_enabled() ||
+ trace_data_block_message_enabled())
+ probe_tracepoints_events(s, descs, packets);
+
return pcm_frames;
}