summaryrefslogtreecommitdiff
path: root/sound/firewire/amdtp-stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/amdtp-stream.h')
-rw-r--r--sound/firewire/amdtp-stream.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h
index 1f957c946c95..b7ff44751ab9 100644
--- a/sound/firewire/amdtp-stream.h
+++ b/sound/firewire/amdtp-stream.h
@@ -103,14 +103,14 @@ struct pkt_desc {
unsigned int data_blocks;
unsigned int data_block_counter;
__be32 *ctx_payload;
+ struct list_head link;
};
struct amdtp_stream;
-typedef unsigned int (*amdtp_stream_process_ctx_payloads_t)(
- struct amdtp_stream *s,
- const struct pkt_desc *desc,
- unsigned int packets,
- struct snd_pcm_substream *pcm);
+typedef void (*amdtp_stream_process_ctx_payloads_t)(struct amdtp_stream *s,
+ const struct pkt_desc *desc,
+ unsigned int count,
+ struct snd_pcm_substream *pcm);
struct amdtp_domain;
struct amdtp_stream {
@@ -125,7 +125,9 @@ struct amdtp_stream {
struct iso_packets_buffer buffer;
unsigned int queue_size;
int packet_index;
- struct pkt_desc *pkt_descs;
+ struct pkt_desc *packet_descs;
+ struct list_head packet_descs_list;
+ struct pkt_desc *packet_descs_cursor;
int tag;
union {
struct {
@@ -145,7 +147,7 @@ struct amdtp_stream {
struct {
struct seq_desc *descs;
unsigned int size;
- unsigned int tail;
+ unsigned int pos;
} cache;
} tx;
struct {
@@ -159,8 +161,7 @@ struct amdtp_stream {
struct {
struct seq_desc *descs;
unsigned int size;
- unsigned int tail;
- unsigned int head;
+ unsigned int pos;
} seq;
unsigned int data_block_state;
@@ -168,7 +169,7 @@ struct amdtp_stream {
unsigned int last_syt_offset;
struct amdtp_stream *replay_target;
- unsigned int cache_head;
+ unsigned int cache_pos;
} rx;
} ctx_data;
@@ -188,6 +189,7 @@ struct amdtp_stream {
struct snd_pcm_substream *pcm;
snd_pcm_uframes_t pcm_buffer_pointer;
unsigned int pcm_period_pointer;
+ unsigned int pcm_frame_multiplier;
// To start processing content of packets at the same cycle in several contexts for
// each direction.
@@ -214,7 +216,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
void amdtp_stream_destroy(struct amdtp_stream *s);
int amdtp_stream_set_parameters(struct amdtp_stream *s, unsigned int rate,
- unsigned int data_block_quadlets);
+ unsigned int data_block_quadlets, unsigned int pcm_frame_multiplier);
unsigned int amdtp_stream_get_max_payload(struct amdtp_stream *s);
void amdtp_stream_update(struct amdtp_stream *s);
@@ -277,6 +279,16 @@ static inline void amdtp_stream_pcm_trigger(struct amdtp_stream *s,
WRITE_ONCE(s->pcm, pcm);
}
+/**
+ * amdtp_stream_next_packet_desc - retrieve next descriptor for amdtp packet.
+ * @s: the AMDTP stream
+ * @desc: the descriptor of packet
+ *
+ * This macro computes next descriptor so that the list of descriptors behaves circular queue.
+ */
+#define amdtp_stream_next_packet_desc(s, desc) \
+ list_next_entry_circular(desc, &s->packet_descs_list, link)
+
static inline bool cip_sfc_is_base_44100(enum cip_sfc sfc)
{
return sfc & 1;