summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-08-29 13:40:44 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 13:40:53 -0700
commitc602cc99872e15d12691b0eff18eaa5e7c9ba439 (patch)
treeaaae8024352f0584f7140891ffac34ca09ebf967
parentc790a6bd6207d627bf9bbbf51b99c29356e6d48e (diff)
ALSA: dice: fix wrong channel mappping at higher sampling rate
commit 1033eb5b5aeeb526c22068e0fb0cef9f3c14231e upstream. 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: 10550bea44a8 ("ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRE") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/firewire/dice.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c
index a9a30c0161f1..4cf8eb704045 100644
--- a/sound/firewire/dice.c
+++ b/sound/firewire/dice.c
@@ -579,11 +579,6 @@ 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;
}
@@ -591,6 +586,15 @@ static int dice_hw_params(struct snd_pcm_substream *substream,
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));