Skip to content

Commit 88e8f89

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-motu: use table-based calculation of packet formats for stream management
This commit uses table-based calculation of packet formats for stream management. Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 9883b38 commit 88e8f89

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

sound/firewire/motu/amdtp-motu.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,11 @@ int amdtp_motu_set_parameters(struct amdtp_stream *s, unsigned int rate,
7676
if (i == ARRAY_SIZE(snd_motu_clock_rates))
7777
return -EINVAL;
7878

79-
pcm_chunks = formats->fixed_part_pcm_chunks[mode] +
80-
formats->differed_part_pcm_chunks[mode];
79+
// Each data block includes SPH in its head. Data chunks follow with
80+
// 3 byte alignment. Padding follows with zero to conform to quadlet
81+
// alignment.
82+
pcm_chunks = formats->pcm_chunks[mode];
8183
data_chunks = formats->msg_chunks + pcm_chunks;
82-
83-
/*
84-
* Each data block includes SPH in its head. Data chunks follow with
85-
* 3 byte alignment. Padding follows with zero to conform to quadlet
86-
* alignment.
87-
*/
8884
data_block_quadlets = 1 + DIV_ROUND_UP(data_chunks * 3, 4);
8985

9086
err = amdtp_stream_set_parameters(s, rate, data_block_quadlets);

sound/firewire/motu/motu-stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ static int ensure_packet_formats(struct snd_motu *motu)
201201
data &= ~(TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS |
202202
RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS|
203203
TX_PACKET_TRANSMISSION_SPEED_MASK);
204-
if (motu->tx_packet_formats.differed_part_pcm_chunks[0] == 0)
204+
if (motu->spec->tx_fixed_pcm_chunks[0] == motu->tx_packet_formats.pcm_chunks[0])
205205
data |= TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
206-
if (motu->rx_packet_formats.differed_part_pcm_chunks[0] == 0)
206+
if (motu->spec->rx_fixed_pcm_chunks[0] == motu->rx_packet_formats.pcm_chunks[0])
207207
data |= RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
208208
data |= fw_parent_device(motu->unit)->max_speed;
209209

0 commit comments

Comments
 (0)