]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[ALSA] oxygen: fix channel routing
authorClemens Ladisch <clemens@ladisch.de>
Mon, 14 Jan 2008 07:55:03 +0000 (08:55 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 31 Jan 2008 16:29:56 +0000 (17:29 +0100)
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 <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
sound/pci/oxygen/oxygen.c
sound/pci/oxygen/oxygen_lib.c
sound/pci/oxygen/oxygen_mixer.c
sound/pci/oxygen/virtuoso.c

index ba7a2a83f33979fd29d611cb64f4ab03d68cdb28..ecc0e6f9d2771753f23c0024127aea24b175ece4 100644 (file)
 
 /*
  * 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 |
index 2418ceb4485826eb1bf0e9024a1e1d495c2fc9b5..9cd4be2593ab158e0b94fa3a61608b758e05a859 100644 (file)
@@ -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);
index 7208b0fb3ee5914c7241464260d4a06c62e3e445..ca72799bea270db9a8865b83166613005c16fd79 100644 (file)
@@ -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);
 }
 
index 6603a685ccca6e73a7e228a6a8cee100e578aac3..bfd1f3c3dfcd6b4a94e85acb1266ac551a16929d 100644 (file)
@@ -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 |