snd_pcm_period_elapsed(pcm);
}
-static int queue_packet(struct amdtp_stream *s, unsigned int payload_length)
+static int queue_packet(struct amdtp_stream *s, struct fw_iso_packet *params)
{
- struct fw_iso_packet p = {0};
- int err = 0;
-
- if (IS_ERR(s->context))
- goto end;
-
- p.interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL);
- p.tag = s->tag;
+ int err;
- if (s->direction == AMDTP_IN_STREAM) {
- // Queue one packet for IR context.
- p.header_length = s->ctx_data.tx.ctx_header_size;
- } else {
- // No header for this packet.
- p.header_length = 0;
- }
+ params->interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL);
+ params->tag = s->tag;
+ params->sy = 0;
- if (payload_length > 0)
- p.payload_length = payload_length;
- else
- p.skip = true;
- err = fw_iso_context_queue(s->context, &p, &s->buffer.iso_buffer,
+ err = fw_iso_context_queue(s->context, params, &s->buffer.iso_buffer,
s->buffer.packets[s->packet_index].offset);
if (err < 0) {
dev_err(&s->unit->device, "queueing error: %d\n", err);
}
static inline int queue_out_packet(struct amdtp_stream *s,
+ struct fw_iso_packet *params,
unsigned int payload_length)
{
- return queue_packet(s, payload_length);
+ // No header for this packet.
+ params->header_length = 0;
+ params->payload_length = payload_length;
+ params->skip = !!(payload_length == 0);
+ return queue_packet(s, params);
}
-static inline int queue_in_packet(struct amdtp_stream *s)
+static inline int queue_in_packet(struct amdtp_stream *s,
+ struct fw_iso_packet *params)
{
- return queue_packet(s, s->ctx_data.tx.max_ctx_payload_length);
+ // Queue one packet for IR context.
+ params->header_length = s->ctx_data.tx.ctx_header_size;
+ params->payload_length = s->ctx_data.tx.max_ctx_payload_length;
+ params->skip = false;
+ return queue_packet(s, params);
}
static void generate_cip_header(struct amdtp_stream *s, __be32 cip_header[2],
__be32 *cip_header;
unsigned int pcm_frames;
struct snd_pcm_substream *pcm;
+ struct fw_iso_packet params = {0};
syt = calculate_syt(s, cycle);
data_blocks = calculate_data_blocks(s, syt);
trace_amdtp_packet(s, cycle, cip_header, payload_length, data_blocks,
index);
- if (queue_out_packet(s, payload_length) < 0)
+ if (queue_out_packet(s, ¶ms, payload_length) < 0)
return -EIO;
pcm = READ_ONCE(s->pcm);
unsigned int data_blocks;
struct snd_pcm_substream *pcm;
unsigned int pcm_frames;
+ struct fw_iso_packet params = {0};
int err;
payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT;
pcm_frames = s->process_data_blocks(s, buffer, data_blocks, &syt);
end:
- if (queue_in_packet(s) < 0)
+ if (queue_in_packet(s, ¶ms) < 0)
return -EIO;
pcm = READ_ONCE(s->pcm);
s->packet_index = 0;
do {
+ struct fw_iso_packet params;
if (s->direction == AMDTP_IN_STREAM)
- err = queue_in_packet(s);
+ err = queue_in_packet(s, ¶ms);
else
- err = queue_out_packet(s, 0);
+ err = queue_out_packet(s, ¶ms, 0);
if (err < 0)
goto err_context;
} while (s->packet_index > 0);