| 1 |
|
| 2 |
|
| 3 |
#include <device/azalia_device.h> |
| 4 |
#include <types.h> |
| 5 |
|
| 6 |
#include "eeprom.h" |
| 7 |
|
| 8 |
const u32 cim_verb_data[] = { |
| 9 |
0x10ec0888, |
| 10 |
0x10ec0888, |
| 11 |
15, |
| 12 |
AZALIA_SUBVENDOR(0, 0x1d336700), |
| 13 |
|
| 14 |
|
| 15 |
AZALIA_PIN_CFG(0, 0x11, AZALIA_PIN_CFG_NC(0)), |
| 16 |
AZALIA_PIN_CFG(0, 0x12, AZALIA_PIN_CFG_NC(0)), |
| 17 |
AZALIA_PIN_CFG(0, 0x14, 0x01014430), |
| 18 |
AZALIA_PIN_CFG(0, 0x16, AZALIA_PIN_CFG_NC(0)), |
| 19 |
AZALIA_PIN_CFG(0, 0x17, AZALIA_PIN_CFG_NC(0)), |
| 20 |
AZALIA_PIN_CFG(0, 0x18, 0x01a19c50), |
| 21 |
AZALIA_PIN_CFG(0, 0x1c, AZALIA_PIN_CFG_NC(0)), |
| 22 |
AZALIA_PIN_CFG(0, 0x1d, 0x4004c601), |
| 23 |
AZALIA_PIN_CFG(0, 0x1e, 0x01452160), |
| 24 |
AZALIA_PIN_CFG(0, 0x1f, 0x01c52170), |
| 25 |
|
| 26 |
|
| 27 |
AZALIA_PIN_CFG(0, 0x19, 0x02214c40), |
| 28 |
AZALIA_PIN_CFG(0, 0x1a, 0x901001f0), |
| 29 |
AZALIA_PIN_CFG(0, 0x1b, 0x01813c10), |
| 30 |
AZALIA_PIN_CFG(0, 0x15, 0x02a19c20), |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
0x8086280b, |
| 38 |
0xffffffff, |
| 39 |
5, |
| 40 |
|
| 41 |
AZALIA_SUBVENDOR(2, 0x80860101), |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
0x20878101, |
| 50 |
|
| 51 |
|
| 52 |
AZALIA_PIN_CFG(2, 0x05, 0x18560010), |
| 53 |
|
| 54 |
AZALIA_PIN_CFG(2, 0x06, 0x18560020), |
| 55 |
|
| 56 |
AZALIA_PIN_CFG(2, 0x07, 0x18560030), |
| 57 |
|
| 58 |
0x20878100, |
| 59 |
|
| 60 |
|
| 61 |
0x20878100, |
| 62 |
0x20878100, |
| 63 |
}; |
| 64 |
|
| 65 |
const u32 pc_beep_verbs[0] = {}; |
| 66 |
|
| 67 |
AZALIA_ARRAY_SIZES; |
| 68 |
|
| 69 |
static const u32 r04_verb_data[] = { |
| 70 |
AZALIA_PIN_CFG(0, 0x19, 0x02a19c20), |
| 71 |
AZALIA_PIN_CFG(0, 0x1a, 0x01813c51), |
| 72 |
AZALIA_PIN_CFG(0, 0x1b, AZALIA_PIN_CFG_NC(0)), |
| 73 |
AZALIA_PIN_CFG(0, 0x15, AZALIA_PIN_CFG_NC(0)), |
| 74 |
}; |
| 75 |
|
| 76 |
static u32 get_port_c_vref_cfg(uint8_t blue_rear_vref) |
| 77 |
{ |
| 78 |
switch (blue_rear_vref) { |
| 79 |
default: |
| 80 |
case 0: |
| 81 |
return 0x02040000; |
| 82 |
case 1: |
| 83 |
return 0x02041000; |
| 84 |
case 2: |
| 85 |
return 0x02044000; |
| 86 |
case 3: |
| 87 |
return 0x02045000; |
| 88 |
case 4: |
| 89 |
return 0x02046000; |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
static u32 get_port_b_vref_cfg(uint8_t pink_rear_vref) |
| 94 |
{ |
| 95 |
switch (pink_rear_vref) { |
| 96 |
default: |
| 97 |
case 0: |
| 98 |
return 0; |
| 99 |
case 1: |
| 100 |
return 1; |
| 101 |
case 2: |
| 102 |
return 4; |
| 103 |
case 3: |
| 104 |
return 5; |
| 105 |
case 4: |
| 106 |
return 2; |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
static u32 get_front_panel_cfg(uint8_t front_panel_audio) |
| 111 |
{ |
| 112 |
switch (front_panel_audio) { |
| 113 |
default: |
| 114 |
case 0: |
| 115 |
return AZALIA_PIN_CFG_NC(0); |
| 116 |
case 1: |
| 117 |
return 0x02214c40; |
| 118 |
case 2: |
| 119 |
return 0x0227ec40; |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
static u32 get_front_mic_cfg(uint8_t front_panel_audio) |
| 124 |
{ |
| 125 |
return front_panel_audio == 2 ? AZALIA_PIN_CFG_NC(0) : 0x02a19c20; |
| 126 |
} |
| 127 |
|
| 128 |
static void mainboard_r0x_configure_alc888(u8 *base, u32 viddid) |
| 129 |
{ |
| 130 |
|
| 131 |
azalia_program_verb_table(base, r04_verb_data, ARRAY_SIZE(r04_verb_data)); |
| 132 |
|
| 133 |
const struct eeprom_board_settings *const board_cfg = get_board_settings(); |
| 134 |
|
| 135 |
const u32 front_panel_cfg = get_front_panel_cfg(board_cfg->front_panel_audio); |
| 136 |
|
| 137 |
const u32 front_mic_cfg = get_front_mic_cfg(board_cfg->front_panel_audio); |
| 138 |
|
| 139 |
const u32 port_b_vref_cfg = get_port_b_vref_cfg(board_cfg->pink_rear_vref); |
| 140 |
|
| 141 |
const u32 verbs[] = { |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
AZALIA_PIN_CFG(0, 0x12, 0x411110f0 | port_b_vref_cfg << 8), |
| 149 |
AZALIA_PIN_CFG(0, 0x19, front_mic_cfg), |
| 150 |
AZALIA_PIN_CFG(0, 0x1b, front_panel_cfg), |
| 151 |
0x0205000d, |
| 152 |
get_port_c_vref_cfg(board_cfg->blue_rear_vref), |
| 153 |
}; |
| 154 |
azalia_program_verb_table(base, verbs, ARRAY_SIZE(verbs)); |
| 155 |
} |
| 156 |
|
| 157 |
void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid) |
| 158 |
{ |
| 159 |
if (viddid == 0x10ec0888) { |
| 160 |
u8 hsi = get_bmc_hsi(); |
| 161 |
|
| 162 |
if (hsi >= 3) |
| 163 |
mainboard_r0x_configure_alc888(base, viddid); |
| 164 |
} |
| 165 |
} |