1

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!

3 Answers 3

1

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
0

Putting scripts in /etc/pm/sleep.d/ will no longer work as a result of the move to systemd from 15.04.

If you want to experiment with such scripts, you can put them in /lib/systemd/system-sleep/ instead, though you'll also need to make some minor changes to them as the parameters that are passed are different.

From man systemd-sleep:

The first argument will be "pre", the second either "suspend", "hibernate", or "hybrid-sleep" depending on the chosen action.

Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post".

In the script you've posted, you'll need to change suspend|hibernate) to pre) and resume|thaw) to post).

1
  • Thanks for answering, but still doesn't work. Any ideas?
    – arturo.mj
    May 27, 2016 at 11:54
0

I know how this problem can be annoying. I used to install the proprietary ATI driver, however when I updated to 16.04 I figure out this issue. I realized that problem was easily solved pressing ctrl + alt + f6 and ctrl + alt + f7 or changing the resolution with the xrandr. So I created this following workaround.

Open the terminal, and type the following command...

sudo nano /lib/systemd/system-sleep/fixhdmiaudio

...and paste this:

#! /bin/sh

# Bug 1252423 – HDMI Audio seen as 'unplugged' after Suspend
# Created by Marcos Silveira - 2016
# Workaround

case $1/$2 in
        pre/*)
          #sleeping - nothing to do
        who |cut -d " " -f1 | uniq > /tmp/suspend.user
          ;;
        post/*)
          # Waking up
          export DISPLAY=:0
          #perform command  as the current tty user

          su - $(cat /tmp/suspend.user) -c "/usr/bin/xrandr --output HDMI-0 --auto;sleep 1s;/usr/bin/xrandr --output HDMI-0 --mode 1920x1080"
          ;;
esac

My default resolution is 1920x1080. You can set any supported resolutions performing xrandr. My default HDMI output is the HDMI-0. This can be different for you. I recommend you perform xrandr before to confirm your default HDMI output.

Save and close and set the permissions:

sudo chmod 755 /lib/systemd/system-sleep/fixhdmiaudio

Enjoy and good luck.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .