ALSA: firewire-motu: use table-based calculation of packet formats for proc

This commit uses table-based calculation of packet formats for proc
nodes.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-10-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Sakamoto 2020-05-19 20:16:36 +09:00 committed by Takashi Iwai
parent 0090c1c5f3
commit 9883b3850f
2 changed files with 9 additions and 12 deletions

View File

@ -26,8 +26,7 @@ static int motu_rate_constraint(struct snd_pcm_hw_params *params,
rate = snd_motu_clock_rates[i];
mode = i / 2;
pcm_channels = formats->fixed_part_pcm_chunks[mode] +
formats->differed_part_pcm_chunks[mode];
pcm_channels = formats->pcm_chunks[mode];
if (!snd_interval_test(c, pcm_channels))
continue;
@ -59,8 +58,7 @@ static int motu_channels_constraint(struct snd_pcm_hw_params *params,
if (!snd_interval_test(r, rate))
continue;
pcm_channels = formats->fixed_part_pcm_chunks[mode] +
formats->differed_part_pcm_chunks[mode];
pcm_channels = formats->pcm_chunks[mode];
channels.min = min(channels.min, pcm_channels);
channels.max = max(channels.max, pcm_channels);
}
@ -82,8 +80,7 @@ static void limit_channels_and_rates(struct snd_motu *motu,
rate = snd_motu_clock_rates[i];
mode = i / 2;
pcm_channels = formats->fixed_part_pcm_chunks[mode] +
formats->differed_part_pcm_chunks[mode];
pcm_channels = formats->pcm_chunks[mode];
if (pcm_channels == 0)
continue;

View File

@ -51,7 +51,7 @@ static void proc_read_format(struct snd_info_entry *entry,
if (snd_motu_protocol_cache_packet_formats(motu) < 0)
return;
snd_iprintf(buffer, "tx:\tmsg\tfixed\tdiffered\n");
snd_iprintf(buffer, "tx:\tmsg\tfixed\ttotal\n");
for (i = 0; i < SND_MOTU_CLOCK_RATE_COUNT; ++i) {
mode = i >> 1;
@ -60,11 +60,11 @@ static void proc_read_format(struct snd_info_entry *entry,
"%u:\t%u\t%u\t%u\n",
snd_motu_clock_rates[i],
formats->msg_chunks,
formats->fixed_part_pcm_chunks[mode],
formats->differed_part_pcm_chunks[mode]);
motu->spec->tx_fixed_pcm_chunks[mode],
formats->pcm_chunks[mode]);
}
snd_iprintf(buffer, "rx:\tmsg\tfixed\tdiffered\n");
snd_iprintf(buffer, "rx:\tmsg\tfixed\ttotal\n");
for (i = 0; i < SND_MOTU_CLOCK_RATE_COUNT; ++i) {
mode = i >> 1;
@ -73,8 +73,8 @@ static void proc_read_format(struct snd_info_entry *entry,
"%u:\t%u\t%u\t%u\n",
snd_motu_clock_rates[i],
formats->msg_chunks,
formats->fixed_part_pcm_chunks[mode],
formats->differed_part_pcm_chunks[mode]);
motu->spec->rx_fixed_pcm_chunks[mode],
formats->pcm_chunks[mode]);
}
}