From 082b36009c1c8c7233094b61ae2bd10d5e2589bc Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Mon, 8 Feb 2021 13:08:51 +0100 Subject: mb/prodrive/hermes: Configure 'internal audio' Implement `mainboard_azalia_program_runtime_verbs` to configure the Realtek ALC888 codec according to the settings in the EEPROM. The encoding of the `internal_audio_connection` field is: 0: Disabled 1: Front HP out 2: Internal speaker Change-Id: I5e0013217838888977aaa9259e0cfb78c82f719f Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/50389 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/mainboard/prodrive/hermes/hda_verb.c | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/mainboard/prodrive/hermes/hda_verb.c') diff --git a/src/mainboard/prodrive/hermes/hda_verb.c b/src/mainboard/prodrive/hermes/hda_verb.c index 59b8aa603c..473a2869a9 100644 --- a/src/mainboard/prodrive/hermes/hda_verb.c +++ b/src/mainboard/prodrive/hermes/hda_verb.c @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include + +#include "variants/baseboard/include/eeprom.h" const u32 cim_verb_data[] = { 0x10ec0888, /* Codec Vendor / Device ID: Realtek ALC888 */ @@ -168,3 +171,44 @@ const u32 cim_verb_data[] = { const u32 pc_beep_verbs[0] = {}; AZALIA_ARRAY_SIZES; + +static u32 get_internal_audio_cfg(uint8_t internal_audio_connection) +{ + switch (internal_audio_connection) { + default: + case 0: + return AZALIA_PIN_CFG_NC(0); + case 1: + return 0x022a4c40; + case 2: + return AZALIA_PIN_DESC( + INTEGRATED, + INTERNAL, + NA, + SPEAKER, + TYPE_UNKNOWN, + COLOR_UNKNOWN, + false, + 0xf, + 0); + } +} + +void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid) +{ + if (viddid != 0x10ec0888) + return; + + const struct eeprom_board_settings *const board_cfg = get_board_settings(); + + if (!board_cfg) + return; + + const u32 config = get_internal_audio_cfg(board_cfg->internal_audio_connection); + + const u32 verbs[] = { + AZALIA_PIN_CFG(0, 0x1b, config), + }; + + azalia_program_verb_table(base, verbs, ARRAY_SIZE(verbs)); +} -- cgit v1.2.3