thesofproject / linux

Linux kernel source tree
Other
91 stars 131 forks source link

No sound on speakers and analog headphone jack on Asus N7601ZM laptop #4176

Closed ErikEngerd closed 1 year ago

ErikEngerd commented 1 year ago

With default settings, I have no sound on this laptop. There is also no sound with the legacy HD audio driver. The digital microphone works though.

options snd-intel-dspcfg dsp_driver=1

However, I followed these instructions from here to create a firmware file. With this firmware file, the legacy HD audio driver works but of course I have no dmic support. There is still no sound through the speakers and headphone with sof.

The firmware patch file is as follows:

# cat /lib/firmware/alc294-sound-patch.fw 

[codec] 
0x10ec0294 0x104312a3 0

[pincfg]
0x19 0x03A11050
0x1a 0x03A11C30
0x21 0x03211420

[verb]
0x20 0x500 0x62
0x20 0x400 0xa007
0x20 0x500 0x10
0x20 0x400 0x8420
0x20 0x500 0x0f
0x20 0x400 0x7774

The firmware file is essential, if I leave out the verbs for instance it doesn't work anymore.

ErikEngerd commented 1 year ago

The alsa info for the case where legacy audio is enabled (dsp_driver=1) and without dmic is as follows. alsa-info.legacy.txt

ErikEngerd commented 1 year ago

With legacy HD audio disabled:

options snd-hda-intel patch=alc294-sound-patch.fw
#options snd-intel-dspcfg dsp_driver=1
#options snd-hda-intel model=laptop-dmic 

then the alsa-info is a follows:

alsa-info.sof.txt

ErikEngerd commented 1 year ago

It seems like I am really close to getting a fully working sound setup. Is there a way to get a permanent fix for this in sof, or is there perhaps another workaround I can use to get audio fully working? What additional information do you require?

plbossart commented 1 year ago

@ErikEngerd what is the problem if you enable SOF and keep the "options snd-hda-intel patch=alc294-sound-patch.fw"

In theory there's no correlation between SOF and snd-hda-intel, we use the snd-hda-intel driver but don't control its internal behavior.

ErikEngerd commented 1 year ago

This is one of the cases above. Doublechecked it again and I still have no sound. Also, recording from the usb mic works then.

plbossart commented 1 year ago

Humm, this looks like a known issue/enhancement needed https://github.com/thesofproject/linux/issues/2714. @kv2019i FYI.

ErikEngerd commented 1 year ago

Thanks for your quick response. I didn't know patch support was only there for the legacy HD audio. At least that will save me a lot of trying with sof to get it working.

Is there perhaps also a way to have this issue looked at for incorporation into the snd-hda-intel driver? If so, where should I report this issue?

Meanwhile, I have ordered a mini USB mic to use until the built-in mic will be working. Tested USB mic support with another USB mic already and that was working.

plbossart commented 1 year ago

The fastest way to solve this across the board might be to add the configuration needed with a quirk, see e.g. in sound/pci/hda/patch_realtek.c

You might need to add you own quirk, similar to e.g.

SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
plbossart commented 1 year ago

@ErikEngerd see tentative code in https://github.com/thesofproject/linux/pull/4177, completely untested or even possibly correct, just based on existing code and the values you provided above.

ErikEngerd commented 1 year ago

thanks for the patch. I am a bit confused though since the codec is Alc294 I believe and not ALC 269. Also, I am wondering how to use the quirk based on the code. What module option to use?

I am also not a kernel developer but definitely a sw developer (with my origins in c, c++ back in the day). Also I have compiled drivers and complete kernels in the past so I would like to test the code myself.

ErikEngerd commented 1 year ago

aha, as I understand now the quirk becomes active automatically based on subsystem and vendor id, am I right?

plbossart commented 1 year ago

yes, the quirk would only be applied for your specific system indeed, with PCI information used.

You are right that it's an ALC294 but this codec goes by multiple codes.

/* different alc269-variants */
enum {
    ALC269_TYPE_ALC269VA,
    ALC269_TYPE_ALC269VB,
    ALC269_TYPE_ALC269VC,
    ALC269_TYPE_ALC269VD,
    ALC269_TYPE_ALC280,
    ALC269_TYPE_ALC282,
    ALC269_TYPE_ALC283,
    ALC269_TYPE_ALC284,
    ALC269_TYPE_ALC293,
    ALC269_TYPE_ALC286,
    ALC269_TYPE_ALC298,
    ALC269_TYPE_ALC255,
    ALC269_TYPE_ALC256,
    ALC269_TYPE_ALC257,
    ALC269_TYPE_ALC215,
    ALC269_TYPE_ALC225,
    ALC269_TYPE_ALC245,
    ALC269_TYPE_ALC287,
    ALC269_TYPE_ALC294,
    ALC269_TYPE_ALC300,
    ALC269_TYPE_ALC623,
    ALC269_TYPE_ALC700,
};

We have instructions if you want to try installing your own kernel, see here: https://thesofproject.github.io/latest/getting_started/setup_linux/install_locally.html

kv2019i commented 1 year ago

@plbossart @ErikEngerd Right, "patch" support is only in snd-hda-intel -> https://github.com/thesofproject/linux/issues/2714 snd-hda-intel provides more debugging interfaces to customize codec setup (without changing kernel code). So the approach has been to use snd-hda-intel to debug the codec, and then when suitable settings have been found, add them as quirks to the codec driver, so SOF can benefit from the quirks as well.

ErikEngerd commented 1 year ago

Now that everything is working I have done a small write-up of the essential steps to go from problem to solution. Thanks a lot for all your help!

plbossart commented 1 year ago

@ErikEngerd this is great, I had no idea about the Asus page https://asus-linux.org/blog/sound-2021-01-11/ Wow.

ErikEngerd commented 1 year ago

can this be closed now, since a patch was accepted?