summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-11-25 14:03:06 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-12-03 15:51:53 +0000
commit84b9191831f7f89978cf5630cdf7119e6414306e (patch)
tree2f8cc6ccb8b6bc8134d124502f5932b4aa19d2aa
parent3bb1d923af067aa33285a59e0f49d8064a58363f (diff)
mb/prodrive/hermes: Configure ALC888 port B Vref
Define a new field in the board config EEPROM layout for port B Vref. Write port B Vref settings to unused non-volatile NID 0x12 instead of NID 0x18, the actual port B NID. Because per-port Vref settings don't persist after codec resets, a custom Realtek driver (ab)uses NID 0x12 to restore port B Vref after resetting the codec. Change-Id: Iaa11ba9c74f643e94046d4983fbce65dbedd1025 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/58879 Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.h5
-rw-r--r--src/mainboard/prodrive/hermes/hda_verb.c26
2 files changed, 29 insertions, 2 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.h b/src/mainboard/prodrive/hermes/eeprom.h
index 26f2faa0bd..a42a3d7520 100644
--- a/src/mainboard/prodrive/hermes/eeprom.h
+++ b/src/mainboard/prodrive/hermes/eeprom.h
@@ -51,12 +51,13 @@ struct __packed eeprom_board_settings {
uint8_t blue_rear_vref;
uint8_t front_panel_audio;
uint8_t pxe_boot_capability;
+ uint8_t pink_rear_vref;
};
- uint8_t raw_settings[9];
+ uint8_t raw_settings[10];
};
};
-_Static_assert(sizeof(struct eeprom_board_settings) == (9 + sizeof(uint32_t)),
+_Static_assert(sizeof(struct eeprom_board_settings) == (10 + sizeof(uint32_t)),
"struct eeprom_board_settings has invalid size!");
struct __packed eeprom_bmc_settings {
diff --git a/src/mainboard/prodrive/hermes/hda_verb.c b/src/mainboard/prodrive/hermes/hda_verb.c
index 760cecc5f5..7514ce9711 100644
--- a/src/mainboard/prodrive/hermes/hda_verb.c
+++ b/src/mainboard/prodrive/hermes/hda_verb.c
@@ -90,6 +90,23 @@ static u32 get_port_c_vref_cfg(uint8_t blue_rear_vref)
}
}
+static u32 get_port_b_vref_cfg(uint8_t pink_rear_vref)
+{
+ switch (pink_rear_vref) {
+ default:
+ case 0:
+ return 0x411110f0; /* Disabled (Hi-Z) */
+ case 1:
+ return 0x411111f0; /* 50% of LDO out */
+ case 2:
+ return 0x411114f0; /* 80% of LDO out */
+ case 3:
+ return 0x411115f0; /* 100% of LDO out */
+ case 4:
+ return 0x411112f0; /* Ground */
+ }
+}
+
static u32 get_front_panel_cfg(uint8_t front_panel_audio)
{
switch (front_panel_audio) {
@@ -122,7 +139,16 @@ static void mainboard_r0x_configure_alc888(u8 *base, u32 viddid)
const u32 front_mic_cfg = get_front_mic_cfg(board_cfg->front_panel_audio);
+ const u32 port_b_vref_cfg = get_port_b_vref_cfg(board_cfg->pink_rear_vref);
+
const u32 verbs[] = {
+ /*
+ * Write port B Vref settings to unused non-volatile NID 0x12 instead of
+ * NID 0x18, the actual port B NID. Because per-port Vref settings don't
+ * persist after codec resets, a custom Realtek driver (ab)uses NID 0x12
+ * to restore port B Vref after resetting the codec.
+ */
+ AZALIA_PIN_CFG(0, 0x12, port_b_vref_cfg),
AZALIA_PIN_CFG(0, 0x19, front_mic_cfg),
AZALIA_PIN_CFG(0, 0x1b, front_panel_cfg),
0x0205000d, /* Pin 37 vrefo hidden register - used as port C vref */