From 7113e95812f508bff10f95f2e52ce6ee8cda1875 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 14 Jan 2008 08:55:03 +0100 Subject: [PATCH] [ALSA] oxygen: fix channel routing Do not exchange the surround and back jacks except when in 7.1 mode where the surround jack is not rear but side. Signed-off-by: Clemens Ladisch Signed-off-by: Jaroslav Kysela --- sound/pci/oxygen/oxygen.c | 6 +++--- sound/pci/oxygen/oxygen_lib.c | 2 +- sound/pci/oxygen/oxygen_mixer.c | 20 +++++++++++--------- sound/pci/oxygen/virtuoso.c | 6 +++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index ba7a2a8..ecc0e6f 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -19,10 +19,10 @@ /* * SPI 0 -> 1st AK4396 (front) - * SPI 1 -> 2nd AK4396 (side) + * SPI 1 -> 2nd AK4396 (surround) * SPI 2 -> 3rd AK4396 (center/LFE) * SPI 3 -> WM8785 - * SPI 4 -> 4th AK4396 (rear) + * SPI 4 -> 4th AK4396 (back) * * GPIO 0 -> DFS0 of AK5385 * GPIO 1 -> DFS1 of AK5385 @@ -99,7 +99,7 @@ static void ak4396_write(struct oxygen *chip, unsigned int codec, { /* maps ALSA channel pair number to SPI output */ static const u8 codec_spi_map[4] = { - 0, 4, 2, 1 + 0, 1, 2, 4 }; oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER_WRITE | OXYGEN_SPI_DATA_LENGTH_2 | diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 2418ceb..9cd4be2 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -193,7 +193,7 @@ static void __devinit oxygen_init(struct oxygen *chip) oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, 0x010a); oxygen_set_bits32(chip, OXYGEN_SPDIF_CONTROL, OXYGEN_SPDIF_MAGIC2); oxygen_write32(chip, OXYGEN_SPDIF_OUTPUT_BITS, chip->spdif_bits); - oxygen_write16(chip, OXYGEN_PLAY_ROUTING, 0x6c00); + oxygen_write16(chip, OXYGEN_PLAY_ROUTING, 0xe100); oxygen_write8(chip, OXYGEN_REC_ROUTING, 0x10); oxygen_write8(chip, OXYGEN_ADC_MONITOR, 0x00); oxygen_write8(chip, OXYGEN_A_MONITOR_ROUTING, 0xe4); diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 7208b0f..ca72799 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c @@ -99,7 +99,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl, static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) { static const char *const names[3] = { - "Front", "Front+Rear", "Front+Rear+Side" + "Front", "Front+Surround", "Front+Surround+Back" }; info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; info->count = 1; @@ -122,20 +122,22 @@ static int upmix_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) void oxygen_update_dac_routing(struct oxygen *chip) { - /* - * hardware channel order: front, side, center/lfe, rear - * ALSA channel order: front, rear, center/lfe, side - */ static const unsigned int reg_values[3] = { - 0x6c00, 0x2c00, 0x2000 + 0xe100, /* front <- 0, surround <- 1, center <- 2, back <- 3 */ + 0xe000, /* front <- 0, surround <- 0, center <- 2, back <- 3 */ + 0x2000 /* front <- 0, surround <- 0, center <- 2, back <- 0 */ }; + u8 channels; unsigned int reg_value; - if ((oxygen_read8(chip, OXYGEN_PLAY_CHANNELS) & - OXYGEN_PLAY_CHANNELS_MASK) == OXYGEN_PLAY_CHANNELS_2) + channels = oxygen_read8(chip, OXYGEN_PLAY_CHANNELS) & + OXYGEN_PLAY_CHANNELS_MASK; + if (channels == OXYGEN_PLAY_CHANNELS_2) reg_value = reg_values[chip->dac_routing]; + else if (channels == OXYGEN_PLAY_CHANNELS_8) + reg_value = 0x6c00; /* surround <- 3, back <- 1 */ else - reg_value = 0x6c00; + reg_value = 0xe100; oxygen_write16_masked(chip, OXYGEN_PLAY_ROUTING, reg_value, 0xff00); } diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 6603a68..bfd1f3c 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -19,9 +19,9 @@ /* * SPI 0 -> 1st PCM1796 (front) - * SPI 1 -> 2nd PCM1796 (side) + * SPI 1 -> 2nd PCM1796 (surround) * SPI 2 -> 3rd PCM1796 (center/LFE) - * SPI 4 -> 4th PCM1796 (rear) + * SPI 4 -> 4th PCM1796 (back) * * GPIO 2 -> M0 of CS5381 * GPIO 3 -> M1 of CS5381 @@ -76,7 +76,7 @@ static void pcm1796_write(struct oxygen *chip, unsigned int codec, { /* maps ALSA channel pair number to SPI output */ static const u8 codec_map[4] = { - 0, 4, 2, 1 + 0, 1, 2, 4 }; oxygen_write_spi(chip, OXYGEN_SPI_TRIGGER_WRITE | OXYGEN_SPI_DATA_LENGTH_2 | -- 2.7.4