summaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp-am824.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2019-07-22 12:36:53 +0900
committerTakashi Iwai <tiwai@suse.de>2019-07-22 16:04:57 +0200
commitab75481202d2925a017e4cb5407b0bb49c356de8 (patch)
treeb1e41e5eb7c6c92dca462af08451173e5ba5ffd3 /sound/firewire/amdtp-am824.c
parentcdefaa44d535a9d555ac4f1925d59ae4d0ef98e8 (diff)
downloadlinux-stable-ab75481202d2925a017e4cb5407b0bb49c356de8.tar.gz
linux-stable-ab75481202d2925a017e4cb5407b0bb49c356de8.tar.bz2
linux-stable-ab75481202d2925a017e4cb5407b0bb49c356de8.zip
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>
Diffstat (limited to 'sound/firewire/amdtp-am824.c')
-rw-r--r--sound/firewire/amdtp-am824.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sound/firewire/amdtp-am824.c b/sound/firewire/amdtp-am824.c
index 99c567ded7a3..03a7e0533131 100644
--- a/sound/firewire/amdtp-am824.c
+++ b/sound/firewire/amdtp-am824.c
@@ -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;
}