include/device/azalia: Add enums and MACROs

Instead of only using magic values add enums and defines to allow
writing the codec init sequence in human readable form.

This will replace the magic numbers in mainboards HDA verb tables.

Change-Id: Icad07c2b550657b879ad9328a70ba44629a0c939
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39694
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Rudolph 2020-03-20 10:07:53 +01:00 committed by Angel Pons
parent 8ebbe17b86
commit 9a521d7125
1 changed files with 88 additions and 0 deletions

View File

@ -17,6 +17,94 @@ extern const u32 cim_verb_data_size;
extern const u32 pc_beep_verbs[]; extern const u32 pc_beep_verbs[];
extern const u32 pc_beep_verbs_size; extern const u32 pc_beep_verbs_size;
enum azalia_pin_connection {
JACK = 0,
NC,
INTEGRATED,
JACK_AND_INTEGRATED,
};
enum azalia_pin_color {
COLOR_UNKNOWN = 0,
BLACK,
GREY,
BLUE,
GREEN,
RED,
ORANGE,
YELLOW,
PURPLE,
PINK,
WHITE = 0xe,
COLOR_OTHER = 0xf,
};
enum azalia_pin_type {
TYPE_UNKNOWN = 0,
STEREO_MONO_1_8,
STEREO_MONO_1_4,
ATAPI,
RCA,
OPTIONAL,
OTHER_DIGITAL,
OTHER_ANALOG,
MULTICHANNEL_ANALOG,
XLR,
RJ_11,
COMBINATION,
TYPE_OTHER = 0xf
};
enum azalia_pin_device {
LINE_OUT = 0,
SPEAKER,
HP_OUT,
CD,
SPDIF_OUT,
DIGITAL_OTHER_OUT,
MODEM_LINE_SIDE,
MODEM_HANDSET_SIDE,
LINE_IN,
AUX,
MIC_IN,
TELEPHONY,
SPDIF_IN,
DIGITAL_OTHER_IN,
DEVICE_OTHER = 0xf,
};
enum azalia_pin_location_1 {
NA = 0,
REAR,
FRONT,
LEFT,
RIGHT,
TOP,
BOTTOM,
SPECIAL7,
SPECIAL8,
SPECIAL9,
};
enum azalia_pin_location_2 {
EXTERNAL_PRIMARY_CHASSIS = 0,
INTERNAL,
SEPARATE_CHASSIS,
LOCATION_OTHER
};
#define AZALIA_PIN_DESC(conn, location2, location1, dev, type, color, no_presence_detect, \
association, sequence) \
(((conn) << 30) | \
((location2) << 27) | \
((location1) << 24) | \
((dev) << 20) | \
((type) << 16) | \
((color) << 12) | \
((no_presence_detect) << 8) | \
((sequence) << 4) | \
((sequence) << 0))
#define AZALIA_ARRAY_SIZES const u32 pc_beep_verbs_size = \ #define AZALIA_ARRAY_SIZES const u32 pc_beep_verbs_size = \
ARRAY_SIZE(pc_beep_verbs); \ ARRAY_SIZE(pc_beep_verbs); \
const u32 cim_verb_data_size = sizeof(cim_verb_data) const u32 cim_verb_data_size = sizeof(cim_verb_data)