Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: dice: fix wrong channel mappping at higher sampling rate

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>
Cc: <stable@vger.kernel.org> # 3.16
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Takashi Sakamoto and committed by
Takashi Iwai
1033eb5b 1a22e775

+9 -5
+9 -5
sound/firewire/dice.c
··· 579 579 return err; 580 580 } 581 581 582 - for (i = 0; i < channels; i++) { 583 - dice->stream.pcm_positions[i * 2] = i; 584 - dice->stream.pcm_positions[i * 2 + 1] = i + channels; 585 - } 586 - 587 582 rate /= 2; 588 583 channels *= 2; 589 584 } ··· 586 591 mode = rate_index_to_mode(rate_index); 587 592 amdtp_stream_set_parameters(&dice->stream, rate, channels, 588 593 dice->rx_midi_ports[mode]); 594 + if (rate_index > 4) { 595 + channels /= 2; 596 + 597 + for (i = 0; i < channels; i++) { 598 + dice->stream.pcm_positions[i] = i * 2; 599 + dice->stream.pcm_positions[i + channels] = i * 2 + 1; 600 + } 601 + } 602 + 589 603 amdtp_stream_set_pcm_format(&dice->stream, 590 604 params_format(hw_params)); 591 605