soc/intel/common: Add PCIe device IDs for Snow Ridge
[coreboot2.git] / src / include / device / azalia_device.h
blob7fe6514ed2822a04aea4c707c592b0c8e068bcb9
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef DEVICE_AZALIA_H
4 #define DEVICE_AZALIA_H
6 #include <acpi/acpi.h>
7 #include <device/device.h>
8 #include <device/mmio.h>
9 #include <types.h>
11 #define HDA_GCAP_REG 0x00
12 #define HDA_GCTL_REG 0x08
13 #define HDA_GCTL_CRST (1 << 0)
14 #define HDA_STATESTS_REG 0x0e
15 #define HDA_IC_REG 0x60
16 #define HDA_IR_REG 0x64
17 #define HDA_ICII_REG 0x68
18 #define HDA_ICII_BUSY (1 << 0)
19 #define HDA_ICII_VALID (1 << 1)
21 #define AZALIA_MAX_CODECS 15
23 enum cb_err azalia_enter_reset(u8 *base);
24 enum cb_err azalia_exit_reset(u8 *base);
25 u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb);
26 int azalia_program_verb_table(u8 *base, const u32 *verbs, u32 verb_size);
27 void azalia_codec_init(u8 *base, int addr, const u32 *verb_table, u32 verb_table_bytes);
28 void azalia_codecs_init(u8 *base, u16 codec_mask);
29 void azalia_audio_init(struct device *dev);
30 extern struct device_operations default_azalia_audio_ops;
32 /* Optional hook to program codec settings that are only known at runtime */
33 void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid);
35 extern const u32 cim_verb_data[];
36 extern const u32 cim_verb_data_size;
37 extern const u32 pc_beep_verbs[];
38 extern const u32 pc_beep_verbs_size;
41 * The tables found in this file are derived from the Intel High Definition
42 * Audio Specification Revision 1.0a, published 17 June 2010
44 * 7.3.3.31 Configuration Default (page 177)
46 enum azalia_pin_connection {
47 AZALIA_JACK = 0x0,
48 AZALIA_NC = 0x1,
49 AZALIA_INTEGRATED = 0x2,
50 AZALIA_JACK_AND_INTEGRATED = 0x3,
53 enum azalia_pin_location_gross {
54 AZALIA_EXTERNAL_PRIMARY_CHASSIS = 0x00,
55 AZALIA_INTERNAL = 0x10,
56 AZALIA_SEPARATE_CHASSIS = 0x20,
57 AZALIA_LOCATION_OTHER = 0x30,
60 enum azalia_pin_location_geometric {
61 AZALIA_GEOLOCATION_NA = 0x0,
62 AZALIA_REAR = 0x1,
63 AZALIA_FRONT = 0x2,
64 AZALIA_LEFT = 0x3,
65 AZALIA_RIGHT = 0x4,
66 AZALIA_TOP = 0x5,
67 AZALIA_BOTTOM = 0x6,
68 AZALIA_SPECIAL7 = 0x7,
69 AZALIA_SPECIAL8 = 0x8,
70 AZALIA_SPECIAL9 = 0x9,
73 enum azalia_pin_location_special {
74 AZALIA_REAR_PANEL = AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_SPECIAL7,
75 AZALIA_DRIVE_BAY = AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_SPECIAL8,
76 AZALIA_RISER = AZALIA_INTERNAL | AZALIA_SPECIAL7,
77 AZALIA_DIGITAL_DISPLAY = AZALIA_INTERNAL | AZALIA_SPECIAL8,
78 AZALIA_ATAPI = AZALIA_INTERNAL | AZALIA_SPECIAL9,
79 AZALIA_MOBILE_LID_INSIDE = AZALIA_LOCATION_OTHER | AZALIA_SPECIAL7,
80 AZALIA_MOBILE_LID_OUTSIDE = AZALIA_LOCATION_OTHER | AZALIA_SPECIAL8,
83 enum azalia_pin_device {
84 AZALIA_LINE_OUT = 0x0,
85 AZALIA_SPEAKER = 0x1,
86 AZALIA_HP_OUT = 0x2,
87 AZALIA_CD = 0x3,
88 AZALIA_SPDIF_OUT = 0x4,
89 AZALIA_DIGITAL_OTHER_OUT = 0x5,
90 AZALIA_MODEM_LINE_SIDE = 0x6,
91 AZALIA_MODEM_HANDSET_SIDE = 0x7,
92 AZALIA_LINE_IN = 0x8,
93 AZALIA_AUX = 0x9,
94 AZALIA_MIC_IN = 0xa,
95 AZALIA_TELEPHONY = 0xb,
96 AZALIA_SPDIF_IN = 0xc,
97 AZALIA_DIGITAL_OTHER_IN = 0xd,
98 AZALIA_DEVICE_OTHER = 0xf,
101 enum azalia_pin_type {
102 AZALIA_TYPE_UNKNOWN = 0x0,
103 AZALIA_STEREO_MONO_1_8 = 0x1,
104 AZALIA_STEREO_MONO_1_4 = 0x2,
105 AZALIA_ATAPI_INTERNAL = 0x3,
106 AZALIA_RCA = 0x4,
107 AZALIA_OPTICAL = 0x5,
108 AZALIA_OTHER_DIGITAL = 0x6,
109 AZALIA_OTHER_ANALOG = 0x7,
110 AZALIA_MULTICHANNEL_ANALOG = 0x8,
111 AZALIA_XLR = 0x9,
112 AZALIA_RJ_11 = 0xa,
113 AZALIA_COMBINATION = 0xb,
114 AZALIA_TYPE_OTHER = 0xf,
117 enum azalia_pin_color {
118 AZALIA_COLOR_UNKNOWN = 0x0,
119 AZALIA_BLACK = 0x1,
120 AZALIA_GREY = 0x2,
121 AZALIA_BLUE = 0x3,
122 AZALIA_GREEN = 0x4,
123 AZALIA_RED = 0x5,
124 AZALIA_ORANGE = 0x6,
125 AZALIA_YELLOW = 0x7,
126 AZALIA_PURPLE = 0x8,
127 AZALIA_PINK = 0x9,
128 AZALIA_WHITE = 0xe,
129 AZALIA_COLOR_OTHER = 0xf,
132 enum azalia_pin_misc {
133 AZALIA_JACK_PRESENCE_DETECT = 0x0,
134 AZALIA_NO_JACK_PRESENCE_DETECT = 0x1,
137 #define AZALIA_PIN_DESC(conn, location, dev, type, color, misc, association, sequence) \
138 ((((conn) << 30) & 0xc0000000) | \
139 (((location) << 24) & 0x3f000000) | \
140 (((dev) << 20) & 0x00f00000) | \
141 (((type) << 16) & 0x000f0000) | \
142 (((color) << 12) & 0x0000f000) | \
143 (((misc) << 8) & 0x00000f00) | \
144 (((association) << 4) & 0x000000f0) | \
145 (((sequence) << 0) & 0x0000000f))
147 #define AZALIA_ARRAY_SIZES const u32 pc_beep_verbs_size = \
148 ARRAY_SIZE(pc_beep_verbs); \
149 const u32 cim_verb_data_size = sizeof(cim_verb_data)
151 #define AZALIA_VERB_12B(codec, pin, verb, val) \
152 ((codec) << 28 | (pin) << 20 | (verb) << 8 | (val))
154 #define AZALIA_PIN_CFG(codec, pin, val) \
155 AZALIA_VERB_12B(codec, pin, 0x71c, ((val) >> 0) & 0xff), \
156 AZALIA_VERB_12B(codec, pin, 0x71d, ((val) >> 8) & 0xff), \
157 AZALIA_VERB_12B(codec, pin, 0x71e, ((val) >> 16) & 0xff), \
158 AZALIA_VERB_12B(codec, pin, 0x71f, ((val) >> 24) & 0xff)
160 #define AZALIA_PIN_CFG_NC(n) (0x411111f0 | ((n) & 0xf))
162 #define AZALIA_RESET(pin) \
163 AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
164 AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
165 AZALIA_VERB_12B(0, pin, 0x7ff, 0), \
166 AZALIA_VERB_12B(0, pin, 0x7ff, 0)
168 #define AZALIA_SUBVENDOR(codec, val) \
169 AZALIA_VERB_12B(codec, 1, 0x720, ((val) >> 0) & 0xff), \
170 AZALIA_VERB_12B(codec, 1, 0x721, ((val) >> 8) & 0xff), \
171 AZALIA_VERB_12B(codec, 1, 0x722, ((val) >> 16) & 0xff), \
172 AZALIA_VERB_12B(codec, 1, 0x723, ((val) >> 24) & 0xff)
174 #endif /* DEVICE_AZALIA_H */