device/azalia: Add enums for HDA verb and parameter IDs

This is a purely cosmetic change to make things slightly more easier to
read. We also only add the IDs which are actively used in the codebase.

TEST=Timeless build produces identical binaries

Change-Id: I4ec0a570020059c85768bab913dff1ba1977e9f9
Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88917
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
This commit is contained in:
Nicholas Sudsgaard 2025-08-21 08:42:47 +09:00 committed by Matt DeVillier
commit 0a328282ec
2 changed files with 43 additions and 24 deletions

View file

@ -249,8 +249,7 @@ static bool codec_is_operative(u8 *base, const int addr)
return false;
}
const u32 reg32 = (addr << 28) | 0x000f0000;
write32(base + HDA_IC_REG, reg32);
write32(base + HDA_IC_REG, AZALIA_VERB_GET_VENDOR_ID(addr));
if (wait_for_valid(base) < 0) {
printk(BIOS_NOTICE, "azalia_audio: codec #%d doesn't respond\n", addr);

View file

@ -37,12 +37,29 @@ extern const u32 cim_verb_data_size;
extern const u32 pc_beep_verbs[];
extern const u32 pc_beep_verbs_size;
/*
* The tables found in this file are derived from the Intel High Definition
* Audio Specification Revision 1.0a, published 17 June 2010
*
* 7.3.3.31 Configuration Default (page 177)
*/
/* The tables found in this file are derived from the Intel High Definition
Audio Specification Revision 1.0a, published 17 June 2010 */
/* Reference: 7.3.3 Controls (page 141) */
enum azalia_verb_id {
AZALIA_GET_PARAMETER = 0xf00,
AZALIA_SET_SUBSYSTEM_ID_1 = 0x720,
AZALIA_SET_SUBSYSTEM_ID_2 = 0x721,
AZALIA_SET_SUBSYSTEM_ID_3 = 0x722,
AZALIA_SET_SUBSYSTEM_ID_4 = 0x723,
AZALIA_SET_CONFIGURATION_DEFAULT_1 = 0x71c,
AZALIA_SET_CONFIGURATION_DEFAULT_2 = 0x71d,
AZALIA_SET_CONFIGURATION_DEFAULT_3 = 0x71e,
AZALIA_SET_CONFIGURATION_DEFAULT_4 = 0x71f,
AZALIA_FUNCTION_RESET = 0x7ff,
};
/* Reference: 7.3.4 Parameters (page 198) */
enum azalia_parameter_id {
AZALIA_PARAMETER_VENDOR_ID = 0x00,
};
/* Reference: 7.3.3.31 Configuration Default (page 177) */
enum azalia_pin_connection {
AZALIA_JACK = 0x0,
AZALIA_NC = 0x1,
@ -151,24 +168,27 @@ enum azalia_pin_misc {
#define AZALIA_VERB_12B(codec, pin, verb, val) \
((codec) << 28 | (pin) << 20 | (verb) << 8 | (val))
#define AZALIA_PIN_CFG(codec, pin, val) \
AZALIA_VERB_12B(codec, pin, 0x71c, ((val) >> 0) & 0xff), \
AZALIA_VERB_12B(codec, pin, 0x71d, ((val) >> 8) & 0xff), \
AZALIA_VERB_12B(codec, pin, 0x71e, ((val) >> 16) & 0xff), \
AZALIA_VERB_12B(codec, pin, 0x71f, ((val) >> 24) & 0xff)
#define AZALIA_VERB_GET_VENDOR_ID(codec) \
AZALIA_VERB_12B(codec, 0, AZALIA_GET_PARAMETER, AZALIA_PARAMETER_VENDOR_ID)
#define AZALIA_PIN_CFG(codec, pin, val) \
AZALIA_VERB_12B(codec, pin, AZALIA_SET_CONFIGURATION_DEFAULT_1, ((val) >> 0) & 0xff), \
AZALIA_VERB_12B(codec, pin, AZALIA_SET_CONFIGURATION_DEFAULT_2, ((val) >> 8) & 0xff), \
AZALIA_VERB_12B(codec, pin, AZALIA_SET_CONFIGURATION_DEFAULT_3, ((val) >> 16) & 0xff), \
AZALIA_VERB_12B(codec, pin, AZALIA_SET_CONFIGURATION_DEFAULT_4, ((val) >> 24) & 0xff)
#define AZALIA_PIN_CFG_NC(n) (0x411111f0 | ((n) & 0xf))
#define AZALIA_RESET(pin) \
AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
AZALIA_VERB_12B(0, pin, 0x7ff, 0)
#define AZALIA_RESET(pin) \
AZALIA_VERB_12B(0, pin, AZALIA_FUNCTION_RESET, 0), \
AZALIA_VERB_12B(0, pin, AZALIA_FUNCTION_RESET, 0), \
AZALIA_VERB_12B(0, pin, AZALIA_FUNCTION_RESET, 0), \
AZALIA_VERB_12B(0, pin, AZALIA_FUNCTION_RESET, 0)
#define AZALIA_SUBVENDOR(codec, val) \
AZALIA_VERB_12B(codec, 1, 0x720, ((val) >> 0) & 0xff), \
AZALIA_VERB_12B(codec, 1, 0x721, ((val) >> 8) & 0xff), \
AZALIA_VERB_12B(codec, 1, 0x722, ((val) >> 16) & 0xff), \
AZALIA_VERB_12B(codec, 1, 0x723, ((val) >> 24) & 0xff)
#define AZALIA_SUBVENDOR(codec, val) \
AZALIA_VERB_12B(codec, 1, AZALIA_SET_SUBSYSTEM_ID_1, ((val) >> 0) & 0xff), \
AZALIA_VERB_12B(codec, 1, AZALIA_SET_SUBSYSTEM_ID_2, ((val) >> 8) & 0xff), \
AZALIA_VERB_12B(codec, 1, AZALIA_SET_SUBSYSTEM_ID_3, ((val) >> 16) & 0xff), \
AZALIA_VERB_12B(codec, 1, AZALIA_SET_SUBSYSTEM_ID_4, ((val) >> 24) & 0xff)
#endif /* DEVICE_AZALIA_H */