Jump to content

AppleALC — dynamic AppleHDA patching


vit9696
5,390 posts in this topic

Recommended Posts

No input as in it appears in syspref > sound but nothing works or ? And does your headphone jack work ?

No inputs or outputs listed in system preferences other than internal speakers as an output.

Link to comment
Share on other sites

hi guys

 

I need help.. I've fixed all inputs on my M800 (headphone, speaker and line out), but I've issue to get the two Ext Mic front/read (and Line In) recognized. I've the path map and the verbs (manually and using verbit)

any hints?

 

Verbs:

 

<01471c20 01471d40 01471e01 01471f01

01571c60 01571d00 01571e13 01571f90
01871c40 01871d90 01871ea1 01871f01
01971c50 01971d90 01971ea1 01971f01
01a71c70 01a71d30 01a71e81 01a71f01
01b71c30 01b71d40 01b71e21 01b71f01
01e71c30 01e71d61 01e71e4b 01e71f01>
 
path map for mic:
 
Rear Mic 0x18->0x23->0x08, Decimal 25->35->8
Front Mic 0x19->0x22->0x9, Decimal 24->34->9
 
Using this information, I miss the device in the input tab, there is also a screenshot of my system information

layout12.xml

Platforms12.xml

post-1422504-0-00734300-1493890426_thumb.png

Link to comment
Share on other sites

@vandroiy2012 

Please add

ALC235 for Lenovo Ideapad 700 and may more Lenovo notebooks.

Line out/Speaker/Internal Mic works

Layout :1

if you want  change layout id, just do it.

 

I can't change layout-id without testing. Change it yourself, test it and provide updated resources. You should use layouts from 11 to 99. Layouts from 1 to 10 reserved for Toleda/Mirone resources. Thanks

Link to comment
Share on other sites

How does AppleALC modify Platforms.xml in AppleHDA?

 

If I want to modify the info.plist inside Pinconfigs.kext to try new verbs, can I just do it in PlistEditorPro and save, or do I have to "build" the kext again?

 

Btw, these are different verbs for my codec. They are different. 

 

Dronefriend (made by me from a guide I found)

 
01271C10 01271D01 01271EA0 01271F90
01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D10 01971E81 01971F04
02171C40 02171D10 02171E21 02171F04 02170C02
 
VUSUN123 (these are from the AppleALC you sent that gave correct info in IOREG and Sys Report and Pref, but no audio out)
 
01271C20 01271D00 01271EA0 01271F90
01471C50 01471D00 01471E17 01471F90 01470C02
01971C30 01971D10 01971E81 01971F00
02171C60 02171D10 02171E21 02171F00 
 
MIRONE (this is from the patched AppleHDA that gave glitchy sound, but had sound output)
 
01271C10 01271D01 01271EA0 01271F90
01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D30 01971E8B 01971F01
02171C40 02171D40 02171E2B 02171F01 02170C02

 

Actually, Mirone had provided a complete list that nulls the unused codecs.. 

 

01271C10 01271D01 01271EA0 01271F90

01371CF0 01371D00 01371E00 01371F40
01471C30 01471D01 01471E10 01471F90 01470C02
01871CF0 01871D00 01871E00 01871F40
01971C20 01971D30 01971E8B 01971F01
01A71CF0 01A71D00 01A71E00 01A71F40
01B71CF0 01B71D00 01B71E00 01B71F40
01D71CF0 01D71D00 01D71E00 01D71F40
01E71CF0 01E71D00 01E71E00 01E71F40
02171C40 02171D40 02171E2B 02171F01 02170C02
00172000 00172172 0017226B 00172310 
 
But the above is without those for easier comparing. Can this provide any clue to why his HDA worked but not the ALC?
Link to comment
Share on other sites

I've some updates - getting Line In "Internal Mic working"

 

with this verbs:

 

<01471c10 01471d40 01471e01 01471f01

01571c20 01571d00 01571e13 01571f90

01871c30 01871d90 01871ea1 01871f01 -- change port type to External REAR (while it's front)

01971c40 01971d90 01971ea1 01971f90 -- change port type to Internal

01a71c50 01a71d30 01a71e81 01a71f01

01b71c60 01b71d40 01b71e21 01b71f02

01e71c70 01e71d61 01e71e4b 01e71f01>

 

Then put in the Platform.xml (attached) the pathmaph 9-34-25 (instead of 9-34-25 that's the rear port) make front mic port to work.. while missing rear port

Now I think the problem is in the connection between verbs and Platform.

 

As External Input I've just 8-35-26 (that's linein) and As Internal Input 9-35-25 (front mic port).. how to add a third Input? It need to be put into array 0 (external input) as 1 child or in the array 1 (internal input) as 1 child?

 

Currently in the Pathmap i've

 

- 0 - with child 0 as Line In

- 1 - with child 0 as Front Mic

- 2 - with child 0,1,2 as HeadPhone, LineOut, Internal Speaker

- 3 - with child 0 as SPDIF

 

Thanks!

Platforms12.xml

Link to comment
Share on other sites

 

How does AppleALC modify Platforms.xml in AppleHDA?

 

If I want to modify the info.plist inside Pinconfigs.kext to try new verbs, can I just do it in PlistEditorPro and save, or do I have to "build" the kext again?

 

Btw, these are different verbs for my codec. They are different. 

 

Dronefriend (made by me from a guide I found)

 
01271C10 01271D01 01271EA0 01271F90
01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D10 01971E81 01971F04
02171C40 02171D10 02171E21 02171F04 02170C02
 
VUSUN123 (these are from the AppleALC you sent that gave correct info in IOREG and Sys Report and Pref, but no audio out)
 
01271C20 01271D00 01271EA0 01271F90
01471C50 01471D00 01471E17 01471F90 01470C02
01971C30 01971D10 01971E81 01971F00
02171C60 02171D10 02171E21 02171F00 
 
MIRONE (this is from the patched AppleHDA that gave glitchy sound, but had sound output)
 
01271C10 01271D01 01271EA0 01271F90
01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D30 01971E8B 01971F01
02171C40 02171D40 02171E2B 02171F01 02170C02

 

Actually, Mirone had provided a complete list that nulls the unused codecs.. 

 

01271C10 01271D01 01271EA0 01271F90

01371CF0 01371D00 01371E00 01371F40
01471C30 01471D01 01471E10 01471F90 01470C02
01871CF0 01871D00 01871E00 01871F40
01971C20 01971D30 01971E8B 01971F01
01A71CF0 01A71D00 01A71E00 01A71F40
01B71CF0 01B71D00 01B71E00 01B71F40
01D71CF0 01D71D00 01D71E00 01D71F40
01E71CF0 01E71D00 01E71E00 01E71F40
02171C40 02171D40 02171E2B 02171F01 02170C02
00172000 00172172 0017226B 00172310 
 
But the above is without those for easier comparing. Can this provide any clue to why his HDA worked but not the ALC?

 

try this:

01471C30 01471D01 01471E13 01471F99 01470C02

01971C20 01971D30 01971E81 01971F02

02171C40 02171D40 02171E21 02171F02 02170C02

Link to comment
Share on other sites

try this:

01471C30 01471D01 01471E13 01471F99 01470C02

01971C20 01971D30 01971E81 01971F02

02171C40 02171D40 02171E21 02171F02 02170C02

Thanks for the suggestions bro.. I have been sitting with this {censored} for hours and the only thing developed is a big headache.  I have a pretty clear overview over the problem now but is too smashed to write it down and explain it. 

 

Since I know now much more about patching, these are my thoughts.

 

Close to working solution: Patched AppleHDA using Mirones verbs and 6 clover patches. This provides audio out even though I don't think it should. Headphones are wired to Node 2 out in that Pathmaps, even though codec dump says they go to node 3. If I change this and deflate back the .xml to zlib, nothing works. 

 

The verbs differ from the ones I made using my codec dump and this guide: http://forum.osxlatitude.com/index.php?/topic/1967-applehda-binary-patching/but evidently they are better since AppleHDA driver loads with Mirones verbs and not mine. I know what the different codes in the verbs do, and I still dont understand, for example, why external should be marked 8B and 2B (Physical jack: Combined) and not 81 and 21 as in mine. Also, he has jack colors on external devices while I have them zeroed. And other locations (F01 vs F04) for external devices. In fact, we have identical verbs for the internal devices.

 

Conclusion: Since his verbs are identical to my verbs for internal speakers, changing verbs wont solve the glitchy sound, which is the only bad thing with his solution. 

 

The problem is not the clover patches, since all they do is rewire some loading in AppleHDA. 

 

This leaves Pathmap.xml and Layout.xml. When I change these, I break the .kext. I'm starting to think the only issue here are wrong volume levels set in layoutID. If the node IDs truly were wrong for headphones in Pathmap, I wouldn't get audio out at all from them, am I right.

 

 Any other suggestions? Starting to get insane here. How does AppleALC regulate Layout and Pathmap? Does it use vanilla AppleHDA? Takes LayoutID specified in DSDT, loads verbs from Pinconfigs from this layout and feeds AppleHDA with these verbs, using standard AppleHDA layout and pathmap.xml?

Link to comment
Share on other sites

@dronefriend,

 

It's unfortunate that Mirone

It is not here to help as many as it did in the past.

I do not know if I can help you, but maybe if you send me your codec_dump I may have some idea.

I appreciate that! But I have already done what need be done on that part (I think). I have correct verbs. Most  of it matches with vusun and Mirones work, so I seem to understand how it's done. 

 

What I don't know is how to build a kext. Anything I touch with my plisteditor and save directly inside a kext, and reinstall with Kext Utility to SLE, it does not load. Is this wrong procedure? Impossible to edit inside a built kext and save and reinstall?

 

I am using an app called zlib to modify pathmap and Layout.xml. Anyone familiar with it?

Link to comment
Share on other sites

I appreciate that! But I have already done what need be done on that part (I think). I have correct verbs. Most  of it matches with vusun and Mirones work, so I seem to understand how it's done. 

 

What I don't know is how to build a kext. Anything I touch with my plisteditor and save directly inside a kext, and reinstall with Kext Utility to SLE, it does not load. Is this wrong procedure? Impossible to edit inside a built kext and save and reinstall?

 

I am using an app called zlib to modify pathmap and Layout.xml. Anyone familiar with it?

 

Try this version of Mirone:ALC236_Mirone_Web.zip

Install Codec Commander also, After the installation

Run the following command in a terminal window:

sudo rm -f /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache && sudo touch /System/Library/Extensions && sudo kextcache -u / 

 

Link to comment
Share on other sites

How does AppleALC modify Platforms.xml in AppleHDA?

When you build AppleALC in Xcode, the zlib and plist files are converted into code to be included by the compiler. The auto generated file is called kern_resources.cpp. Other code in AppleALC uses the data in the arrays created by that source file to do the patching.

 

I recommended in post http://www.insanelymac.com/forum/topic/311293-applealc-—-dynamic-applehda-patching/page-41#entry2262793that the build process could be improved by removing the need for you to manually use zlib.

Link to comment
Share on other sites

@dronefriend if you want I can send you a copy of my working AppleALC source that include the patch for your laptop that I'm developing. You can also try to include the null pin config in my patched pin config for you and see if it has any effects. 

Link to comment
Share on other sites

 

Try this version of Mirone:attachicon.gifALC236_Mirone_Web.zip

Install Codec Commander also, After the installation

Run the following command in a terminal window:

sudo rm -f /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache && sudo touch /System/Library/Extensions && sudo kextcache -u / 

 

Thanks! What layoutID?

I always do sudo touch /System/Library/Extensions && sudo kextcache -u / after install. Sometimes I do sudo kextcache -i / after reboot aswell. Hoping one of them will do something.

 

When you build AppleALC in Xcode, the zlib and plist files are converted into code to be included by the compiler. The auto generated file is called kern_resources.cpp. Other code in AppleALC uses the data in the arrays created by that source file to do the patching.

 

I recommended in post http://www.insanelymac.com/forum/topic/311293-applealc-—-dynamic-applehda-patching/page-41#entry2262793that the build process could be improved by removing the need for you to manually use zlib.

 

Yeah that would actually be very handy. But I read your discussion about it...

 

@dronefriend if you want I can send you a copy of my working AppleALC source that include the patch for your laptop that I'm developing. You can also try to include the null pin config in my patched pin config for you and see if it has any effects. 

That would be great.  Nice of you to develop for my laptop! Thanks a lot!

 

These are my notes from my codec dump, if you havent done them yourself already:

Node 12: Pin default 0x90a60120 EAPD:       20 01 a6 90     10 01 a0 90
Node 14: Pin default 0x90170110 EAPD: 0x2   10 01 17 90     20 01 17 90
Node 19 Pin Default 0x04a11030 EAPD:        30 10 a1 04     30 10 81 04
Node 21 Pin Default 0x0421101f EAPD 0x2     1f 10 21 04     40 10 21 04

Above: Info, Original verbs, fixed verbs according to guide. And final product, as posted in earlier post:

 

01271C10 01271D01 01271EA0 01271F90

01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D10 01971E81 01971F04
02171C40 02171D10 02171E21 02171F04 02170C02

 

Output PathMap calc:

 
Node 14 & 21
 
14, Decimal 20
21, decimal 33
 
0x14-> 0x02 , decimal 20->2
0x21-> 0x03, decimal 33->3
 
Verbs including nulling unused codec nodes (credit MIrone]
 
******
01371CF0 01371D00 01371E00 01371F40
******
01871CF0 01871D00 01871E00 01871F40
******
01A71CF0 01A71D00 01A71E00 01A71F40
01B71CF0 01B71D00 01B71E00 01B71F40
01D71CF0 01D71D00 01D71E00 01D71F40
01E71CF0 01E71D00 01E71E00 01E71F40
******
00172000 00172172 0017226B 00172310 
ANother thing: With the "working" patched AppleHDA, I have  to set AFGLowPowerState to TRUE and ResetHDA to TRUE in Clover. Otherwise, won't work.
 
Hope some of this is helpful. Thanks!
Link to comment
Share on other sites

3

This one works too. I do not need Clover patches for AppleHDA to enable it.

 

The sound is OK, but there is still distortion to it. Like I was playing from vinyl. And sound disappears sometimes, then comes back after a few seconds. Again, it is the same whether I'm playing from speakers or headphones.

 

Another downside with this vs the old AppleHDA I had: the first one had Line In mic, this one only internal mic. But thats minor.

 

Thanks!

Link to comment
Share on other sites

I tried switching to my own verbs. I then repaired permissions with Kext Utilit, I think. It was installed and loaded, and they work. Still same problem. I checked Platforms.zlib, it was fine. Nodes were wired as they should.

 

Layout.xml was good too. Except for SignalProcessing dictionary/array. This might be what cause the problem, it's the only thing left I can think of. But since I cannot build kexts I can't try removing it.

 

If anyone is willing, please rebuild this kext with removed SignalProcessing elements in Layout3.xml for IntSpeaker. The verbs are fine and Platforms.xml too. 

 

Thanks a lot in that case. Please do not try anything else, trying to narrow down what is the culprit..

 

AppleHDA.kext.zip

Link to comment
Share on other sites

Sorry for flooding the thread like this.

 

My problem has something to do with the microphone. The audio out issue is completely solved by going to SysPref->Audio, Audio In. Enabling the mic in other ways such as QT Player -> Record audio works well. But only as long as the mic is enabled. Closing the window brings the distortion back. The mic regulates audio out on both speakers and headphones.

 

Does anyone know what might be the cause of this?

Link to comment
Share on other sites

Sorry for flooding the thread like this.

 

My problem has something to do with the microphone. The audio out issue is completely solved by going to SysPref->Audio, Audio In. Enabling the mic in other ways such as QT Player -> Record audio works well. But only as long as the mic is enabled. Closing the window brings the distortion back. The mic regulates audio out on both speakers and headphones.

 

Does anyone know what might be the cause of this?

Maybe remove InternalMic/LineIn from the XML and try again

Link to comment
Share on other sites

Maybe remove InternalMic/LineIn from the XML and try again

Wouldnt it be weird if that helped? Evidently the audio fixes itself  when the mic is enabled. Very confused about this. I tried nagging down if there's a node responsible.. found 0x1b that was both Amp In and Out, and if it somehow had to do with Audio  Out even though my setup is connected directly to their respective Audio Out nodes... But enabling this node with several different verbs did not help.

Link to comment
Share on other sites

HIi, I'm using ALC with my hackintosh sierra and CX20751/2. The output works normally, but the input is detected without any sound.

PinConfigurations:

1040210120001790309081013010a1034000a090e0005628

 

Codecs Found: 1

HDA:

0 CodecAddress:0x0

VendorID: 0x14f1510f

RevisionID: 0x100100

CodecID: 351359247

Revision(dec):=1048832

Id=0x510f

Id(dec)=20751

Vendor=0x14f1

Vendor(dec)=5361

Link to comment
Share on other sites

Wouldnt it be weird if that helped? Evidently the audio fixes itself  when the mic is enabled. Very confused about this. I tried nagging down if there's a node responsible.. found 0x1b that was both Amp In and Out, and if it somehow had to do with Audio  Out even though my setup is connected directly to their respective Audio Out nodes... But enabling this node with several different verbs did not help.

There is a known bug to do with input audio lagging the system up. This is true even on real Macs.

It's documented in a lot of online gaming forums, CS_GO is a prime example. If you don't have system preferences open on the audio input page with the active device selected, whenever you try to use the mic the whole system/game lags for the duration of the mic input. When system preferences is open this is completely resolved.

 

Not sure if it will be at all related but it's something to consider.

Link to comment
Share on other sites

There is a known bug to do with input audio lagging the system up. This is true even on real Macs.

It's documented in a lot of online gaming forums, CS_GO is a prime example. If you don't have system preferences open on the audio input page with the active device selected, whenever you try to use the mic the whole system/game lags for the duration of the mic input. When system preferences is open this is completely resolved.

 

Not sure if it will be at all related but it's something to consider.

Well, it could be related. 

 

In my case I'm not trying to use the mic that I know of. The issue is always there anyway. But maybe, because of incorrect verbs or other bad config, the mic IS enabled all the time. 

 

There is an easy way to test this. If it is this bug causing it, I should disable the internal mic altogether. And then there is no way there could be "input" that causes this bug.

 

I need a bulletproof method to disable the internal mic. Is deleting the Internal mic arrays in Layout and Pathmap enough? Or should I null the mic nodes in the codec verbs in AppleConfigHardwareDriver (spelling?) as well?

 

 

Edit: I tried it. Deleted Mic paths in Layout.xml. No longer have Input Devices in System Report. No Input in Syspref Audio Pane.

 

The problem is still here :( But now, entering Sys Pref -> Audio In will not solve it anymore. So at least this is proof that it was the mic that somehow made the problem go away.

Link to comment
Share on other sites

Well, it could be related. 

 

In my case I'm not trying to use the mic that I know of. The issue is always there anyway. But maybe, because of incorrect verbs or other bad config, the mic IS enabled all the time. 

 

There is an easy way to test this. If it is this bug causing it, I should disable the internal mic altogether. And then there is no way there could be "input" that causes this bug.

 

I need a bulletproof method to disable the internal mic. Is deleting the Internal mic arrays in Layout and Pathmap enough? Or should I null the mic nodes in the codec verbs in AppleConfigHardwareDriver (spelling?) as well?

 

 

Edit: I tried it. Deleted Mic paths in Layout.xml. No longer have Input Devices in System Report. No Input in Syspref Audio Pane.

 

The problem is still here :( But now, entering Sys Pref -> Audio In will not solve it anymore. So at least this is proof that it was the mic that somehow made the problem go away.

SOLVED

 

The issue is solved. I'd like to thank everyone who was involved in this bug and tried to help me solve it.

 

After over 40 hours pure work of trial and error, kext patching and reading about AppleHDA, Intel HDA specifications, hda-verb commands, documentation and what not, it turned out that I had to switch from 24 bit output to 16 bit output in Audio/MIDI-settings under /Applications/. It was not related to my kext at all this entire time.

 

The weird part is that the codec is able to output 24bit fine when I have the mic enabled. But the reason for that and how to solve that... lol! I could not care less.

 

EDIT:

This means my codec is ready for implementation to AppleALC. The one already available for ALC236 with layout 11 did not work at all.

 

Codec: Realtek Generic

Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0236 283902518
Subsystem Id: 0x17aa389a
Revision Id: 0x100002
 

 

01271C10 01271D01 01271EA0 01271F90

01471C30 01471D01 01471E10 01471F90 01470C02
01971C20 01971D10 01971E81 01971F04
02171C40 02171D10 02171E21 02171F04 02170C02
 
Output:
0x14-> 0x02 , decimal 20->2
0x21-> 0x03, decimal 33->3
 
Input pathmap calc:
0x07-0x24 (Selector) - 0x12 (Int Mic)
0x08-0x23 (Mixer) - 0x18, 0x19 (Ext Mic), 0x1a 0x1b 0x1d 0x12 (Int Mic)
0x09-0x22 (Mixer) - 0x18, 0x19, (Ext Mic) 0x1a 0x1b 0x1d
 
7-36-18 / 18 36 7
8-35-18 / 18 35 8
9-34-25 / 25 34 9
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...