Keith Hui has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/79734?usp=email )
Change subject: mb/asus/p8z77-m: Support AC97 front audio panel ......................................................................
mb/asus/p8z77-m: Support AC97 front audio panel
Add a nvram option for front audio panel type.
If it is set to AC97, reprogram front line out and microphone pins to match vendor firmware under same configuration.
TEST=On asus/p8z77-m housed in an AOpen H340D case with an AC97 front audio panel, front panel line out port is now available as headphone port in Fedora 39 with this patch applied and option set correctly. And it works. Without the patch (or with this option set to HD Audio), front audio ports are completely inoperable.
Change-Id: I39ccf066d87c5744a697599861719182768e0728 Signed-off-by: Keith Hui buurin@gmail.com --- M src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.default M src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.layout M src/mainboard/asus/p8x7x-series/variants/p8z77-m/hda_verb.c 3 files changed, 42 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/79734/1
diff --git a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.default b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.default index 3cc854d..79ea560 100644 --- a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.default +++ b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.default @@ -9,3 +9,4 @@ usb3_mode=Enable usb3_drv=Enable usb3_streams=Enable +audio_panel_type=HDA diff --git a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.layout b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.layout index 3053b8d..86bd35a 100644 --- a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.layout +++ b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/cmos.layout @@ -51,6 +51,11 @@ # 424 1 e 1 usb3_streams
+# audio_panel_type +# HD Audio or AC'97 +# +425 1 e 9 audio_panel_type + # ----------------------------------------------------------------- # Sandy/Ivy Bridge MRC Scrambler Seed values # note: MUST NOT be covered by checksum! @@ -128,6 +133,10 @@ 8 2 Auto 8 3 SmartAuto
+# audio_panel_type +9 0 HDA +9 1 AC97 + # ----------------------------------------------------------------- # <startBit[must be byte-aligned]> <endBit[must be byte aligned]> # <bit where to start storing checksum[must be 16bits-aligned]> diff --git a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/hda_verb.c b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/hda_verb.c index 738ba53..b553b17 100644 --- a/src/mainboard/asus/p8x7x-series/variants/p8z77-m/hda_verb.c +++ b/src/mainboard/asus/p8x7x-series/variants/p8z77-m/hda_verb.c @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include <device/azalia_device.h> +#include <stdint.h> + +#include <option.h>
const u32 cim_verb_data[] = { 0x10ec0887, /* Codec Vendor / Device ID: Realtek */ @@ -34,3 +37,32 @@ const u32 pc_beep_verbs[0] = {};
AZALIA_ARRAY_SIZES; + +void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid) +{ + unsigned int ac97 = get_uint_option("audio_panel_type", 0) & 0x1; + + /* + * The verbs above are for a HD Audio front panel. + * With vendor firmware, if audio front panel type is set as AC97, line out 2 + * (0x1b) and mic 2 (0x19) pins of ALC887 are configured differently. + * + * The differences are all in the "Misc" fields of configuration defaults (in byte 2) + * as shown below. ALC887 datasheet did not offer details on what those bits + * (listed as reserved in HDA spec) are, so we'll have to take their word for it. + * + * Pin | 0x19 | 0x1b + * -----+------+----- + * HDA | 1100 | 1100 + * AC97 | 1001 | 0001 + */ + + const u32 verbs[] = { + AZALIA_VERB_12B(0, 0x19, 0x71d, 0x99), + AZALIA_VERB_12B(0, 0x1b, 0x71d, 0x41) + }; + + if ((viddid == 0x10ec0887) && ac97) { + azalia_program_verb_table(base, verbs, ARRAY_SIZE(verbs)); + } +}