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)); +}