does not detect my sound card HDMI

Do you notice how the output of lspci -H1 contains a line that isn't there in lspci:

01:00.1 Audio device: NVIDIA Corporation GF108 High Definition Audio Controller (rev a1)

That's your hdmi audio chip. What is going wrong is that Linux hasn't detected the card properly and thus didn't load the driver. The good news is that the chip is powered and thus we can trick Linux to try detecting it again. The steps you need to follow depend on the driver you are using: nvidia or nouveau.

Warning: if something goes wrong, this will cause a kernel panic and might cause problems with rebooting, though those can be resolved with rebooting multiple times; waiting 2 minutes before turning your laptop back on; and temporarily removing the power source and battery.

Nouveau

  1. The first step is to make sure that the GPU is not in use by a driver. Run lsmod | grep nouveau. If it outputs a line starting with nouveau and ending with a number larger than 0 it is in use. One possible method is to stop X (so either print this out or have a different machine you can read this on):

    • Press ctrl+alt+f1
    • Run runlevel and write down the number (in my pc it is 5).
    • Login as root: sudo su
    • Run init 3 where 3 is a number smaller than the number you just wrote down, but at as big as 1.
    • Run lsmod | grep nouveau again to make sure that the nouveau driver is no longer in use (there should either be no output; no line starting with nouveau; or the line starting with nouveau ends with 0).
  2. As a sanity check, make sure that the GPU and its audio chip are powered:

    • Run lspci -H1 | grep 01:00. It should output two lines.
    • Run lsmod | grep nouveau again to make sure that the nouveau driver is still not in use.
  3. Now that the GPU is powered without a driver we're going to 'remove' it:

    • Run echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove (if the GPU still had a driver loaded/in use, this causes a kernel panic).
    • Redetect the GPU and also its audio chip by running echo 1 > /sys/bus/pci/rescan.
    • Run lspci | grep 01:00.1. If that outputs anything, congratulations! Your linux is now aware of your GPU audio chip.
  4. Get X running with the nouveau GPU.

    • Run init 5 with 5 being the number you wrote down after running runlevel. You should now see X starting again (otherwise try pressing ctrl+alt+f7).
    • If you run aplay -l, now it should output the HDMI outputs (on my pc there are 4 outputs, and only 1 works).

NVidia

  1. The first step is to make sure that the GPU is not in use by a driver. As you're using the nvidia driver, you must also be using prime.

    • Run prime-select query.
    • If it outputs nvidia, you can disable the driver by running sudo prime-select intel and rebooting.
    • If it outputs unknown then the previous step might also work, but will also break your bumblebee setup.
  2. As a sanity check, make sure that the GPU and its audio chip are powered:

    • Login as root: sudo su
    • Run lspci -H1 | grep 01:00. It should output two lines.
    • If the first line ends with (rev ff), you need to power your GPU by running echo ON > /proc/acpi/bbswitch.
    • If the second line is missing, that means that the GPU audio chip is no longer powered. You can try suspending your laptop; resume it again; and check again whether the GPU audio chip is powered (I hope that works for you, otherwise you're out of luck, like me).
    • Run lsmod | grep nvidia again to make sure that the nvidia driver is still not in use.
  3. Now that the GPU is powered without a driver we're going to 'remove' it:

    • Run echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/remove (if the GPU still had a driver loaded/in use, this causes a kernel panic).
    • Redetect the GPU and also its audio chip by running echo 1 > /sys/bus/pci/rescan.
    • Run lspci | grep 01:00.1. If that outputs anything, congratulations! Your linux is now aware of your GPU audio chip.
  4. Get X running with the nvidia GPU.

    • Run prime-select. If it outputs intel, run prime-select nvidia.
    • Logout and back in again.
    • If you run aplay -l now it should output the HDMI outputs (on my pc there are 4 outputs, and only 1 works).

Btw. this bug has already been reported on launchpad: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1377653?comments=all