mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 20:50:53 +07:00
[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 <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
bc9abce0de
commit
7113e95812
@ -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 |
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 |
|
||||
|
Loading…
Reference in New Issue
Block a user