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 <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200519111641.123211-11-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9883b3850f
commit
88e8f89dcc
@ -76,15 +76,11 @@ int amdtp_motu_set_parameters(struct amdtp_stream *s, unsigned int rate,
|
||||
if (i == ARRAY_SIZE(snd_motu_clock_rates))
|
||||
return -EINVAL;
|
||||
|
||||
pcm_chunks = formats->fixed_part_pcm_chunks[mode] +
|
||||
formats->differed_part_pcm_chunks[mode];
|
||||
// Each data block includes SPH in its head. Data chunks follow with
|
||||
// 3 byte alignment. Padding follows with zero to conform to quadlet
|
||||
// alignment.
|
||||
pcm_chunks = formats->pcm_chunks[mode];
|
||||
data_chunks = formats->msg_chunks + pcm_chunks;
|
||||
|
||||
/*
|
||||
* Each data block includes SPH in its head. Data chunks follow with
|
||||
* 3 byte alignment. Padding follows with zero to conform to quadlet
|
||||
* alignment.
|
||||
*/
|
||||
data_block_quadlets = 1 + DIV_ROUND_UP(data_chunks * 3, 4);
|
||||
|
||||
err = amdtp_stream_set_parameters(s, rate, data_block_quadlets);
|
||||
|
@ -201,9 +201,9 @@ static int ensure_packet_formats(struct snd_motu *motu)
|
||||
data &= ~(TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS |
|
||||
RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS|
|
||||
TX_PACKET_TRANSMISSION_SPEED_MASK);
|
||||
if (motu->tx_packet_formats.differed_part_pcm_chunks[0] == 0)
|
||||
if (motu->spec->tx_fixed_pcm_chunks[0] == motu->tx_packet_formats.pcm_chunks[0])
|
||||
data |= TX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
|
||||
if (motu->rx_packet_formats.differed_part_pcm_chunks[0] == 0)
|
||||
if (motu->spec->rx_fixed_pcm_chunks[0] == motu->rx_packet_formats.pcm_chunks[0])
|
||||
data |= RX_PACKET_EXCLUDE_DIFFERED_DATA_CHUNKS;
|
||||
data |= fw_parent_device(motu->unit)->max_speed;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user