coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
azalia_device.h File Reference
#include <acpi/acpi.h>
#include <device/mmio.h>
#include <device/device.h>
#include <stdint.h>
Include dependency graph for azalia_device.h:

Go to the source code of this file.

Macros

#define HDA_GCAP_REG   0x00
 
#define HDA_GCTL_REG   0x08
 
#define HDA_GCTL_CRST   (1 << 0)
 
#define HDA_STATESTS_REG   0x0e
 
#define HDA_IC_REG   0x60
 
#define HDA_IR_REG   0x64
 
#define HDA_ICII_REG   0x68
 
#define HDA_ICII_BUSY   (1 << 0)
 
#define HDA_ICII_VALID   (1 << 1)
 
#define AZALIA_PIN_DESC(conn, location2, location1, dev, type, color, no_presence_detect, association, sequence)
 
#define AZALIA_ARRAY_SIZES
 
#define AZALIA_VERB_12B(codec, pin, verb, val)    ((codec) << 28 | (pin) << 20 | (verb) << 8 | (val))
 
#define AZALIA_PIN_CFG(codec, pin, val)
 
#define AZALIA_PIN_CFG_NC(n)   (0x411111f0 | ((n) & 0xf))
 
#define AZALIA_RESET(pin)
 
#define AZALIA_SUBVENDOR(codec, val)
 

Enumerations

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 , OPTICAL , 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 }
 

Functions

int azalia_set_bits (void *port, u32 mask, u32 val)
 
int azalia_enter_reset (u8 *base)
 
int azalia_exit_reset (u8 *base)
 
u32 azalia_find_verb (const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb)
 
int azalia_program_verb_table (u8 *base, const u32 *verbs, u32 verb_size)
 
void azalia_codec_init (u8 *base, int addr, const u32 *verb_table, u32 verb_table_bytes)
 
void azalia_codecs_init (u8 *base, u16 codec_mask)
 
void azalia_audio_init (struct device *dev)
 
void mainboard_azalia_program_runtime_verbs (u8 *base, u32 viddid)
 

Variables

struct device_operations default_azalia_audio_ops
 
const u32 cim_verb_data []
 
const u32 cim_verb_data_size
 
const u32 pc_beep_verbs []
 
const u32 pc_beep_verbs_size
 

Macro Definition Documentation

◆ AZALIA_ARRAY_SIZES

#define AZALIA_ARRAY_SIZES
Value:
ARRAY_SIZE(pc_beep_verbs); \
const u32 cim_verb_data[]
Definition: hda_verb.c:5
const u32 cim_verb_data_size
Definition: hda_verb.c:39
const u32 pc_beep_verbs[]
Definition: hda_verb.c:37
const u32 pc_beep_verbs_size
Definition: hda_verb.c:38
uint32_t u32
Definition: stdint.h:51

Definition at line 127 of file azalia_device.h.

◆ AZALIA_PIN_CFG

#define AZALIA_PIN_CFG (   codec,
  pin,
  val 
)
Value:
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_12B(codec, pin, verb, val)
u8 val
Definition: sys.c:300

Definition at line 134 of file azalia_device.h.

◆ AZALIA_PIN_CFG_NC

#define AZALIA_PIN_CFG_NC (   n)    (0x411111f0 | ((n) & 0xf))

Definition at line 140 of file azalia_device.h.

◆ AZALIA_PIN_DESC

#define AZALIA_PIN_DESC (   conn,
  location2,
  location1,
  dev,
  type,
  color,
  no_presence_detect,
  association,
  sequence 
)
Value:
(((conn) << 30) | \
((location2) << 27) | \
((location1) << 24) | \
((dev) << 20) | \
((type) << 16) | \
((color) << 12) | \
((no_presence_detect) << 8) | \
((association) << 4) | \
((sequence) << 0))
unsigned int type
Definition: edid.c:57

Definition at line 115 of file azalia_device.h.

◆ AZALIA_RESET

#define AZALIA_RESET (   pin)
Value:
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)

Definition at line 142 of file azalia_device.h.

◆ AZALIA_SUBVENDOR

#define AZALIA_SUBVENDOR (   codec,
  val 
)
Value:
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)

Definition at line 148 of file azalia_device.h.

◆ AZALIA_VERB_12B

#define AZALIA_VERB_12B (   codec,
  pin,
  verb,
  val 
)     ((codec) << 28 | (pin) << 20 | (verb) << 8 | (val))

Definition at line 131 of file azalia_device.h.

◆ HDA_GCAP_REG

#define HDA_GCAP_REG   0x00

Definition at line 11 of file azalia_device.h.

◆ HDA_GCTL_CRST

#define HDA_GCTL_CRST   (1 << 0)

Definition at line 13 of file azalia_device.h.

◆ HDA_GCTL_REG

#define HDA_GCTL_REG   0x08

Definition at line 12 of file azalia_device.h.

◆ HDA_IC_REG

#define HDA_IC_REG   0x60

Definition at line 15 of file azalia_device.h.

◆ HDA_ICII_BUSY

#define HDA_ICII_BUSY   (1 << 0)

Definition at line 18 of file azalia_device.h.

◆ HDA_ICII_REG

#define HDA_ICII_REG   0x68

Definition at line 17 of file azalia_device.h.

◆ HDA_ICII_VALID

#define HDA_ICII_VALID   (1 << 1)

Definition at line 19 of file azalia_device.h.

◆ HDA_IR_REG

#define HDA_IR_REG   0x64

Definition at line 16 of file azalia_device.h.

◆ HDA_STATESTS_REG

#define HDA_STATESTS_REG   0x0e

Definition at line 14 of file azalia_device.h.

Enumeration Type Documentation

◆ azalia_pin_color

Enumerator
COLOR_UNKNOWN 
BLACK 
GREY 
BLUE 
GREEN 
RED 
ORANGE 
YELLOW 
PURPLE 
PINK 
WHITE 
COLOR_OTHER 

Definition at line 46 of file azalia_device.h.

◆ azalia_pin_connection

Enumerator
JACK 
NC 
INTEGRATED 
JACK_AND_INTEGRATED 

Definition at line 39 of file azalia_device.h.

◆ azalia_pin_device

Enumerator
LINE_OUT 
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 

Definition at line 77 of file azalia_device.h.

◆ azalia_pin_location_1

Enumerator
NA 
REAR 
FRONT 
LEFT 
RIGHT 
TOP 
BOTTOM 
SPECIAL7 
SPECIAL8 
SPECIAL9 

Definition at line 95 of file azalia_device.h.

◆ azalia_pin_location_2

Enumerator
EXTERNAL_PRIMARY_CHASSIS 
INTERNAL 
SEPARATE_CHASSIS 
LOCATION_OTHER 

Definition at line 108 of file azalia_device.h.

◆ azalia_pin_type

Enumerator
TYPE_UNKNOWN 
STEREO_MONO_1_8 
STEREO_MONO_1_4 
ATAPI 
RCA 
OPTICAL 
OTHER_DIGITAL 
OTHER_ANALOG 
MULTICHANNEL_ANALOG 
XLR 
RJ_11 
COMBINATION 
TYPE_OTHER 

Definition at line 61 of file azalia_device.h.

Function Documentation

◆ azalia_audio_init()

void azalia_audio_init ( struct device dev)

Definition at line 284 of file azalia_device.c.

References azalia_codecs_init(), base, BIOS_DEBUG, codec_detect(), PCI_BASE_ADDRESS_0, printk, probe_resource(), and res2mmio().

Referenced by hda_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_codec_init()

void azalia_codec_init ( u8 base,
int  addr,
const u32 verb_table,
u32  verb_table_bytes 
)

Definition at line 229 of file azalia_device.c.

References addr, azalia_find_verb(), azalia_program_verb_table(), base, BIOS_DEBUG, HDA_IC_REG, HDA_IR_REG, mainboard_azalia_program_runtime_verbs(), printk, read32(), wait_for_ready(), wait_for_valid(), and write32().

Referenced by azalia_codecs_init(), and minihd_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_codecs_init()

void azalia_codecs_init ( u8 base,
u16  codec_mask 
)

Definition at line 272 of file azalia_device.c.

References azalia_codec_init(), azalia_program_verb_table(), base, cim_verb_data, cim_verb_data_size, pc_beep_verbs, and pc_beep_verbs_size.

Referenced by azalia_audio_init(), azalia_init(), and hda_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_enter_reset()

int azalia_enter_reset ( u8 base)

Definition at line 38 of file azalia_device.c.

References azalia_set_bits(), base, HDA_GCTL_CRST, and HDA_GCTL_REG.

Referenced by codec_detect(), and hda_codec_detect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_exit_reset()

int azalia_exit_reset ( u8 base)

Definition at line 44 of file azalia_device.c.

References azalia_set_bits(), base, HDA_GCTL_CRST, and HDA_GCTL_REG.

Referenced by codec_detect(), and hda_codec_detect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_find_verb()

u32 azalia_find_verb ( const u32 verb_table,
u32  verb_table_bytes,
u32  viddid,
const u32 **  verb 
)

Definition at line 129 of file azalia_device.c.

Referenced by azalia_codec_init(), and hda_codec_init().

Here is the caller graph for this function:

◆ azalia_program_verb_table()

int azalia_program_verb_table ( u8 base,
const u32 verbs,
u32  verb_size 
)

Definition at line 213 of file azalia_device.c.

References azalia_write_verb(), and base.

Referenced by azalia_codec_init(), azalia_codecs_init(), disable_microphone(), and mainboard_r0x_configure_alc888().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ azalia_set_bits()

int azalia_set_bits ( void port,
u32  mask,
u32  val 
)

Definition at line 11 of file azalia_device.c.

References mask, mdelay(), read32(), stopwatch_expired(), stopwatch_init_msecs_expire(), val, and write32().

Referenced by azalia_enter_reset(), azalia_exit_reset(), and codec_detect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mainboard_azalia_program_runtime_verbs()

void mainboard_azalia_program_runtime_verbs ( u8 base,
u32  viddid 
)

Definition at line 225 of file azalia_device.c.

References AZALIA_CODEC_ALC256, AZALIA_CODEC_ALC269, base, BIOS_DEBUG, disable_microphone(), get_bmc_hsi(), get_uint_option(), mainboard_r0x_configure_alc888(), and printk.

Referenced by azalia_codec_init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cim_verb_data

const u32 cim_verb_data[]
extern

Definition at line 5 of file hda_verb.c.

Referenced by azalia_codecs_init().

◆ cim_verb_data_size

const u32 cim_verb_data_size
extern

Definition at line 39 of file hda_verb.c.

Referenced by azalia_codecs_init().

◆ default_azalia_audio_ops

struct device_operations default_azalia_audio_ops
extern

Definition at line 284 of file azalia_device.c.

◆ pc_beep_verbs

const u32 pc_beep_verbs[]
extern

Definition at line 37 of file hda_verb.c.

Referenced by azalia_codecs_init().

◆ pc_beep_verbs_size

const u32 pc_beep_verbs_size
extern

Definition at line 38 of file hda_verb.c.

Referenced by azalia_codecs_init().