diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-02-08 13:08:51 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-02-10 07:21:22 +0000 |
commit | 082b36009c1c8c7233094b61ae2bd10d5e2589bc (patch) | |
tree | b8fd5676bf7b78f325c858e66e00c4beba38d844 | |
parent | d6d71ce442de2186ec3ea0a8fefcefb054915ded (diff) |
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 <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50389
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
-rw-r--r-- | src/mainboard/prodrive/hermes/hda_verb.c | 44 |
1 files changed, 44 insertions, 0 deletions
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 <device/azalia_device.h> +#include <types.h> + +#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)); +} |