diff options
-rwxr-xr-x | src/include/device/azalia.h | 132 | ||||
-rw-r--r-- | src/mainboard/asrock/imb-a180/BiosCallOuts.c | 73 |
2 files changed, 199 insertions, 6 deletions
diff --git a/src/include/device/azalia.h b/src/include/device/azalia.h new file mode 100755 index 0000000000..1f672fed36 --- /dev/null +++ b/src/include/device/azalia.h @@ -0,0 +1,132 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2013 Sage Electronic Engineering, LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AZALIA_H_ +#define AZALIA_H_ + +/* + * The tables found in this file are derived from the Intel High Definition + * Audio Specification Revision 1.0a, published 17 June 2010 + */ + +/* + * Page 177: Default Pin Configuration + */ + +enum AzaliaPinCfgPortConnectivity { + AZALIA_PINCFG_PORT_JACK = 0b00, + AZALIA_PINCFG_PORT_NC = 0b01, + AZALIA_PINCFG_PORT_FIXED = 0b10, + AZALIA_PINCFG_PORT_MULTIPLE = 0b11, +}; + +enum AzaliaPinCfgLocationGross { + AZALIA_PINCFG_LOCATION_EXTERNAL = 0x00, + AZALIA_PINCFG_LOCATION_INTERNAL = 0x10, + AZALIA_PINCFG_LOCATION_EXT_CHASSIS = 0x20, + AZALIA_PINCFG_LOCATION_OTHER = 0x30, +}; + +enum AzaliaPinCfgLocationFine { + AZALIA_PINCFG_LOCATION_NOT_APPLICABLE = 0x00, + AZALIA_PINCFG_LOCATION_REAR = 0x01, + AZALIA_PINCFG_LOCATION_FRONT = 0x02, + AZALIA_PINCFG_LOCATION_LEFT = 0x03, + AZALIA_PINCFG_LOCATION_RIGHT = 0x04, + AZALIA_PINCFG_LOCATION_TOP = 0x05, + AZALIA_PINCFG_LOCATION_BOTTOM = 0x06, +}; + +enum AzaliaPinCfgLocationSpecial { + AZALIA_PINCFG_LOCATION_REAR_PANEL = 0x07, + AZALIA_PINCFG_LOCATION_DRIVE_BAY = 0x08, + AZALIA_PINCFG_LOCATION_RISER_CARD = 0x17, + AZALIA_PINCFG_LOCATION_DIGITAL_DISPLAY = 0x18, + AZALIA_PINCFG_LOCATION_ATAPI = 0x19, + AZALIA_PINCFG_LOCATION_INSIDE_LID = 0x37, + AZALIA_PINCFG_LOCATION_OUTSIDE_LID = 0x38, +}; + +enum AzaliaPinCfgDefaultDevice { + AZALIA_PINCFG_DEVICE_LINEOUT = 0x0, + AZALIA_PINCFG_DEVICE_SPEAKER = 0x1, + AZALIA_PINCFG_DEVICE_HP_OUT = 0x2, + AZALIA_PINCFG_DEVICE_CD = 0x3, + AZALIA_PINCFG_DEVICE_SPDIF_OUT = 0x4, + AZALIA_PINCFG_DEVICE_DIGITAL_OUT = 0x5, + AZALIA_PINCFG_DEVICE_MODEM_LINE = 0x6, + AZALIA_PINCFG_DEVICE_MODEM_HANDSET = 0x7, + AZALIA_PINCFG_DEVICE_LINEIN = 0x8, + AZALIA_PINCFG_DEVICE_AUX = 0x9, + AZALIA_PINCFG_DEVICE_MICROPHONE = 0xA, + AZALIA_PINCFG_DEVICE_TELEPHONY = 0xB, + AZALIA_PINCFG_DEVICE_SPDIF_IN = 0xC, + AZALIA_PINCFG_DEVICE_DIGITAL_IN = 0xD, + AZALIA_PINCFG_DEVICE_OTHER = 0xF, +}; + +enum AzaliaPinCfgConnectionType { + AZALIA_PINCFG_CONN_UNKNOWN = 0x0, + AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK = 0x1, + AZALIA_PINCFG_CONN_STEREO_PHONE_JACK = 0x2, + AZALIA_PINCFG_CONN_INTERNAL_ATAPI = 0x3, + AZALIA_PINCFG_CONN_RCA = 0x4, + AZALIA_PINCFG_CONN_OPTICAL = 0x5, + AZALIA_PINCFG_CONN_OTHER_DIGITAL = 0x6, + AZALIA_PINCFG_CONN_OTHER_ANALOG = 0x7, + AZALIA_PINCFG_CONN_DIN_PLUG = 0x8, + AZALIA_PINCFG_CONN_XLR = 0x9, + AZALIA_PINCFG_CONN_MODEM_RJ11 = 0xA, + AZALIA_PINCFG_CONN_COMBINATION = 0xB, + AZALIA_PINCFG_CONN_OTHER = 0xF, +}; + +enum AzaliaPinCfgColor { + AZALIA_PINCFG_COLOR_UNKNOWN = 0x0, + AZALIA_PINCFG_COLOR_BLACK = 0x1, + AZALIA_PINCFG_COLOR_GREY = 0x2, + AZALIA_PINCFG_COLOR_BLUE = 0x3, + AZALIA_PINCFG_COLOR_GREEN = 0x4, + AZALIA_PINCFG_COLOR_RED = 0x5, + AZALIA_PINCFG_COLOR_ORANGE = 0x6, + AZALIA_PINCFG_COLOR_YELLOW = 0x7, + AZALIA_PINCFG_COLOR_PURPLE = 0x8, + AZALIA_PINCFG_COLOR_PINK = 0x9, + AZALIA_PINCFG_COLOR_WHITE = 0xE, + AZALIA_PINCFG_COLOR_OTHER = 0xF, +}; + +enum AzaliaPinCfgMisc { + AZALIA_PINCFG_MISC_IGNORE_PRESENCE = 0x1, +}; + +union AzaliaPinConfiguration { + unsigned int value; + struct __attribute__((aligned(4),packed)) { + enum AzaliaPinCfgPortConnectivity port:2; + unsigned char location:6; + enum AzaliaPinCfgDefaultDevice device:4; + enum AzaliaPinCfgConnectionType connection:4; + enum AzaliaPinCfgColor color:4; + unsigned char misc:4; + unsigned char association:4; + unsigned char sequence:4; + }; +}; + +#endif /* AZALIA_H_ */ diff --git a/src/mainboard/asrock/imb-a180/BiosCallOuts.c b/src/mainboard/asrock/imb-a180/BiosCallOuts.c index c307e91927..dc41579dab 100644 --- a/src/mainboard/asrock/imb-a180/BiosCallOuts.c +++ b/src/mainboard/asrock/imb-a180/BiosCallOuts.c @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <device/azalia.h> #include "agesawrapper.h" #include "amdlib.h" #include "BiosCallOuts.h" @@ -63,15 +64,75 @@ AGESA_STATUS GetBiosCallout (UINT32 Func, UINT32 Data, VOID *ConfigPtr) } /** - * AMD imb_a180 Platform ALC272 Verb Table + * CODEC Initialization Table for Azalia HD Audio using Realtek ALC662 chip */ -static const CODEC_ENTRY imb_a180_Alc662_VerbTbl[] = { - {0xFF, 0xFFFFFFFF} +static const CODEC_ENTRY Alc662_VerbTbl[] = +{ + { 0x14, /*01014010*/ /* Port D - green headphone jack */ + (AZALIA_PINCFG_PORT_JACK << 30) + | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) + | (AZALIA_PINCFG_DEVICE_LINEOUT << 20) + | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) + | (AZALIA_PINCFG_COLOR_GREEN << 12) + | (1 << 4) + | (0 << 0) + }, + { 0x15, /*0x90170120*/ /* Port A - white speaker header */ + (AZALIA_PINCFG_PORT_FIXED << 30) + | (AZALIA_PINCFG_LOCATION_INTERNAL << 24) + | (AZALIA_PINCFG_DEVICE_SPEAKER << 20) + | (AZALIA_PINCFG_CONN_OTHER_ANALOG << 16) + | (AZALIA_PINCFG_COLOR_WHITE << 12) + | (AZALIA_PINCFG_MISC_IGNORE_PRESENCE << 8) + | (2 << 4) + | (0 << 0) + }, + { 0x16, 0x411111F0 }, /* Port G - not connected */ + { 0x18, /*0x01A19040*/ /* Port B - pink headphone jack */ + (AZALIA_PINCFG_PORT_JACK << 30) + | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) + | (AZALIA_PINCFG_DEVICE_MICROPHONE << 20) + | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) + | (AZALIA_PINCFG_COLOR_PINK << 12) + | (4 << 4) + | (0 << 0) + }, + { 0x19, /*0x02A19050*/ /* Port F - front panel header mic */ + (AZALIA_PINCFG_PORT_NC << 30) + | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_FRONT) << 24) + | (AZALIA_PINCFG_DEVICE_MICROPHONE << 20) + | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) + | (AZALIA_PINCFG_COLOR_PINK << 12) + | (5 << 4) + | (0 << 0) + }, + { 0x1A, /*0x0181304F*/ /* Port C - NL blue headphone jack */ + (AZALIA_PINCFG_PORT_NC << 30) + | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_REAR) << 24) + | (AZALIA_PINCFG_DEVICE_LINEIN << 20) + | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) + | (AZALIA_PINCFG_COLOR_BLUE << 12) + | (4 << 4) + | (0xF << 0) + }, + { 0x1B, /*0x02214030*/ /* Port E - front panel line-out */ + (AZALIA_PINCFG_PORT_NC << 30) + | ((AZALIA_PINCFG_LOCATION_EXTERNAL | AZALIA_PINCFG_LOCATION_FRONT) << 24) + | (AZALIA_PINCFG_DEVICE_HP_OUT << 20) + | (AZALIA_PINCFG_CONN_MINI_HEADPHONE_JACK << 16) + | (AZALIA_PINCFG_COLOR_GREEN << 12) + | (3 << 4) + | (0 << 0) + }, + { 0x1C, 0x411111F0 }, /* CD-in - Not Connected */ + { 0x1D, 0x411111F0 }, /* PC Beep - Not Connected */ + { 0x1E, 0x411111F0 }, /* S/PDIF - Not connected */ + { 0xFF, 0xFFFFFFFF }, }; -static const CODEC_TBL_LIST imb_a180CodecTableList[] = +static const CODEC_TBL_LIST CodecTableList[] = { - {0x10ec0662, (CODEC_ENTRY*)&imb_a180_Alc662_VerbTbl[0]}, + {0x10ec0662, (CODEC_ENTRY*)Alc662_VerbTbl}, {(UINT32)0x0FFFFFFFF, (CODEC_ENTRY*)0x0FFFFFFFFUL} }; @@ -272,7 +333,7 @@ AGESA_STATUS Fch_Oem_config(UINT32 Func, UINT32 FchData, VOID *ConfigPtr) printk(BIOS_DEBUG, "Fch OEM config in INIT ENV "); /* Azalia Controller OEM Codec Table Pointer */ - FchParams_env->Azalia.AzaliaOemCodecTablePtr = (CODEC_TBL_LIST *)(&imb_a180CodecTableList[0]); + FchParams_env->Azalia.AzaliaOemCodecTablePtr = (CODEC_TBL_LIST*)CodecTableList; /* Azalia Controller Front Panel OEM Table Pointer */ /* Fan Control */ |