forked from Minki/linux
ALSA: firewire-lib: pass data block counter to data block processing layer
This is a preparation for future commit that 'struct amdtp_stream.data_block_count' does not represent the value of data block count for current data block. However, data block count is required for calculation of sequence index in sequence-multiplied data channel. Some of data block processing layer require it; e.g. for AM824 data block. This commit passes data block count to the processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
cdefaa44d5
commit
ab75481202
@ -284,7 +284,7 @@ static void midi_rate_use_one_byte(struct amdtp_stream *s, unsigned int port)
|
||||
}
|
||||
|
||||
static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
unsigned int frames)
|
||||
unsigned int frames, unsigned int data_block_counter)
|
||||
{
|
||||
struct amdtp_am824 *p = s->protocol;
|
||||
unsigned int f, port;
|
||||
@ -293,7 +293,7 @@ static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
for (f = 0; f < frames; f++) {
|
||||
b = (u8 *)&buffer[p->midi_position];
|
||||
|
||||
port = (s->data_block_counter + f) % 8;
|
||||
port = (data_block_counter + f) % 8;
|
||||
if (f < MAX_MIDI_RX_BLOCKS &&
|
||||
midi_ratelimit_per_packet(s, port) &&
|
||||
p->midi[port] != NULL &&
|
||||
@ -311,8 +311,8 @@ static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
static void read_midi_messages(struct amdtp_stream *s,
|
||||
__be32 *buffer, unsigned int frames)
|
||||
static void read_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
unsigned int frames, unsigned int data_block_counter)
|
||||
{
|
||||
struct amdtp_am824 *p = s->protocol;
|
||||
int len;
|
||||
@ -323,7 +323,7 @@ static void read_midi_messages(struct amdtp_stream *s,
|
||||
unsigned int port = f;
|
||||
|
||||
if (!(s->flags & CIP_UNALIGHED_DBC))
|
||||
port += s->data_block_counter;
|
||||
port += data_block_counter;
|
||||
port %= 8;
|
||||
b = (u8 *)&buffer[p->midi_position];
|
||||
|
||||
@ -335,8 +335,9 @@ static void read_midi_messages(struct amdtp_stream *s,
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int process_rx_data_blocks(struct amdtp_stream *s, __be32 *buffer,
|
||||
unsigned int data_blocks, unsigned int *syt)
|
||||
static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct amdtp_am824 *p = s->protocol;
|
||||
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
|
||||
@ -351,13 +352,14 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s, __be32 *buffe
|
||||
}
|
||||
|
||||
if (p->midi_ports)
|
||||
write_midi_messages(s, buffer, data_blocks);
|
||||
write_midi_messages(s, buffer, data_blocks, data_block_counter);
|
||||
|
||||
return pcm_frames;
|
||||
}
|
||||
|
||||
static unsigned int process_tx_data_blocks(struct amdtp_stream *s, __be32 *buffer,
|
||||
unsigned int data_blocks, unsigned int *syt)
|
||||
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct amdtp_am824 *p = s->protocol;
|
||||
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
|
||||
@ -371,7 +373,7 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s, __be32 *buffe
|
||||
}
|
||||
|
||||
if (p->midi_ports)
|
||||
read_midi_messages(s, buffer, data_blocks);
|
||||
read_midi_messages(s, buffer, data_blocks, data_block_counter);
|
||||
|
||||
return pcm_frames;
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp,
|
||||
data_blocks = calculate_data_blocks(s, syt);
|
||||
buffer = s->buffer.packets[s->packet_index].buffer;
|
||||
pcm_frames = s->process_data_blocks(s, buffer, data_blocks,
|
||||
&syt);
|
||||
s->data_block_counter, &syt);
|
||||
|
||||
build_it_pkt_header(s, cycle, &template.params, data_blocks,
|
||||
syt, i);
|
||||
@ -776,7 +776,7 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
|
||||
if (err >= 0) {
|
||||
buffer = s->buffer.packets[s->packet_index].buffer;
|
||||
pcm_frames = s->process_data_blocks(s, buffer,
|
||||
data_blocks, &syt);
|
||||
data_blocks, s->data_block_counter, &syt);
|
||||
|
||||
if (!(s->flags & CIP_DBC_IS_END_EVENT)) {
|
||||
s->data_block_counter += data_blocks;
|
||||
|
@ -99,6 +99,7 @@ typedef unsigned int (*amdtp_stream_process_data_blocks_t)(
|
||||
struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int data_block_counter,
|
||||
unsigned int *syt);
|
||||
struct amdtp_stream {
|
||||
struct fw_unit *unit;
|
||||
|
@ -234,7 +234,7 @@ static inline void midi_use_bytes(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
unsigned int data_blocks)
|
||||
unsigned int data_blocks, unsigned int data_block_counter)
|
||||
{
|
||||
struct amdtp_dot *p = s->protocol;
|
||||
unsigned int f, port;
|
||||
@ -242,7 +242,7 @@ static void write_midi_messages(struct amdtp_stream *s, __be32 *buffer,
|
||||
u8 *b;
|
||||
|
||||
for (f = 0; f < data_blocks; f++) {
|
||||
port = (s->data_block_counter + f) % 8;
|
||||
port = (data_block_counter + f) % 8;
|
||||
b = (u8 *)&buffer[0];
|
||||
|
||||
len = 0;
|
||||
@ -330,9 +330,8 @@ void amdtp_dot_midi_trigger(struct amdtp_stream *s, unsigned int port,
|
||||
}
|
||||
|
||||
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm;
|
||||
unsigned int pcm_frames;
|
||||
@ -351,9 +350,8 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm;
|
||||
unsigned int pcm_frames;
|
||||
@ -367,7 +365,7 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
pcm_frames = 0;
|
||||
}
|
||||
|
||||
write_midi_messages(s, buffer, data_blocks);
|
||||
write_midi_messages(s, buffer, data_blocks, data_block_counter);
|
||||
|
||||
return pcm_frames;
|
||||
}
|
||||
|
@ -103,9 +103,8 @@ int amdtp_ff_add_pcm_hw_constraints(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
|
||||
unsigned int pcm_frames;
|
||||
@ -122,9 +121,8 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
|
||||
unsigned int pcm_frames;
|
||||
|
@ -299,8 +299,8 @@ 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 *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct amdtp_motu *p = s->protocol;
|
||||
struct snd_pcm_substream *pcm;
|
||||
@ -361,8 +361,8 @@ 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 *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct amdtp_motu *p = (struct amdtp_motu *)s->protocol;
|
||||
struct snd_pcm_substream *pcm;
|
||||
|
@ -166,9 +166,8 @@ static void read_status_messages(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm;
|
||||
|
||||
@ -182,9 +181,8 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
|
||||
}
|
||||
|
||||
static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
|
||||
__be32 *buffer,
|
||||
unsigned int data_blocks,
|
||||
unsigned int *syt)
|
||||
__be32 *buffer, unsigned int data_blocks,
|
||||
unsigned int data_block_counter, unsigned int *syt)
|
||||
{
|
||||
struct snd_pcm_substream *pcm;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user