From 493770d7300f8017e12f5ef6432a107502e03e95 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 12 Mar 2026 20:30:39 +0000 Subject: [PATCH] mb/starlabs/starfighter/mtl: add speaker idle CFR option Realtek advised leaving the StarFighter speaker path idle with GPIO2 low and LINE2 EAPD disabled when no audio is playing. Add a "Legacy Speaker Control" CFR option for the Meteor Lake variant so coreboot can optionally boot the codec in that muted state. This avoids the cold-boot / G3 speaker pop when paired with the Linux runtime sequencing fix that asserts EAPD and GPIO2 only for playback. Keep the option enabled by default so existing kernels continue to use the legacy speaker setup. Without the matching Linux change, forcing GPIO2 low at boot would leave the external speaker amp disabled and result in no speaker output. Signed-off-by: Sean Rhodes Change-Id: I62427d3f13b8a68a58bca4ed7896482da4abf23b Reviewed-on: https://review.coreboot.org/c/coreboot/+/91662 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/mainboard/starlabs/common/hda/dmic.c | 3 +- src/mainboard/starlabs/starfighter/cfr.c | 22 ++++++++++++++ .../starfighter/variants/mtl/Makefile.mk | 1 + .../starlabs/starfighter/variants/mtl/hda.c | 30 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/starlabs/starfighter/variants/mtl/hda.c diff --git a/src/mainboard/starlabs/common/hda/dmic.c b/src/mainboard/starlabs/common/hda/dmic.c index cf1b243866..bf09f8a5f9 100644 --- a/src/mainboard/starlabs/common/hda/dmic.c +++ b/src/mainboard/starlabs/common/hda/dmic.c @@ -14,8 +14,9 @@ static void disable_microphone(uint8_t *base) azalia_program_verb_table(base, override_verb, ARRAY_SIZE(override_verb)); } -void mainboard_azalia_program_runtime_verbs(uint8_t *base, uint32_t viddid) +void __weak mainboard_azalia_program_runtime_verbs(uint8_t *base, uint32_t viddid) { + (void)viddid; if (get_uint_option("microphone", 1) == 0) disable_microphone(base); } diff --git a/src/mainboard/starlabs/starfighter/cfr.c b/src/mainboard/starlabs/starfighter/cfr.c index 2d3c6c3967..9f8132be96 100644 --- a/src/mainboard/starlabs/starfighter/cfr.c +++ b/src/mainboard/starlabs/starfighter/cfr.c @@ -8,6 +8,25 @@ #include #include +#if CONFIG(BOARD_STARLABS_STARFIGHTER_MTL) +static const struct sm_object legacy_speaker_control = SM_DECLARE_BOOL({ + .opt_name = "legacy_speaker_control", + .ui_name = "Legacy Speaker Control", + .ui_helptext = "Enabled: keep the default speaker initialization.\n" + "Disabled: boot with GPIO2 low and LINE2 EAPD off " + "so the speakers start muted.", + .default_value = true, +}); + +static struct sm_obj_form audio_group = { + .ui_name = "Audio", + .obj_list = (const struct sm_object *[]) { + &legacy_speaker_control, + NULL + }, +}; +#endif + static struct sm_obj_form battery_group = { .ui_name = "Battery", .obj_list = (const struct sm_object *[]) { @@ -128,6 +147,9 @@ static struct sm_obj_form wireless_group = { }; static struct sm_obj_form *sm_root[] = { + #if CONFIG(BOARD_STARLABS_STARFIGHTER_MTL) + &audio_group, + #endif &battery_group, &debug_group, #if CONFIG(DRIVERS_INTEL_USB4_RETIMER) diff --git a/src/mainboard/starlabs/starfighter/variants/mtl/Makefile.mk b/src/mainboard/starlabs/starfighter/variants/mtl/Makefile.mk index 93240a1307..19f5cb80ff 100644 --- a/src/mainboard/starlabs/starfighter/variants/mtl/Makefile.mk +++ b/src/mainboard/starlabs/starfighter/variants/mtl/Makefile.mk @@ -8,6 +8,7 @@ romstage-y += romstage.c ramstage-y += board_id.c ramstage-y += devtree.c ramstage-y += gpio.c +ramstage-y += hda.c ramstage-y += hda_verb.c ramstage-y += ramstage.c $(call add_vbt_to_cbfs, vbt_qhd.bin, data_qhd.vbt) diff --git a/src/mainboard/starlabs/starfighter/variants/mtl/hda.c b/src/mainboard/starlabs/starfighter/variants/mtl/hda.c new file mode 100644 index 0000000000..29e9c26396 --- /dev/null +++ b/src/mainboard/starlabs/starfighter/variants/mtl/hda.c @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +/* Leave the speaker path muted so the OS can sequence EAPD and GPIO2 later. */ +static const uint32_t speaker_idle_verb[] = { + AZALIA_VERB_12B(0, 0x01, 0x716, 0x04), + AZALIA_VERB_12B(0, 0x01, 0x717, 0x04), + AZALIA_VERB_12B(0, 0x01, 0x715, 0x00), + AZALIA_VERB_12B(0, ALC269_LINE2, 0x70c, 0x00), +}; + +static const uint32_t microphone_disable_verb[] = { + AZALIA_PIN_CFG(0, ALC269_DMIC12, AZALIA_PIN_CFG_NC(0)), +}; + +void mainboard_azalia_program_runtime_verbs(uint8_t *base, uint32_t viddid) +{ + (void)viddid; + + if (get_uint_option("microphone", 1) == 0) + azalia_program_verb_table(base, microphone_disable_verb, + ARRAY_SIZE(microphone_disable_verb)); + + if (get_uint_option("legacy_speaker_control", 1) == 0) + azalia_program_verb_table(base, speaker_idle_verb, + ARRAY_SIZE(speaker_idle_verb)); +}