Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Help with getting COEF values for 10ec_0256 #4

Open
Andrw0830 opened this issue Feb 17, 2019 · 8 comments
Open

Help with getting COEF values for 10ec_0256 #4

Andrw0830 opened this issue Feb 17, 2019 · 8 comments

Comments

@Andrw0830
Copy link

Andrw0830 commented Feb 17, 2019

Hello @maz-1 thanks again for your work on this Combojack and helping getting it to work for my Realtek ALC256 system! I was wondering if you could help. I was trying to see if we could get our codec to work without having to use Combojack + Verbstub. I've been talking with some developers that help submit changes for AppleALC and they mentioned if I could provide the exact COEF that our codec uses for the wired headset port to switch the headset mic to LineIn to make it work.

I looked through your hda_verb.m and found the following 3 sections regarding COEF for my particular 0x19 NID (I cut some lines to only show the 10ec0256 and to be better readable here)

"fprintf(stderr, "Jack Status: headset plugged in. Checking type...\n");

switch (codecID)
{
    case 0x10ec0256:
        VerbCommand(HDA_VERB(0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24)); // 0x24 corresponds to IN (0x20) + VREF 80 (0x04)
        WRITE_COEF(0x45, 0xd089);
        WRITE_COEF(0x49, 0x0149);
        usleep(350000);
        // Read register 0x46
        SetCoefIndex.verb = HDA_VERB(nid, AC_VERB_SET_COEF_INDEX, 0x46); 
        SetCoefIndex.res = VerbCommand(SetCoefIndex.verb); 
        GetProcCoef.verb = HDA_VERB(nid, AC_VERB_GET_PROC_COEF, 0x46);
        GetProcCoef.res = VerbCommand(GetProcCoef.verb);
        break;

fprintf(stderr, "Jack Status: headset (CTIA/iPhone) plugged in.\n");

//alc_headset_mode_ctia
switch (codecID)
{
    case 0x10ec0256:
        WRITE_COEF(0x45, 0xd489); //Set to CTIA type 
        WRITE_COEF(0x1b, 0x0c6b);
        WRITE_COEFEX(0x57, 0x03, 0x8ea6);
        break;

fprintf(stderr, "Jack Status: headset (OMTP/Nokia) plugged in.\n");

//alc256
switch (codecID)
{
    case 0x10ec0256:
        WRITE_COEF(0x45, 0xe489);
        WRITE_COEF(0x1b, 0x0c6b);
        WRITE_COEFEX(0x57, 0x03, 0x8ea6);
        break;"

I was wondering if you could help me provide me exactly what coefficient that is provided to the codec and if possible the terminal commands (ex hda-verb) just so I could help provide that for them? I just don't know where else to go to grab this information.

I am just trying to make the whole process easier as I've noticed a lot of people use CodecCommander with AppleALC and want to make sure if this process is ever abandoned or not updated, that we will have another working solution for headset mic for our codecs.

Please let me know if you need anything and thanks again!

@maz-1
Copy link
Member

maz-1 commented Feb 21, 2019

CTIA and OMTP are two variants of 3.5mm wired headset connector. They have different pin definitions.
I am not sure if connector type can be detected and switched without a daemon.

@Andrw0830
Copy link
Author

CTIA and OMTP are two variants of 3.5mm wired headset connector. They have different pin definitions.
I am not sure if connector type can be detected and switched without a daemon.

Oh. Was wondering how the daemon is able to detect which type of headset it is? When you plug into the 3.5mm Combojack and you get the prompt on what device it is, I didn't know when you hit Headset, that is does another check if it's CTIA or OMTP.

Was I on the right track that those are the COEF values that is used when you plug a wired headset in the Combojack to get LineIn to show and activate? It will be interesting to see if it will work without the daemon, but I guess we will see. Thanks again for your response.

@maz-1
Copy link
Member

maz-1 commented Feb 21, 2019

Oh. Was wondering how the daemon is able to detect which type of headset it is? When you plug into the 3.5mm Combojack and you get the prompt on what device it is, I didn't know when you hit Headset, that is does another check if it's CTIA or OMTP.

Was I on the right track that those are the COEF values that is used when you plug a wired headset in the Combojack to get LineIn to show and activate? It will be interesting to see if it will work without the daemon, but I guess we will see. Thanks again for your response.

You can build debug version of VerbStub.kext if you want to know what verb command is invoked when plug in headset.

@Andrw0830
Copy link
Author

Oh. Was wondering how the daemon is able to detect which type of headset it is? When you plug into the 3.5mm Combojack and you get the prompt on what device it is, I didn't know when you hit Headset, that is does another check if it's CTIA or OMTP.
Was I on the right track that those are the COEF values that is used when you plug a wired headset in the Combojack to get LineIn to show and activate? It will be interesting to see if it will work without the daemon, but I guess we will see. Thanks again for your response.

You can build debug version of VerbStub.kext if you want to know what verb command is invoked when plug in headset.

OK thanks I got it after installing Combojack too and using the Console.app to capture the log. What is the difference between SendCommand: (w) and SendCommand (r)? Is one writing the command while the other reports the result? I just want to know if you need both sets of commands.

@maz-1
Copy link
Member

maz-1 commented Feb 22, 2019

WRITE_COEFEX and WRITE_COEF does read existing coef values and apply masks on them.

@Andrw0830
Copy link
Author

Andrw0830 commented Feb 23, 2019

Thanks again for explaining. The info you provided was enough. Wanted to ask another thing which is a slightly different issue.

When I do use your Verbstub.kext and Combojack, I noticed after the codec goes into idle mode, you can hear a small pop through the headset. Is there a way to prevent this pop? It seems to happen within 30 seconds after I stop playing any sound. I heard about certain antipop solutions, but wanted to see if there is anything I can do that's more streamlined. Please let me know if you need anything else.

@tunglamvghy
Copy link

tunglamvghy commented Apr 19, 2020

Hi @Andrw0830 @maz-1
My laptop sound is ALC256 too. I was facing up with the problem that when I reboot to MacOS from Windows, the sound of speaker is gone. I've search on some forums and that problem caused by COEF. And add some Custom command for CodecCommander can fix it, but I dont know the custom command for ALC256 ( some forums have only for alc1150) :((((
Can you tell me how to get these command for alc256?
SET_COEF_INDEX
SET_PROC_COEF

@Andrw0830
Copy link
Author

Hi @Andrw0830 @maz-1
My laptop sound is ALC256 too. I was facing up with the problem that when I reboot to MacOS from Windows, the sound of speaker is gone. I've search on some forums and that problem caused by COEF. And add some Custom command for CodecCommander can fix it, but I dont know the custom command for ALC256 ( some forums have only for alc1150) :((((
Can you tell me how to get these command for alc256?
SET_COEF_INDEX
SET_PROC_COEF

Hey man, I unfortunately don't know as not very good with programming and code so wanted to get @maz-1 feedback too. I have since moved my CodecCommander to OpenCore and have a SSDT-ALC256.aml that has been working pretty good. I've also looked at my verbs file that was generated from Linux and noticed the 0x21 device (Headphones) didn't have the following value '0xc0' added so I went into the hda-verb.m file for ComboJack and added this line to the ALC255_COMMON section "VerbCommand(HDA_VERB(0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0));" Adding that seemed to produce better audio quality.

I am not on my Mac right now, but can certainly provide the files if you want them? I am using layout-id 16 as my Dell is a 2.1 laptop. Not sure if your CodecCommander is in the EFI folder or in /Library/Extensions, but me moving mine to EFI, seemed to fix issues like audio from sleep.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants