Skip to content

Commit

Permalink
ALSA: dice: fix wrong channel mappping at higher sampling rate
Browse files Browse the repository at this point in the history
The channel mapping is initialized by amdtp_stream_set_parameters(), however
Dice driver set it before calling this function. Furthermore, the setting is
wrong because the index is the value of array, and vice versa.

This commit moves codes for channel mapping after the function and set it correctly.

Reported-by: Daniel Robbins <drobbins@funtoo.org>
Fixes: 10550be ("ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.16
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Aug 29, 2014
1 parent 1a22e77 commit 1033eb5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sound/firewire/dice.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,18 +579,22 @@ static int dice_hw_params(struct snd_pcm_substream *substream,
return err;
}

for (i = 0; i < channels; i++) {
dice->stream.pcm_positions[i * 2] = i;
dice->stream.pcm_positions[i * 2 + 1] = i + channels;
}

rate /= 2;
channels *= 2;
}

mode = rate_index_to_mode(rate_index);
amdtp_stream_set_parameters(&dice->stream, rate, channels,
dice->rx_midi_ports[mode]);
if (rate_index > 4) {
channels /= 2;

for (i = 0; i < channels; i++) {
dice->stream.pcm_positions[i] = i * 2;
dice->stream.pcm_positions[i + channels] = i * 2 + 1;
}
}

amdtp_stream_set_pcm_format(&dice->stream,
params_format(hw_params));

Expand Down

0 comments on commit 1033eb5

Please sign in to comment.