Jump to content

AppleALC — dynamic AppleHDA patching


vit9696
5,390 posts in this topic

Recommended Posts

There are many things I'm doubting about the possibility of this project:

1. If there are codecs which isn't supported and let's say I manually add support for that codec, will the kext automatically "patching things" accordingly to the codec I added ?

2. Many codecs have different pin configuration, especially MuteGPIO key in the layout ( which is very crucial to get the input/output to work ). I saw that you crammed every codecs Mirone support in one single layout file, will it ever work out that way ?

3. There are codecs which was patched by me in your project. I see that you added codec support from Mirone, and Mirone used some of my work, can you please add a few credits in the plist ? You can double check on things by checking Mirone's plist file, those doesn't have Mirone credits are my work.

4. There are many codecs that aren't presented in your project, if possible how can I submit it ?

Link to comment
Share on other sites

3. There are codecs which was patched by me in your project. I see that you added codec support from Mirone, and Mirone used some of my work, can you please add a few credits in the plist ? You can double check on things by checking Mirone's plist file, those doesn't have Mirone credits are my work.

 

Please let me know which of your works I am using, I want to record for posterity I didn't add any codec to the project not even mine, so therefore I'm not taking credit for other people's hard work. I can say that vandroiy2012, obtained all my patches on my github repository.

  • Like 2
Link to comment
Share on other sites

Please let me know which of your works I am using, I want to record for posterity I didn't add any codec to the project not even mine, so therefore I'm not taking credit for other people's hard work. I can say that vandroiy2012, obtained all my patches on my github repository.

Your repo is good but not perfect. There are many codecs which need update badly ( e.g Conexant CX20590 from your repo doesn't have working Internal Mic on Dell Vostro 3x60, but mine does - correct a few things from your work ). You can find all my patches inside Hackintosh Vietnam Tool that list with my name, then do a pin config data check with your work ( mine usually have 52 or 64 bytes )

Link to comment
Share on other sites

Your repo is good but not perfect. There are many codecs which need update badly ( e.g Conexant CX20590 from your repo doesn't have working Internal Mic on Dell Vostro 3x60, but mine does - correct a few things from your work ). You can find all my patches inside Hackintosh Vietnam Tool that list with my name, then do a pin config data check with your work ( mine usually have 52 or 64 bytes )

 

You can share all your resources for missing codecs and i will add them in project. With credits of course :)  

Link to comment
Share on other sites

Your repo is good but not perfect. There are many codecs which need update badly ( e.g Conexant CX20590 from your repo doesn't have working Internal Mic on Dell Vostro 3x60, but mine does - correct a few things from your work ). You can find all my patches inside Hackintosh Vietnam Tool that list with my name, then do a pin config data check with your work ( mine usually have 52 or 64 bytes )

If I remember correctly, I helped you with cx20590 in the past, and of course there are differences between revisions and manufacturers even using the same codec, can have different PathMaps and Pinconfigs, an example is ALC269. This means that your cx20590 is not equal to that fix which is based on a lenovo laptop if my memory does not fails, and by the way works Full to a lot of people.
  • Like 2
Link to comment
Share on other sites

You can share all your resources for missing codecs and i will add them in project. With credits of course :)  

Honestly I don't know where to start now, since many audio codecs have multiple variants ( for example Realtek ALC 269 has like 13 variants for many laptops that I have patched for ) while some codecs are universally compatible with every rigs I have known ( for example Realtek ALC 255 on Lenovo B470 / Dell Vostro 5548,... work flawlessly with my patch ). Filtering between Mirone's patches and mine can be troublesome, of course to reduce duplicates or defects

 

If I remember correctly, I helped you with cx20590 in the past, and of course there are differences between revisions and manufacturers even using the same codec, can have different PathMaps and Pinconfigs, an example is ALC269. This means that your cx20590 is not equal to that fix which is based on a lenovo laptop if my memory does not fails, and by the way works Full to a lot of people.

 

Oh that, I'm truly sorry for my quick judgement. But that shows that audio codecs is not universally applied to every manufacturers, and an universal solution like this project can be tough to crack. Also off-topic a bit, have you seen 10.11.4 update broke Internal Mic on many codecs ?

Link to comment
Share on other sites

By the way - "credits" in info.plist are not actually CREDITS (to somebody). It is human readable data for maintaining the database in future.


But that shows that audio codecs is not universally applied to every manufacturers, and an universal solution like this project can be tough to crack. Also off-topic a bit, have you seen 10.11.4 update broke Internal Mic on many codecs ?

 

The project uses resources not only from Mirone or Toleda. There are many custom versions from different users from applelife.ru. And "credits" explain for what laptop certain workaround for. Layouts from 11 to 99 is for custom use. Layouts 1-10 reserved for Mirone/Toleda patches.


Honestly I don't know where to start now, since many audio codecs have multiple variants ( for example Realtek ALC 269 has like 13 variants for many laptops that I have patched for )

 

Now we have 12 versions for ALC269. Layouts 1-8 - Mirone versions. Layouts 20, 27, 28 and 29 use custom versions for different laptops. See Comment lines in info.plist with Laptop model and layout-id for it.

  • Like 2
Link to comment
Share on other sites

 

are you saying I don't need to inject audio ID at all via DDST?

 

My clean DSDT doesn't contain much info. 

 

 }
            }
            Device (HDEF)
            {
                Name (_ADR, 0x001B0000)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (Package (0x02)
                    {
                        0x0D, 
                        0x05
                    })
                }
            }
            Name (BUFA, ResourceTemplate ()
            {

 

Here is audio id and HDEF DSDT inject MaciASL patch,credit Clover.

# Insert device HDEF into device with _HID PNP0A08 (PCI0)
#
into device name_adr 0x001B0000 parent_hid PNP0A08 remove_entry;
into device name_hid PNP0A08 insert
begin
Device (HDEF)\n
{\n
Name (_ADR, 0x001B0000)\n
Method (_PRW, 0, NotSerialized)\n
{\n
Return (Package (0x02)\n
{\n
0x0D,\n
0x05\n
})\n
}\n
\n
Method (_DSM, 4, NotSerialized)\n
{\n
Store (Package (0x06)\n
{\n
"layout-id", \n
Buffer (0x04)\n
{\n
0x01, 0x00, 0x00, 0x00\n
}, \n
\n
"MaximumBootBeepVolume",\n
Buffer (One)\n
{\n
0x01\n
},\n
\n
"PinConfigurations", \n
Buffer (Zero) {}\n
}, Local0)\n
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
Return (Local0)\n
}\n
}
end

  • Like 1
Link to comment
Share on other sites

About Sound Assertion!

I tried with different versions of AppleHDA:
10.8.4 NO ERRORS
10.8.5 kernel[0]: Sound assertion in AppleHDACodecGeneric at line 532
10.9.5 kernel[0]: Sound assertion in AppleHDACodecGeneric at line 518
maybe, someone with good dissassembler knowledge can find the difference between 10.8.4 and 10.8.5 binaries and make some kind of patch for this?

what is the new function called in the line 32?

Архив.zip

Link to comment
Share on other sites

1-10 reserved for Mirone/Toleda patches.

Enoch bootloader can detect the codec-id, code from Zenith432..so can be ported to Clover too (if not lready in there).

Something is telling me that naming layout and Platform like layout287143648.xml.zlib for example (also the Platform) ... can make a perfect autodetection.

Or, the subsystem id can be used to perfectly match the motherboard with no errors. This assume that a database should be created..

Link to comment
Share on other sites

Enoch bootloader can detect the codec-id, code from Zenith432..so can be ported to Clover too (if not lready in there).

Something is telling me that naming layout and Platform like layout287143648.xml.zlib for example (also the Platform) ... can make a perfect autodetection.

Or, the subsystem id can be used to perfectly match the motherboard with no errors. This assume that a database should be created..

 

we cannot use ANY layout, for example 268, 885, 888, 1050, 1988b,  only those that provided by Apple 1 2 3 12 28 70 99 etc

layout287143648.xml.zlib will not work too

so it is a good looking idea but it does not work at all, or there will be a lot of problems to make it work

 

Clover has Audio inject = Detect too

but it does not work

Link to comment
Share on other sites

Sound assertion in %s at line %d

After blind disassembling, i found %d already naked (0x44c = 1100), but not in my case "line 366" for example. Not sure it refer to the line on their plain source / something. From snippets below, AppleHDA currently looking some of our devices and its properties: HDEF & HDAU, DigitalAudioCapabilities = DisplayPort & HDMI, etc. With Clover (ACPI - DSDT - Fixes: NewWay_80000000 | AddHDMI_8000000) I can get rid from that assertions, and then you can look yours

 

 

 

Sound assertion in AppleHDADriver at line 1143
Sound assertion in AppleHDADriver at line 1100 ==> 0x44c
Sound assertion in AppleHDACodecGeneric at line 366
Sound assertion in AppleHDADriver at line 1601
Sound assertion in AppleHDADriver at line 2275
Sound assertion in AppleHDADriver at line 212
Sound assertion in AppleHDADriver at line 3685
Sound assertion in AppleHDADriver at line 1103

 

 

 

 

 

$ ioreg -lw0 | grep DigitalAudioCapabilities
| |   |     |   "DigitalAudioCapabilities" = {"DisplayPort"=1,"HDMI"=1}
| |   |       |   "DigitalAudioCapabilities" = {"DisplayPort"=1,"HDMI"=1}
| |   |         |   "DigitalAudioCapabilities" = {"DisplayPort"=1,"HDMI"=1}
| |   |           |   "DigitalAudioCapabilities" = {"DisplayPort"=1,"HDMI"=1}

 

 

 

 

 

int AppleHDACodecGeneric::constructPinConfigurationsProperty()() {

...

loc_c5ec:
    if (_strcmp((*(*r12 + 0x388))(r12, 0x0), "HDEF") == 0x0) goto loc_c692;

loc_c612:
    if ((_strcmp((*(*r12 + 0x388))(r12, 0x0), *AppleHDACodecGeneric::hdauString) == 0x0) || ((*(*r14 + 0x8d0))(r14, r12) == 0x40300)) goto loc_c64e;

loc_c770:
    r13 = OSDictionary::withCapacity(0x2);
    if (r13 != 0x0) goto loc_c4d6;

loc_c786:
    rdi = "Sound assertion in %s at line %d\n";
    goto loc_ca8b;

loc_ca8b:
    rax = _IOLog(rdi);
    return rax;

...

loc_c4ff:
    rax = *r13;
    (*(rax + 0x1d0))(r13, *AppleHDACodecGeneric::hdmiString, rbx);
    rax = *rbx;
    (*(rax + 0x28))(rbx);
    rdi = *(r14 + 0xa8);
    rbx = OSNumber::withNumber((*(*rdi + 0x1b8))(rdi) & 0xff, 0x8);
    if (rbx == 0x0) goto loc_c857;

loc_c548:
    rax = *r13;
    (*(rax + 0x1d0))(r13, *AppleHDACodecGeneric::displayPortString, rbx);
    rax = *rbx;
    (*(rax + 0x28))(rbx);
    if ((*(*r12 + 0x268))(r12, *AppleHDACodecGeneric::digitalAudioCapabilitiesString, r13) == 0x0) {
            _IOLog("Sound assertion in %s at line %d\n", "AppleHDACodecGeneric", 0x473);
    }
    rax = *r13;
    rax = (*(rax + 0x28))(r13);
    if ((r15 & 0x1) == 0x0) goto loc_c5d3;
    goto .l1;

loc_c857:
    rdi = "Sound assertion in %s at line %d\n";
    goto loc_c86a;

...

loc_c692:
    r13 = OSMetaClassBase::safeMetaCast((*(*r12 + 0x2b8))(r12, *AppleHDACodecGeneric::pinConfigurationsString), var_40);
    if ((r13 != 0x0) || (*(int32_t *)(r14 + 0xd4) != 0x0)) goto loc_c6ff;

...

loc_c708:
    rax = *r13;
    (*(rax + 0x20))(r13);
    if ((*(*r13 + 0x168))(r13, 0x285600e0, 0x4) == 0x0) {
            _IOLog("Sound assertion in %s at line %d\n", "AppleHDACodecGeneric", 0x44c); ==> 1100 ###
    }
    rax = *r12;
    (*(rax + 0x2a0))(r12, *AppleHDACodecGeneric::pinConfigurationsString);
    if ((*(*r12 + 0x268))(r12, *AppleHDACodecGeneric::pinConfigurationsString, r13) == 0x0) goto loc_ca78;


...

loc_ca78:
    rdi = "Sound assertion in %s at line %d\n";
    goto loc_ca8b;

 

 

 

Attached below some resource strings, so you can start make huge diffs table like this :lol:

                      | 10.8.4  | 10.8.5  | 10.9.5  |
                      +---------+---------+---------+
MuteGPIO              | x       | x       | x       |
sleepGPIO             | -       | x       | -       |
DfetGPIO              | -       | -       | x       |
EarlyAmpMuteDelay     | x       | x       | -       |

.
.
.
  • Like 3
Link to comment
Share on other sites

 

Sound assertion is not a problem
that prevents AppleHDA to work, Alex Auditore, already posted a way to get rid of them.

 

 

Mirone, replacing error messages by Zeroes or Spaces can't be considered as the right way to solve any problem

Yes it is not a problem that prevents to work, but I prefer software that works without any errors

and (maybe) it is possible to find more interesting and important things that way

 

 

Sound assertion in %s at line %d

 

After blind disassembling, i found %d already naked (0x44c = 1100),

 

Thanks for the explanation, I am not a programmer but I'll try to understand this

Yes the correct way is to add missing device to DSDT or something like this, I'll try and let You know

Link to comment
Share on other sites

Mirone, replacing error messages by Zeroes or Spaces can't be considered as the right way to solve any problem

Yes it is not a problem that prevents to work, but I prefer software that works without any errors

and (maybe) it is possible to find more interesting and important things that way

First you need to have in mind that you are dealing with a hackintosh and that being so things won't be totally 100% otherwise you better use a real Mac but wait, they also have Sound Assertion.
 
And if you think wrong consetar something by replacing zeros, use voodooHDA. How do you think that is patched the Binary of AppleHDA?
Link to comment
Share on other sites

 

First you need to have in mind that you are dealing with a hackintosh and that being so things won't be totally 100% otherwise you better use a real Mac but wait, they also have Sound Assertion.
 
And if you think wrong consetar something by replacing zeros, use voodooHDA. How do you think that is patched the Binary of AppleHDA?

 

 

More knowledge and understanding about any problem is better then less knowledge. Both at real Mac and Hackintosh.

It is possible that Real Mac can have some errors too, but there is no reason to repeat them in DIY Layouts and Pathmaps

Thanks. I can decide by myself what to use ...

 

"How do you think that is patched the Binary of AppleHDA?"

I think patch is needed to avoid the error not to hide it

Link to comment
Share on other sites

I had a couple of minutes yesterday, and gave it a glance. The issue happens due to driver being unable to wake up the codec.

Check AppleHDACodecGeneric::forceNodePowerState. I did not have time to explore it properly though.

  • Like 1
Link to comment
Share on other sites

I had a couple of minutes yesterday, and gave it a glance. The issue happens due to driver being unable to wake up the codec.

Check AppleHDACodecGeneric::forceNodePowerState. I did not have time to explore it properly though.

 

There is no need to do it in a hour or in a day ))

But I think it must be discovered

maybe something useful will be found in the areas of EAPD, Codec Commander or iMac's "post-sleep" sound delays?

Link to comment
Share on other sites

More knowledge and understanding about any problem is better then less knowledge. Both at real Mac and Hackintosh.

It is possible that Real Mac can have some errors too, but there is no reason to repeat them in DIY Layouts and Pathmaps

Thanks. I can decide by myself what to use ...

 

Of course you are a free man, so you can make choices
right and wrong and learn from both.

 

"How do you think that is patched the Binary of AppleHDA?"

I think patch is needed to avoid the error not to hide it

I want you to know,
that the zeros are not to avoid
an "ERROR" but a check.
Link to comment
Share on other sites

we cannot use ANY layout, for example 268, 885, 888, 1050, 1988b,  only those that provided by Apple 1 2 3 12 28 70 99 etc

layout287143648.xml.zlib will not work too

so it is a good looking idea but it does not work at all, or there will be a lot of problems to make it work

 

Clover has Audio inject = Detect too

but it does not work

Was a spot on. What I mean is that a mobo like mine have sub-ven:103c:1818. Each model with this mobo use the same codec id (287143648) with same node and same pinconfig. This happen for all other OEM vendors.. 

sub sys = specific and unique pathmap & pinconfig

The sub system id can be used to select the right xml.zlib files w/o user interaction, maybe the kext can receive a flag to do that overriding the default behavior. Just an idea.

My previous post was only to indicate that bootloaders can publish a lot of information somewhere in the IO if necessary, to facilitate this (also w/o waiting AppleHDA is loaded).

Also because if a patch work for one pc, is not meant that will work for all.  often is surprising someone have a partial working solution with patches created for someone else. You do not believe it is right?

  • Like 3
Link to comment
Share on other sites

×
×
  • Create New...