2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-03 19:24:02 +08:00

ALSA: dice: limit stream to current sampling transfer frequency.

In previous commit, ALSA Dice driver limits PCM substreams at current
sampling transfer frequency and current number of Multi bit linear audio
data channel. Thus, the driver has no need to start AMDTP streams at
the other sampling transfer frequency except for current one. This is due
to Dice interface design.

This commit limits AMDTP stream at current sampling transfer frequency,
according to the design.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Sakamoto 2016-02-08 22:54:16 +09:00 committed by Takashi Iwai
parent 0d5ee195b1
commit 1bc8e12d94

View File

@ -99,6 +99,7 @@ static int start_stream(struct snd_dice *dice, struct amdtp_stream *stream,
unsigned int rate) unsigned int rate)
{ {
struct fw_iso_resources *resources; struct fw_iso_resources *resources;
__be32 reg[2];
unsigned int i, mode, pcm_chs, midi_ports; unsigned int i, mode, pcm_chs, midi_ports;
bool double_pcm_frames; bool double_pcm_frames;
int err; int err;
@ -108,14 +109,20 @@ static int start_stream(struct snd_dice *dice, struct amdtp_stream *stream,
goto end; goto end;
if (stream == &dice->tx_stream) { if (stream == &dice->tx_stream) {
resources = &dice->tx_resources; resources = &dice->tx_resources;
pcm_chs = dice->tx_channels[mode]; err = snd_dice_transaction_read_tx(dice, TX_NUMBER_AUDIO,
midi_ports = dice->tx_midi_ports[mode]; reg, sizeof(reg));
} else { } else {
resources = &dice->rx_resources; resources = &dice->rx_resources;
pcm_chs = dice->rx_channels[mode]; err = snd_dice_transaction_read_rx(dice, RX_NUMBER_AUDIO,
midi_ports = dice->rx_midi_ports[mode]; reg, sizeof(reg));
} }
if (err < 0)
goto end;
pcm_chs = be32_to_cpu(reg[0]);
midi_ports = be32_to_cpu(reg[1]);
/* /*
* At 176.4/192.0 kHz, Dice has a quirk to transfer two PCM frames in * At 176.4/192.0 kHz, Dice has a quirk to transfer two PCM frames in
* one data block of AMDTP packet. Thus sampling transfer frequency is * one data block of AMDTP packet. Thus sampling transfer frequency is
@ -224,8 +231,10 @@ int snd_dice_stream_start_duplex(struct snd_dice *dice, unsigned int rate)
} }
if (rate == 0) if (rate == 0)
rate = curr_rate; rate = curr_rate;
if (rate != curr_rate) if (rate != curr_rate) {
stop_stream(dice, master); err = -EINVAL;
goto end;
}
if (!amdtp_stream_running(master)) { if (!amdtp_stream_running(master)) {
stop_stream(dice, slave); stop_stream(dice, slave);