AppleHDA Patching Guide

Getting the Audio working

Introduction

This is a complete AppleHDA patching guide for Audio codecs in Notebooks (but in theory works for Desktop too). This guide is based upon information gathered from around the web on sites like OSXLattitude and OSXArena. Hopefully this could help many people looking to patch their AppleHDA by themselves to get their audio working. I did my best to make this as simple as possible and will try to improve as the time passes. For this guide, I'm using the Realtek ALC269 audio codec found in the Acer Z3-605 All-In-One.

Also I don't take credit for all this information entirely except for appreciation on writing this guide. The credit will go to all these people: king, Master Chief, RevoGirl, toleda, bcc9, TimeWalker and InsanelyDeepak who has helped me with a few of these in the past, plus many others who contributed to AppleHDA patching.

Lets get started!

Chapter One: Gathering Information

Getting the codec dump

The first step in this process is getting a dump of the codec. This is done from with a linux operating system.

Boot your computer using a Linux live USB/DVD (Ubuntu recommended), an choose to run live, not install. Open up the terminal application and type the following command:

cat /proc/asound/card0/codec#0 > ~/Desktop/codec_dump.txt 

This will create a file on the desktop that contains the information that we need. Copy it to a location we can access later (USB for example).

Codec Information

Open the codec_dump.txt file in your favourite text editor. At the top of the file you will see the basic codec information that we need.

CODEC: Realtek ALC269VC
ADDRESS: 0
VENDOR ID: 0x10ec0269 [Decimal: 283902569]

Extracting node information

There are four sets of nodes that we need to extract from the codec dump, plus some info about each one. They are:

The following code snippet is an example of a Pin Complex node with the information that we need highlighted. Make a note of each node and the highlighted information associated with it.

Node 0x12 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Control: name="Internal Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000020: IN
  EAPD 0x2: EAPD
  Pin Default 0x90a60140: [Fixed] Mic at Int N/A
    Conn = Digital, Color = Unknown
    DefAssociation = 0x4, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x20: IN
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x0c 0x0d*

You should end up with a list like this one:

Node 0x12 [Pin Complex] Pin Default: 0x90a60140, Connections: None
Node 0x15 [Pin Complex] Pin Default: 0x0221101f, EAPD: 0x02, Connections: 0x0c 0x0d*

Node 0x0b [Audio Mixer] Connections: 0x18 0x19 0x1a 0x1b 0x1d
Node 0x0c [Audio Mixer] Connections: 0x02 0x0b

Node 0x02 [Audio Output]
Node 0x03 [Audio Output]

Node 0x08 [Audio Input] Connections: 0x23
Node 0x09 [Audio Input] Connections: 0x22

Chapter Two: Calculating Codec Verb Commands

Initial Extraction

Codec Verb Commands are obtained from the Pin Default of each Pin Complex node. The verbs are in host-byte order, which basically means that the numbers are read in sets of 2 from right to left. Using the Pin Complex from node 0x15 in the example above, we would end up with something like this:

Pin Default: 0x0221101f Codec Verb: 1f 10 21 02 EAPD: 02

Correcting the Verbs

Verb Commands

The next step is to create the verb commands from the codec verbs above. The verb commands use the following format:
Codec Address + Node ID + Verb Commands + Verb Data

The codec address is found at the top of the codec_dump.txt file; in the case of the example above, the address is 0. Verb Commands are standard and are the same for each of the nodes. They are: 71c, 71d, 71e, 71f and if the node has EAPD, you would also need 70c. The Verb Data is each set of 2 digits from the codec verbs above.

Putting it all together for Node 15 in the above example, you would end up with this:

Codec: Realtek ALC269VC, Address: 0, Codec ID: 0x10ec0269
Node 0x15, Pin Default: 0x0221101f, Corrected Codec Verb: 1f 10 21 02, EAPD: 02

01571c1f 01571d10 01571e21 01571f02 01570c02

Repeat this process for each of the Pin Complex nodes:

Node 12: 01271c10 01271d01 01271ea6 01271f90
Node 15: 01571c20 01271d10 01571e21 01571f02 01570c02
Node 18: 01871c30 01871d10 01871e81 01871f02
Node 19: 01971c40 01971d30 01971e81 01971f01
Node 1a: 01a71c50 01a71d01 01a71e17 01a71f90
Node 1b: 01b71c60 01b71d10 01b71e41 01b71f01

Chapter Three: Calculating PathMaps

Insert text here...

Chapter Four: Patching XML Files

Insert text here...

Chapter Five: AppleHDA Binary Patching

Insert text here...

Chapter Six: Conclusion

Insert text here...