Has anybody gotten audio working in Linux on Aorus X570 Master?

Great work! Coef 0x07 is just a leftover from the default CLEVO quirk which is unnecessary for our gigabyte boards. My latest kernel patch does not apply the 0x07 Coef as we do not use the CLEVO quirk anymore but use a new specific quirk for our x570 boards. You can find all the details here.
With that information I recon I should be able to quickly prepare a kernel patch (it is trivial) for you to test. Are you interested in compiling a kernel to test the patch?

UPDATE: This is the linux-patch for the X570s Master (current master branch)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 668274e52674..d27435bc0947 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2552,6 +2552,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570s Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),

UPDATE 2: Garrr, I just realized that the X570s Master does not currently have the CLEVO workaround active. As a result, Coef 0x07 seems to be set wrongly by the board’s firmware. So, lets also fix this Coef in the kernel - the working value is the same we use on X570(non-S) so it should be safe to use the exact same quirk for all of our currently supported boards. Here is the new patch which should do the trick:

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 668274e52674..3d59bd110f9f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2125,6 +2125,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec,
 {
        static const hda_nid_t conn1[] = { 0x0c };
        static const struct coef_fw gb_x570_coefs[] = {
+               WRITE_COEF(0x07, 0x03c0),
                WRITE_COEF(0x1a, 0x01c1),
                WRITE_COEF(0x1b, 0x0202),
                WRITE_COEF(0x43, 0x3005),
@@ -2552,6 +2553,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570s Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1 Like

I would be willing to compile the kernel to give it a try, but this script fixes only part of the problem. Also can confirm that without modifying 0x07, the sound won’t work on x570s, so it’s needed.
On x570s when you cold boot or wake up from sleep in linux, the sound volume is very low. What fixes that issue is running the command alsactl init. I wonder if we can somehow fix this via hda-verb as well?
I would attach the logs here but I’m afraid new users can’t uplaod them and links are forbidden in the posts.

I just updated my post with a new version of the patch as I realized I was wrong with my initial assumption. The second patch should do the trick concerning the reboot-from-windows problems.

Concerning the low-audio problem. You could send me an alsa-info dump with enabled Coef-dumping and send it to me via email.

# Enable Coef dumping
echo 1 > /sys/module/snd_hda_codec/parameters/dump_coef
# Dump alsa information (needs alsa-utils package)
alsa-info

Run this twice, once before alsactl init and once after. We can compare the two dumps after that and find the conflicting Coef - if it is a Coef problem to begin with.

1 Like

Sent you via email. And none of the coeff seem to change before vs after, a couple of other things however do. Also your update #2 looks good to me. I would be willing to try it on kernel 5.15, my nvidia card will not be happy on anything newer I’m afraid

Alright, thank you. As it turns out this problem has nothing to do with Coefs, they are the exact same. I kinda expected that. The actual problem is that the “Headphone” volume is low. Yes, Headphone. The problem is, that the connectors are mixed up - as it was with the original X570 boards. The CLEVO patch is the component that initially fixed the connector configuration.

   snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
   snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);

However, we do not rely on the CELVO workaround anymore but introduced our own which also fixes the connectors and corrects the Coeffs.

I will rebase the patch for the 5.15 branch and post it here shorty.

UPDATE: This is the rebased patch for 5.15.16 (basically the same thing with fixed offsets):

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fa80a79e9..ea009be72 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2120,6 +2120,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec,
 {
        static const hda_nid_t conn1[] = { 0x0c };
        static const struct coef_fw gb_x570_coefs[] = {
+               WRITE_COEF(0x07, 0x03c0),
                WRITE_COEF(0x1a, 0x01c1),
                WRITE_COEF(0x1b, 0x0202),
                WRITE_COEF(0x43, 0x3005),
@@ -2547,6 +2548,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570s Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
1 Like

Thanks, I will try to figure out how to download and compile the kernel in the evening when I get back home from work. The connection problem is already solved in this kernel or do we need to patch something else as well?

1 Like

The patch activates the ALC1220_FIXUP_GB_X570 quirk for the X570S Master which a) fixes the connection list and b) corrects the Coeffs to know-good values.

So yes, this one patch SHOULD be enough to make the audio always work correctly.

I’ve compiled the kernel and it seems the patch is not working. Are you sure the motherboard id is correct, how can I verify?

I took the subsystem ID from your alsa-info dump. I just rechecked and it should be correct. See:

0e:00.4 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller [1022:1487]
	Subsystem: Gigabyte Technology Co., Ltd Starship/Matisse HD Audio Controller [1458:a0d5]

Could you please try the following patch and see, if the resulting kernel outputs “alc1220_fixup_gb_x570”? (run dmesg to get the kernel output)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fa80a79e9..a1ce2654b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2120,12 +2120,15 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec,
 {
        static const hda_nid_t conn1[] = { 0x0c };
        static const struct coef_fw gb_x570_coefs[] = {
+               WRITE_COEF(0x07, 0x03c0),
                WRITE_COEF(0x1a, 0x01c1),
                WRITE_COEF(0x1b, 0x0202),
                WRITE_COEF(0x43, 0x3005),
                {}
        };
 
+       printk("alc1220_fixup_gb_x570 %i", action);
+
        switch (action) {
        case HDA_FIXUP_ACT_PRE_PROBE:
                snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
@@ -2547,6 +2550,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570s Aorus Master", ALC1220_FIXUP_GB_X570),
        SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
@@ -2621,6 +2625,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = {
        {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
        {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
        {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
+       {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
        {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
        {}
 };

The text should come up several times - but AT LEAST once. If it does not then the quirk is clearly not being applied.

I recompiled the kernel with the log and unfortunately I don’t see it in the logs :confused: I’m also not using the debug kernel version if that maybe strips out the logs

It does not have to be a debug kernel - it should print the text nevertheless. That means, that the quirk is not being applied at all. However, it should be. Are you certain that you actually installed and use the newly compiled kernel?

Also, I guess we should move this discussion to DMs so we do not clutter this thread too much.

Looks like the patch was not applying due a file I made in modeprobe.d forcing the kernel to use generic driver instead of realtek driver. After removing that file, I can confirm that the patch fixes both the dual boot issue and the issue with low sound until alsactl init is executed.
With this, we should be able to get this change merged into actual kernel source code. Thank you for your help.

2 Likes

Alright then, thank you for doing all those tests and the good news. I will prepare a patch so we can get these changes upstreamed.

Also big thanks to everyone involved here in this thread who helped out with logs and testing!

2 Likes

Btw, in my tests X570 Master Line Out is definitely a bit quieter in Linux, compared to Windows 10 with Gigabyte driver. No audio normalization and equalizer toggled in Windows, Alsa PCM volume maxed in Linux etc., but its still different, perhaps some amplifier settings are different.

Wondering if it is possible to dump all the verbs/coefficients/flags/whatever Gigabyte driver sets in Windows. Could try to create Win10 VM, PCI passthrough onboard audio, let the Gigabyte driver initialize it, hard shutdown VM. Then dump settings in Linux, avoiding reboot and BIOS messing with settings.

Is it worth trying to do so?

Yesterday I submitted the patches to LKML. If all goes well they could be merged into the 5.17 branch as our changes are pretty localized and small. However, the 5.17 merge window is already over so it could also be that our changes might have to wait for the 5.18 merge windows. Time will tell.

I guess someone could look into this kind of stuff. Rebooting from windows is mostly fine from my experience but you are right - having windows run in a vm and passing through the audio could be a better approach. But I’ve never done this before.

My primary goal was to get audio working in a satisfactory way for the motherboard I use and help others with similar motherboards to also get a good audio experience.

Right now I do not really fell like anything important is missing from the audio experience with the drivers being in the state that they currently are. I would love to help out with other gigabyte boards which have the same chipset and codec to get the quirks enabled. However, I do not really feel motivated enough to reverse engineer the more obscure bits of whatever it is the gigabyte driver on windows does.

But if someone else is willing to do the work of finding out what to change (coeffs, connection lists, et al.) I would be glad to help with the driver changing and upstreaming process.

UPDATE: The patches have been accepted and seemingly will be available for 5.17.

4 Likes

Patch was merged into 5.17-rc3. Now let’s keep fingers crossed it makes it to 5.15 as well :crossed_fingers:

Yes it will. I already saw the merges a few days ago for all the stable kernels. It will be in 5.16, 5.15, 5.10, 5.4 and 4.19.

1 Like

Yep, looks like it was merged to all of these.

Just wanted to update, the patch is working fine for me with the X570S Aorus Master. I built my own kernel, and it has also made it into openSUSE Tumbleweed’s stable 5.16.8 package.

EDIT: Forgot to say: BIG THANK YOU for selflessly taking time to scratch others’ itches!

3 Likes

Wanted to shout-out and say thanks for the work y’all did to fix this, I was also having this issue and pleasantly surprised when it was fixed a while back.

Semi-recently (last few months or so) I’ve had a new issue has anybody else had this? Basically I have no sound when I login but muting and adjusting the volume up or down fixes it? Sink ports are all correct etc. and I can’t find any logs anywhere suggesting something is off…

1 Like