thesofproject / linux

Linux kernel source tree
Other
89 stars 129 forks source link

Razer Blade 16 --> No sound from speakers, running Arch Linux #4479

Open crinavar opened 1 year ago

crinavar commented 1 year ago

Dear community, Currently I am having an issue with a recent Arch Linux install on a Razer Blade 16 laptop. All is working OK except for the audio from the speakers, which do not output any sound. Any type of headphones work properly (EDIT: sound works fine in windows so I would discard a hardware failure).

I installed all typical sound-related packages such as the ALSA family of packages and pipewire, following this guide https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture . Even sof-firmware or alsa-firmware are installed, which were recommended for newer CPUs such as intel 13th gen.

Although the visual intensity bars go up when playing sound, no actual sound is coming out. Is feels as if the sound is being directed to a wrong destination/target internally. Some communication has been going on in this other forum https://bbs.archlinux.org/viewtopic.php?id=285121, but we have not found any solution.

Any ideas where to keep looking? Many thanks in advance

sblommers commented 1 year ago

Hi @crinavar thank you for posting this issue here

Minor additional info I gathered. This does not seem to be limited to Arch Linux, all distro's have the same problem with kernels up to 6.5-rc2.

I recorded the verbs in Windows 10 enabling and disabling the speakers by plugging in headphones and unplugging them. I executed the verbs in Linux not making a difference. Also tried setting the recorded driver pincfgs and using patch file, no difference.

I tried QEMU together with vfio-pci pasthrough but could not get the drivers detected in windows 10 and windows 11. I wanted to record the startup sequence when windows starts to fetch any missed CORB. I hope to get some time and get that logged.

My guess is that the BIOS is not telling the full story about the hardware or the board is too new with some signal missing to actually power the speakers (amp or powerup sequence). It could be that in Windows something is hardcoded to enable the hardware that is not (yet) in Linux or might even need some quirk.

crinavar commented 1 year ago

Hi @sblommers, Many thanks for searching a workaround, let me know if you need me to try anything.

plbossart commented 1 year ago

Suggestions: try the legacy snd-hda-driver with https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#disable-sof-on-pci-hdaudio-devices-to-test-audio-playback, then see if you can snoop what Windows does.

Goddard commented 10 months ago

Razer 18 (2023) model also has the same issue. I also had no sound on a Asus Strix 17. Maybe something related for these newer laptops.

extra info - https://forum.manjaro.org/t/razer-blade-18-2023-sound-doesn-t-work/149020

dkeysil commented 8 months ago

Want to bump this thread since it's still not fixed but there is fix for other laptops with the same sound card

Razer Blade 16 2023 and arch - the same issue

phush0 commented 7 months ago

Razer Blade 14 use the same codec and no sound

phush0 commented 7 months ago

I decompiled DSD table of the BIOS and found only this inside

                Device (SPKR)
                {
                    Name (_HID, EisaId ("PNP0800") /* Microsoft Sound System Compatible Device */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x0061,             // Range Minimum
                            0x0061,             // Range Maximum
                            0x00,               // Alignment
                            0x01,               // Length
                            )
                    })
                }

Probably there are missing pin assignment or something else. Asus SPKR part is enormous compared to this with many more options. I think here they are relaying on driver init.

Edit: I had also tried to capture CORBs but speakers are not working inside VM only headphone jack

phush0 commented 7 months ago

@sblommers here link to drivers needed for sound inside VM https://drive.google.com/file/d/1vgyz6r-NRyIIliKQemFtbAk7y65_j2ao/view. Here is my dump with all CORBS from start of VM, and translated file in text from QHDADump and QHDAExtract. Archive.zip

All CORBS inside are valid (except first row which is warning from QEMU). I have replayed all CORBS and still no sound. VM have sound from speakers .

edit: I found this inside driver log

_HardWareInit,CaplessHookDACNumber=03
_HardWareInit,HeadSetUnPlugDisableHeadSetMics=0
_AzPinComplex::DeviceTypeToCurrentCfg,DevType=22

DAC 03 is for Speakers? What is Capless DAC ?

sblommers commented 7 months ago

Hi @phush0 thank you for your efforts. Looks like 03 is indeed the DAC for speakers. I am going to look into your data and try some on my RB16

phush0 commented 6 months ago

I have to report my progress. I tried to made new dump this time with https://github.com/abridgewater/QemuHDADump with proposed changes of QEMU. Dump is somewhat different as it is made when command is submitted to codec and not dumped from memory buffer. What I found is allot of consequent writes in node 0x20 with index 0x23 where first write looks like address that is incremented. Example:

 index 26 - read 0x02050026 0x020c0000 
 index 89 - write 0x02050089 0x02040000 
 index 23 - write 0x02050023 0x0204c203 
                  0x02040000 0x02040084 
                  0x0204b031 
 index 26 - read 0x02050026 0x020c0000 
 index 89 - write 0x02050089 0x02040000 
 index 23 - write 0x02050023 0x0204c206 
                  0x02040000 0x02040078 
                  0x0204b031 

etc. Here first write in index 23 is c203, then c206. There is many such address. Also "packet" always stops with b031. And starts by writing in index 89.

Also interesting part was that after capture I reboot computer to remove vfio_pci. And just by putting:

sudo hda-verb /dev/snd/hwC1D0  0x20 0x500 0x89
sudo hda-verb /dev/snd/hwC1D0  0x20 0x400 0x0000

sudo hda-verb /dev/snd/hwC1D0  0x20 0x500 0x23
sudo hda-verb /dev/snd/hwC1D0  0x20 0x400 0xc121
sudo hda-verb /dev/snd/hwC1D0  0x20 0x400 0x0000
sudo hda-verb /dev/snd/hwC1D0  0x20 0x400 0x000b
sudo hda-verb /dev/snd/hwC1D0  0x20 0x400 0xb031

I had sound in Linux too. There is no substantial difference in pins and nodes that I can see. Until complete power off I have sound on speakers in Linux. Now will explore this big sequence that is repeating during VM boot to see if this is some kind of upload to DSP and pin rerouting.

dkeysil commented 6 months ago

hey @phush0 . Could you please add information how to reproduce your results? How can I remove vfio_pci? Thank you