Comment 5 for bug 1377653

bcmpinc (bcmpinc) wrote :

I've been running into this problem over and over again and found several different solutions. However, some of them also stopped working after installing updates. There is this solution that I found when using the NVIDIA proprietary drivers: http://askubuntu.com/a/511907/73753. Which involves suspending your laptop, to trick it into powering on the audio chip on your nvidia gpu.

However, I seriously recommend using the nouveau driver nowadays. As it supports the nvidia optimus technology, whereas the proprietary driver does not. Though, the drawback is that the nouveau driver only supports opengl 3.3. See http://nouveau.freedesktop.org/wiki/Optimus/. The difference is that you use `DRI_PRIME=1` instead of `optirun`. And that you use `echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch` instead of `prime-select nvidia` before restarting X11 when you want to use the hdmi output.

With nouveau, my hdmi audio still does not work out of the box. Though, the audio device is listed in lspci -H1 when booted, which saves us half the trouble we had with the NVIDIA driver. The steps I use to get the driver loaded for the audio device are (warning, this might hang your pc, also, if your pc fails to (re)boot, perform a hard-reset by removing the power & battery and waiting 3 or more minutes (1 minute is not sufficient)):
- press ctrl+alt+f1
- login and run `sudo su`
- shut down x11 and the loginscreen, such that the gpu is no longer in use. I could do that by running `runlevel` followed by `init 3`
- 'remove' the gpu: `echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove`
- redetect the gpu: `echo 1 > /sys/bus/pci/rescan`
- If everything went right, the driver for the hdmi audio chip should be loaded. Verify this by running `lscpi` and checking if there is a line like "01:00.1 Audio device: NVIDIA Corporation GF116 High Definition Audio Controller (rev a1)".
- switch to the hdmi output: `echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch`
- start the login manager and x11 again: in my case I needed to run `init 5` where 5 was the number reported by `runlevel`.

I obtained the remove & rescan pci trick from https://devtalk.nvidia.com/default/topic/609790/linux/no-hdmi-sound-w-optimus-in-linux/.