View Single Post
 
Old 05-13-2009, 01:13 PM
candykane candykane is offline
Jaguar
 
Join Date: May 2009
Location: schiedam
Posts: 36
A guide on how to fix audio via dsdt
Audio should not be so complicated, having to use another extension to load information into the system makes no sense when most of you are already using a device-property string for graphics or using a modified DSDT so you may as well save resources.

HDAEnabler.kext and/or ALCinject.kext are not required to make audio work properly.

What is needed is AlainTox714's AppleHDA.kext and the following 3 peices of information:
layout-id
codec-id
PinConfigurations
You can do it through a device-property string or through DSDT (this can yield a better result).

I've tried both methods and they yielded working audio, but the DSDT solution seems to be more ACPI compliant.

You can make the PinConfigurations data if you have the ConfigData in the /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAController.kext/Contents/Info.plist file.

(you only need the last bite from each segment)
<00a71c1f 00a71d40 00a71e21 00a71f02 00b71c40 00b71d90 00b71ea1 00b71f02 00c71c2e 00c71d30 00c71e81 00c71f01 00d71c10 00d71d40 00d71e11 00d71f01 00e71c20 00e71d90 00e71ea1 00e71f01 00f71c12 00f71d10 00f71e11 00f71f01 01071c11 01071d70 01071e11 01071f01 02171c50 02171d21 02171e45 02171f01>

Another solution is to search the codec file for lines that contain [Jack], take the hex values and reverse the order, order them by their node number.
CODE
Codec: SigmaTel STAC9274D
Address: 2
Vendor Id: 0x83847621
Subsystem Id: 0x80860419
Revision Id: 0x100201
Default PCM: rates 0x7e0, bits 0x0e, types 0x1
Default Amp-In caps: ofs=0x00, nsteps=0x0e, stepsize=0x05, mute=0
Default Amp-Out caps: ofs=0x7f, nsteps=0x7f, stepsize=0x02, mute=1

Node 0x0a [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x0221401f: [Jack] HP Out at Ext Front
Conn = 1/8, Color = Green
becomes 1f402101
00a71c1f 00a71d40 00a71e21 00a71f02

Node 0x0b [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x02a19040: [Jack] Mic at Ext Front
Conn = 1/8, Color = Pink
becomes 4090a102
00b71c40 00b71d90 00b71ea1 00b71f02

Node 0x0c [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x0181302e: [Jack] Line In at Ext Rear
Conn = 1/8, Color = Blue
becomes 2e308101
00c71c2e 00c71d30 00c71e81 00c71f01

Node 0x0d [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01114010: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Green
becomes 10401101
00d71c10 00d71d40 00d71e11 00d71f01

Node 0x0e [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01a19020: [Jack] Mic at Ext Rear
Conn = 1/8, Color = Pink
becomes 2090a101
00e71c20 00e71d90 00e71ea1 00e71f01

Node 0x0f [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01111012: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Black
becomes 12101101
00f71c12 00f71d10 00f71e11 00f71f01

Node 0x10 [Pin Complex] wcaps 0x400181: Stereo
Pin Default 0x01117011: [Jack] Speaker at Ext Rear
Conn = 1/8, Color = Yellow
becomes 11701101
01071c11 01071d70 01071e11 01071f01

Node 0x21 [Pin Complex] wcaps 0x400301: Stereo Digital
Pin Default 0x01452150: [Jack] SPDIF Out at Ext Rear
Conn = Optical, Color = Grey
becomes 50214501
02171c50 02171d21 02171e45 02171f01

Using the PinConfigurations data you can convert it for your device-property string XML file using the following command:
CODE
echo "1f4021014090a1022e308101104011012090a101121011011 170110150214501" | xxd -r -p | openssl enc -base64
This gave me
CODE
H0AhAUCQoQIuMIEBEEARASCQoQESEBEBEXARAVAhRQE= for my BadAxe2 (STAC9274D)

Find the slot holding the audio hardware
CODE
gfxutil -f HDEF; # if that fails try AZAL in place of HDEF

For the BadAxe2 that gave me
CODE
DevicePath = PciRoot(0x0)/Pci(0x1b,0x0)

I added the following to my XML file and then regenerated my string using gfxutil: (gfxutil -s -v -n -i xml -o hex in.plist out.hex)
CODE
<key>PciRoot(0x0)/Pci(0x1b,0x0)</key>
<dict>
<key>PinConfigurations</key>
<data>
H0AhAUCQoQIuMIEBEEARASCQoQESEBEBEXARAVAhRQE=
</data>
<key>codec-id</key>
<string>0x83847683</string>
<key>layout-id</key>
<string>0x04000000</string>
</dict>

What would be nice is a script or program that gives you the PinConfigurations data by dropping the codec on it.

In the end I chose to do my BadAxe2 in DSDT only because I'm already doing so much in it that the few extra bytes didn't hurt and saved me loading another kext that isn't really needed.

You can achieve this if you meet the following criteria
you currently use HDAEnabler.kext or ALCinject.kext
you use AppleHDA.kext
you have (or can get) the three pieces of required information about your audio hardware and the modified AppleHDA.kext it needs
You can do it in a device-property string or in DSDT, the DSDT method is by far better, here's the PinConfigurations details for the BadAxe1 which uses the STAC9221D A2 (what I cam currently working on) so I can finish off my DSDT work and release the DSDT's or at least the relevant sections.

BadAxe1:
CODE
| | +-o HDEF@1B <class IOPCIDevice, registered, matched, active, busy 0, retain 8>
| | | | {
| | | | "IOPCIResourced" = Yes
| | | | "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
| | | | "IOName" = "pci8086,27d8"
| | | | "subsystem-id" = <17040000>
| | | | "IODeviceMemory" = (({"address"=18446744073225109504,"length"=16384}) )
| | | | "class-code" = <00030400>
| | | | "revision-id" = <01000000>
| | | | "assigned-addresses" = <10d8008200000000000020e30000000000400000>
| | | | "built-in" = <00>
| | | | "acpi-device" = "IOACPIPlatformDevice is not serializable"
| | | | "name" = "pci8086,27d8"
| | | | "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/HDEF@1b0000"
| | | | "subsystem-vendor-id" = <86800000>
| | | | "reg" = <00d800000000000000000000000000000000000010d800020 000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,417","pci8086,27d8","pciclass,040300" >
| | | | "PinConfigurations" = <104021021010010120308101104001012190a101116001013 0214501>
| | | | "layout-id" = 2
| | | | "IOPCIExpressLinkCapabilities" = 0
| | | | "IOPowerManagement" = {"ChildrenPowerState"=2,"CurrentPowerState"=2}
| | | | "IOInterruptSpecifiers" = (<1600000007000000>,<0400000000000100>)
| | | | "device-id" = <d8270000>
| | | | "vendor-id" = <86800000>
| | | | "device_type" = <"STAC9221A2">
| | | | "codec-id" = 2206496387
| | | | "IOPCIExpressLinkStatus" = 0
| | | | }

BadAxe2:
CODE
| | +-o HDEF@1B <class IOPCIDevice, registered, matched, active, busy 0, retain 8>
| | | | {
| | | | "IOPCIResourced" = Yes
| | | | "IOInterruptControllers" = ("io-apic-0","IOPCIMessagedInterruptController")
| | | | "IOName" = "pci8086,27d8"
| | | | "layout-id" = <04000000>
| | | | "subsystem-id" = <19040000>
| | | | "IOPCIExpressLinkCapabilities" = 0
| | | | "IODeviceMemory" = (({"address"=18446744073226158080,"length"=16384}) )
| | | | "class-code" = <00030400>
| | | | "IOPowerManagement" = {"ChildrenPowerState"=2,"CurrentPowerState"=2}
| | | | "revision-id" = <01000000>
| | | | "IOInterruptSpecifiers" = (<1600000007000000>,<0200000000000100>)
| | | | "assigned-addresses" = <10d8008200000000000030e30000000000400000>
| | | | "built-in" = <00>
| | | | "acpi-device" = "IOACPIPlatformDevice is not serializable"
| | | | "device-id" = <d8270000>
| | | | "vendor-id" = <86800000>
| | | | "acpi-path" = "IOACPIPlane:/_SB/PCI0@0/HDEF@1b0000"
| | | | "subsystem-vendor-id" = <86800000>
| | | | "name" = "pci8086,27d8"
| | | | "IOPCIExpressLinkStatus" = 0
| | | | "reg" = <00d800000000000000000000000000000000000010d800020 000000000000000000000000040
000>
| | | | "compatible" = <"pci8086,419","pci8086,27d8","pciclass,040300" >
| | | | "PinConfigurations" = <1f4021014090a1022e308101104011012090a101121011011 170110150214501>
| | | | "codec-id" = 2206496289
| | | | }


You don't believe audio can work without HDAEnabler.kext or ALCinject.kext, do it as a device-property string or better, do it in DSDT.
Reply With Quote