aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ymfpci/ymfpci_main.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2006-01-18 08:02:24 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:26:21 +0100
commit5a25c5cfd4f61f514decca3c4106210fb168ce19 (patch)
treeb79f15c8dd90d682233c231b43ce0ed932a5b126 /sound/pci/ymfpci/ymfpci_main.c
parent[ALSA] semaphore -> mutex (Archs, misc buses) (diff)
downloadlinux-dev-5a25c5cfd4f61f514decca3c4106210fb168ce19.tar.xz
linux-dev-5a25c5cfd4f61f514decca3c4106210fb168ce19.zip
[ALSA] ymfpci - make rear channel swap optional
Modules: YMFPCI driver Added rear_swap module option / kernel parameter to configure the rear channel swapping. Default value is enable to make the AC3 passthrough working, but analog only users might revert the previous behaviour. Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/ymfpci/ymfpci_main.c')
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 30ee53adb494..8ac5ab50b5c7 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -536,19 +536,30 @@ static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned int
}
}
if (ypcm->output_rear) {
- /* The SPDIF out channels seem to be swapped, so we have
- * to swap them here, too. The rear analog out channels
- * will be wrong, but otherwise AC3 would not work.
- */
- if (use_left) {
- bank->eff3_gain =
- bank->eff3_gain_end = vol_left;
- }
- if (use_right) {
- bank->eff2_gain =
- bank->eff2_gain_end = vol_right;
- }
- }
+ if (!ypcm->swap_rear) {
+ if (use_left) {
+ bank->eff2_gain =
+ bank->eff2_gain_end = vol_left;
+ }
+ if (use_right) {
+ bank->eff3_gain =
+ bank->eff3_gain_end = vol_right;
+ }
+ } else {
+ /* The SPDIF out channels seem to be swapped, so we have
+ * to swap them here, too. The rear analog out channels
+ * will be wrong, but otherwise AC3 would not work.
+ */
+ if (use_left) {
+ bank->eff3_gain =
+ bank->eff3_gain_end = vol_left;
+ }
+ if (use_right) {
+ bank->eff2_gain =
+ bank->eff2_gain_end = vol_right;
+ }
+ }
+ }
}
}
@@ -898,6 +909,7 @@ static int snd_ymfpci_playback_open(struct snd_pcm_substream *substream)
ypcm = runtime->private_data;
ypcm->output_front = 1;
ypcm->output_rear = chip->mode_dup4ch ? 1 : 0;
+ ypcm->swap_rear = chip->rear_swap;
spin_lock_irq(&chip->reg_lock);
if (ypcm->output_rear) {
ymfpci_open_extension(chip);
@@ -1738,7 +1750,7 @@ static void snd_ymfpci_mixer_free_ac97(struct snd_ac97 *ac97)
chip->ac97 = NULL;
}
-int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
+int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rear_swap)
{
struct snd_ac97_template ac97;
struct snd_kcontrol *kctl;
@@ -1750,6 +1762,7 @@ int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
.read = snd_ymfpci_codec_read,
};
+ chip->rear_swap = rear_swap;
if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
return err;
chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus;
@@ -2297,6 +2310,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
return -EIO;
}
+ chip->rear_swap = 1;
if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
snd_ymfpci_free(chip);
return err;