Attention is currently required from: Patrick Rudolph, Christian Walter. Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/50383 )
Change subject: mb/prodrive/hermes: Configure 'internal audio' ......................................................................
Patch Set 2:
(1 comment)
File src/mainboard/prodrive/hermes/hda_verb.c:
https://review.coreboot.org/c/coreboot/+/50383/comment/153baeb9_ba235f1c PS2, Line 186: verbs = malloc(sizeof(u32) * 4); : if (!verbs) : return NULL; : : *verb_table_size = 0; : : if (board_cfg->internal_audio_connection == 0) { : static u32 verb_data[] = { : AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), : }; : memcpy(&verbs[*verb_table_size], verb_data, sizeof(verb_data)); : *verb_table_size += sizeof(verb_data) / sizeof(u32); : : } else if (board_cfg->internal_audio_connection == 1) { : static u32 verb_data[] = { : AZALIA_PIN_CFG(0, 0x1b, 0x02214c40), : }; : memcpy(&verbs[*verb_table_size], verb_data, sizeof(verb_data)); : *verb_table_size += sizeof(verb_data) / sizeof(u32); : } else { : static u32 verb_data[] = { : AZALIA_PIN_CFG(0, 0x1b, AZALIA_PIN_DESC( : INTEGRATED, : INTERNAL, : NA, : SPEAKER, : TYPE_UNKNOWN, : COLOR_UNKNOWN, : false, : 0xf, : 0)), : }; : memcpy(&verbs[*verb_table_size], verb_data, sizeof(verb_data)); : *verb_table_size += sizeof(verb_data) / sizeof(u32); : } : : /* Leak verbs */ : return verbs; It shouldn't be necessary to malloc() an array:
const u32 *azalia_extra_verb_table(u32 viddid, u32 *verb_table_size) { const struct eeprom_board_settings *const board_cfg = get_board_settings();
if (viddid != 0x10ec0888) return NULL;
if (!board_cfg) return NULL;
static const u32 verbs[3][4] = { [0] = { AZALIA_PIN_CFG(0, 0x1b, 0x411111f0), }, [1] = { AZALIA_PIN_CFG(0, 0x1b, 0x02214c40), }, [2] = { AZALIA_PIN_CFG(0, 0x1b, AZALIA_PIN_DESC( INTEGRATED, INTERNAL, NA, SPEAKER, TYPE_UNKNOWN, COLOR_UNKNOWN, false, 0xf, 0)), }, };
const u32 idx = MIN(board_cfg->internal_audio_connection, ARRAY_SIZE(verbs) - 1); *verb_table_size = ARRAY_SIZE(verbs[idx]); return verbs[idx]; }
Note that this assumes each option has the same number of verbs.