Ubuntu – No hdmi audio after suspend

16.04hdmisoundsuspendthinkpad

My problem is that when I wake up the computer after suspend I don't have audio with HDMI. Well, there is "audio" but it's like playing a song and hearing 1 second every 10 minutes and very distorted. Something strange.

With the speakers of the laptop I don't have problems.

I've been using Ubuntu since 8.04. I had 14.04 in my actual laptop, ThinkPad t450, and there was no problem like this until I upgraded to 16.04.

I have seen this thread but doesn't work for me: no sound after suspend/resume

Also I tried using a script in /etc/pm/sleep.d/

#!/bin/sh

# Script to disable hdmi audio before suspend and restart after wake.

case "${1}" in
        suspend|hibernate)
            rmmod snd_hda_codec_hdmi
            rmmod snd
                ;;
        resume|thaw)
            modprobe snd
            modprobe snd_hda_codec_hdmi
                ;;
esac

Still doesn't work with that, maybe I should add things to the script?

lsmod | grep hdmi gives me

snd_hda_codec_hdmi     53248  1
snd_hda_codec         135168  4 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel
snd_hda_core           73728  5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
snd_pcm               106496  5 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_core
snd                    81920  35 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel,thinkpad_acpi,snd_seq_device

Thanks for the help!

Best Answer

I have a Radeon 6570 and the xrandr solution did not work.

As doing CTRL+ALT+F6 and CTRL+ALT+F7 worked, I used the command chvt.

So I changed the Marcos Silveira script as follow:

/lib/systemd/system-sleep/fixhdmiaudio

#! /bin/sh
case $1/$2 in

    post/*)

        # Vai para o VT + 1 e retorna para o VT atual
        CURRENT_VT=$(fgconsole)
        chvt $((CURRENT_VT + 1)) && chvt $((CURRENT_VT))
        ;;
esac