summaryrefslogtreecommitdiffstats
path: root/sound/firewire/motu/amdtp-motu.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-07-22 12:37:03 +0900
committerTakashi Iwai <tiwai@suse.de>2019-07-22 16:05:06 +0200
commitd2c104a3426be9991b35c65f0f260a107c4b2942 (patch)
treefd9255ce06b2dc7149051fc03b1050154c18e85d /sound/firewire/motu/amdtp-motu.c
parent0f5cfcb24d9c931e4571e9995bbfc08cc76d5d4a (diff)
downloadblackbird-op-linux-d2c104a3426be9991b35c65f0f260a107c4b2942.tar.gz
blackbird-op-linux-d2c104a3426be9991b35c65f0f260a107c4b2942.zip
ALSA: firewire-lib: pass packet descriptor to data block processing layer
This commit changes signature of callback function to call data block processing layer with packet descriptor. At present, the layer is called per packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu/amdtp-motu.c')
-rw-r--r--sound/firewire/motu/amdtp-motu.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/sound/firewire/motu/amdtp-motu.c b/sound/firewire/motu/amdtp-motu.c
index 30d5f87119cc..36ee2c1dd667 100644
--- a/sound/firewire/motu/amdtp-motu.c
+++ b/sound/firewire/motu/amdtp-motu.c
@@ -299,23 +299,27 @@ static void __maybe_unused copy_message(u64 *frames, __be32 *buffer,
}
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
- __be32 *buffer, unsigned int data_blocks,
- unsigned int data_block_counter)
+ const struct pkt_desc *desc,
+ struct snd_pcm_substream *pcm)
{
struct amdtp_motu *p = s->protocol;
- struct snd_pcm_substream *pcm;
+ unsigned int pcm_frames;
- trace_data_block_sph(s, data_blocks, buffer);
- trace_data_block_message(s, data_blocks, buffer);
+ trace_data_block_sph(s, desc->data_blocks, desc->ctx_payload);
+ trace_data_block_message(s, desc->data_blocks, desc->ctx_payload);
if (p->midi_ports)
- read_midi_messages(s, buffer, data_blocks);
+ read_midi_messages(s, desc->ctx_payload, desc->data_blocks);
- pcm = READ_ONCE(s->pcm);
- if (data_blocks > 0 && pcm)
- read_pcm_s32(s, pcm->runtime, buffer, data_blocks);
+ if (pcm) {
+ read_pcm_s32(s, pcm->runtime, desc->ctx_payload,
+ desc->data_blocks);
+ pcm_frames = desc->data_blocks;
+ } else {
+ pcm_frames = 0;
+ }
- return data_blocks;
+ return pcm_frames;
}
static inline void compute_next_elapse_from_start(struct amdtp_motu *p)
@@ -361,29 +365,32 @@ static void write_sph(struct amdtp_stream *s, __be32 *buffer,
}
static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
- __be32 *buffer, unsigned int data_blocks,
- unsigned int data_block_counter)
+ const struct pkt_desc *desc,
+ struct snd_pcm_substream *pcm)
{
struct amdtp_motu *p = (struct amdtp_motu *)s->protocol;
- struct snd_pcm_substream *pcm;
+ unsigned int pcm_frames;
/* TODO: how to interact control messages between userspace? */
if (p->midi_ports)
- write_midi_messages(s, buffer, data_blocks);
+ write_midi_messages(s, desc->ctx_payload, desc->data_blocks);
- pcm = READ_ONCE(s->pcm);
- if (pcm)
- write_pcm_s32(s, pcm->runtime, buffer, data_blocks);
- else
- write_pcm_silence(s, buffer, data_blocks);
+ if (pcm) {
+ write_pcm_s32(s, pcm->runtime, desc->ctx_payload,
+ desc->data_blocks);
+ pcm_frames = desc->data_blocks;
+ } else {
+ write_pcm_silence(s, desc->ctx_payload, desc->data_blocks);
+ pcm_frames = 0;
+ }
- write_sph(s, buffer, data_blocks);
+ write_sph(s, desc->ctx_payload, desc->data_blocks);
- trace_data_block_sph(s, data_blocks, buffer);
- trace_data_block_message(s, data_blocks, buffer);
+ trace_data_block_sph(s, desc->data_blocks, desc->ctx_payload);
+ trace_data_block_message(s, desc->data_blocks, desc->ctx_payload);
- return data_blocks;
+ return pcm_frames;
}
int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
OpenPOWER on IntegriCloud