Sunday, 18 March 2018

Fixing broken HDMI audio (again)


Back in October I noticed that I had no HDMI audio when running kernels starting from v4.12.0 on an Intel Compute Stick model STK1AW32SC (Cherry Trail) and wrote about how to fix this.

Unfortunately that fix no longer works on Ubuntu's latest ISO: Ubuntu 16.04.4. So I've spent time looking into it and created a script to fix HDMI audio though 'sponsored community work'.

The fix is sponsored by storeanalytics.de and can be downloaded from here.

To use the script to fix a running system first download it and make sure it is executable ('chmod 700 fix-STK1A32SC-and-STK1AW32SC-hdmilpeaudio.sh') then run the script it as root ('sudo ./fix-STK1A32SC-and-STK1AW32SC-hdmilpeaudio.sh'). Finally stop PulseAudio (pulseaudio -k) and restart it (pulseaudio --start) to complete the fix.

Now playing an audio file on the default device with 'aplay /usr/share/sounds/alsa/Front_Left.wav' works together with sound in Chrome and other applications.

The advantage of the fix being a script is that you can use it when respinning an ISO with 'isorespin.sh' (using the '-f' option) and automatically fix HDMI audio in the respun ISO for use on this device.

Please donate if you find my work helpful using the following link http://goo.gl/nXWSGf.

62 comments:

  1. Hello, I have a Minix Neo Z83-4 and I cant apply the patch in bionic iso. In the other iso (Ubuntu 16.04) I cant install it because detects and error during installation, checked the archives with Ubuntu option and detect 2 corrupted files. I create usb bootable in windows with Rufus and in Mint with Unetbooting but the result is the same. Could you help me?

    ReplyDelete
    Replies
    1. If you are using the Ubuntu 16.06.4 ISO then check the 'md5sum' of your download is 'e9c24a4ba2f0eb2fd86158cdcbe45f91' otherwise download it again. For the Minix Neo Z83-4 if you want audio from the headphones you need to respin your ISO with a later kernel and some different userspace files. Take a look at 'https://linuxiumcomau.blogspot.com.au/2017/12/linux-on-minix-neo-z83-4-and-z83-4-pro.html' for further details.

      Delete
    2. Thanks, the iso I was downloaded is corrupted. Now its working perfect.

      Delete
  2. I've tried running this script, as well as follow your previous instructions from October, to try and get audio working on my laptop. All of this has come to no avail, though. Is it possible I did something wrong in the installation of Ubuntu and need to fix it somehow? Or do these instructions only apply to Ubuntu 16.04.4?

    Laptop Model: ASUS Vivobook E200H
    Ubuntu Version: 17.10 (Artful Aardvark)
    CPU: Intel Atom x5-Z8350 @ 1.44GHz (Cherry Trail)

    ReplyDelete
    Replies
    1. How to get audio working is dependent on the physical device hardware and the BIOS. Do you know what sound card/audio chip your ASUS Vivobook E200H uses so we can check if the relevant driver and userspace files are loaded?

      Delete
  3. $ lspci
    No audio devices.

    $ lsusb
    Bus 001 Device 002: ID 0bda:57ed Realtek Semiconductor Corp.

    $ aplay -l
    card 0: Audio [Intel HDMI/DP LPE Audio], device 1: HdmiLpeAudio [Intel HDMI/DP LPE Audio]
    card 0: Audio [Intel HDMI/DP LPE Audio], device 2: HdmiLpeAudio [Intel HDMI/DP LPE Audio]

    Other than this, there does not appear to be any way to find the actual audio device used, unless I forgot to try something else. I think it's all integrated into the chip? I'm not actually sure how Cherry/Atom Trail processors work outside of their being an all-in-one chip.

    ReplyDelete
    Replies
    1. Odd, there should be a third "aplat -l" device in there.

      card 0: Audio [Intel HDMI/DP LPE Audio], device 0: HdmiLpeAudio [Intel HDMI/DP LPE Audio]
      card 0: Audio [Intel HDMI/DP LPE Audio], device 1: HdmiLpeAudio [Intel HDMI/DP LPE Audio]
      card 0: Audio [Intel HDMI/DP LPE Audio], device 2: HdmiLpeAudio [Intel HDMI/DP LPE Audio]

      Delete
    2. Your 'dmesg' after booting should include references to your sound chip. Can you use 'pastebinit' to post to your full 'dmesg' immediately after booting?

      Delete
    3. http://paste.ubuntu.com/p/8Htykg49N5/

      Line 620: [ 2.942857] [drm] HDaudio controller not detected, using LPE audio instead

      That's what I found at first glance, at least.

      Delete
    4. Line 659 is of interest 'intel_sst_acpi 808622A8:00: No matching machine driver found'. Can you boot my ISO from 'http://linuxiumcomau.blogspot.com.au/2018/03/third-look-at-ubuntu-1804-or-bionic.html' using a USB and post the 'dmesg'?

      Delete
    5. http://paste.ubuntu.com/p/q8f7hDGgJ3

      It would appear that the same issue that you pointed out is found here, in Line 700.

      Delete
    6. I've written a script that will install a kernel I've built based on Canonical's source for Ubuntu-4.15.0-12 and my port of support for Conexant CX2072X based on Takashi Iwai earlier topic/asus-e100h-4.13 work together with the necessary UCM files from Grippentech. I don't have your device so I've no idea if it works.

      You need to run the script from an installed Ubuntu on your device rather than a LiveUSB (it is not important which version) because a reboot is required. Download the script from 'http://bit.ly/linuxium-install-4_15-cx2072x' and after making sure it is executable simply run it as './linuxium-install-4.15-cx2072x.sh'. Then reboot and select 'Advanced' options from the GRUB menu and then select the '4.15.0-12-linuxium' option to run the new kernel.

      Can you then test audio and let me know if it works and also 'pastebinit' the 'dmesg'?

      Delete
    7. http://paste.ubuntu.com/p/2JCWt9m2hT/

      Looks like it picked up the sound card this time.
      Lines 691-697 and Line 727.

      Delete
    8. Lines 716 and 717 also show no audio currently.

      It will be interesting to see if my test kernel (from above) fixes that.

      Delete
    9. http://paste.ubuntu.com/p/9y4pc7W5Tm/

      I don't think this new kernel helped either. However, it does appear to load without any issue.

      Delete
    10. When you connected headphones or similar did they show up in the 'sound' settings even if there was no audio once selected? Is there any change in the 'aplay -l' and 'aplay -L' outputs?

      Delete
    11. For the headphones, nothing occurs when I plug anything in.

      As for the 'aplay -l' output, it appears to add the following new cards alongside the usual HDMI/DP LPE devices:

      card 1: chtcx2072x [chtcx2072x], device 0: Audio (*) []
      Subdevices: 1/1
      Subdevice #0: subdevice #0
      card 1: chtcx2072x [chtcx2072x], device 1: Deep-Buffer Audio (*) []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

      'aplay -L' outputs this list: http://paste.ubuntu.com/p/qdGkt35XqD/

      Delete
    12. I've uploaded a new version using the same URL. Therefore there is no change to the installation instructions so: download the (updated) script from 'http://bit.ly/linuxium-install-4_15-cx2072x' and after making sure it is executable simply run it as './linuxium-install-4.15-cx2072x.sh'. This will replace the kernel from yesterday with a new one that excludes a driver that may get audio working. Can you test using speakers and headphones and using direct commands:
      e.g. for speakers
      aplay -D plughw:0,0 /usr/share/sounds/alsa/Front_Left.wav
      aplay -D plughw:0,1 /usr/share/sounds/alsa/Front_Left.wav
      aplay -D plughw:0,2 /usr/share/sounds/alsa/Front_Left.wav
      e.g.for headphones
      aplay -D plughw:1,0 /usr/share/sounds/alsa/Front_Left.wav
      aplay -D plughw:1,1 /usr/share/sounds/alsa/Front_Left.wav

      Delete
    13. Speakers:
      None of the three commands gave me sound. They just give the usual 'underrun!!!' alerts.

      Headphones:
      The two commands output the following: https://paste.ubuntu.com/p/kVswDjtxrx/
      And I'm going to guess this is just information about the audio file itself.

      Delete
    14. So the conclusion is there doesn't appear to be a maintainer for the CX2971X driver submitted to the mainline kernel and as a result it won't be accepted into the mainline kernel.

      The maintainer of the mainline kernel sound subsystem had asked the original submitter for some further changes but these have not eventuated.

      As a result any attempt to get sound working will not be officially supported meaning that it will be up to individuals to maintain custom kernels with security updates as a minimum.

      Given I don't have this hardware for testing I've done as much as I can at this point.

      Delete
    15. Understood. Thanks for all your help, though! I have a better understanding now than I did before, at the very least.

      Delete
    16. One last test. Can you run the command:

      if (! grep -q snd_hdmi_lpe_audio /etc/modprobe.d/blacklist.conf); then echo "blacklist snd_hdmi_lpe_audio" | sudo tee -a /etc/modprobe.d/blacklist.conf > /dev/null; fi

      and then reboot and select my kernel. This will 'blacklist' the HDMI audio driver just in case this impacts the other drivers.

      After testing simply enter:

      sudo sed -i '$d' /etc/modprobe.d/blacklist.conf

      to restore the HDMI audio driver.

      Delete
    17. Unfortunately, that didn't work either.

      Running https://github.com/Grippentech/Asus-E200HA-Linux-Post-Install-Script/blob/master/justSound.sh didn't work either. Probably doesn't help that they ended development a while back, though the Issues section does suggest that the necessary patches are still available for newer versions of Linux.

      Delete
    18. That is a shame. If I see a solution anywhere else I'll about it post here.

      Delete
  4. I have exactly the same problem with the same device, and I just cant find a way to get sound to work, I just want to get rid of windows 10. But i'm not tech savvy enough to fix all the problems on my own, this device has problem with sound and video when watching youtube and also problem with power. And there seems to be no hope :(((

    ReplyDelete
    Replies
    1. Can you help test (see the comment above for details)?

      Delete
  5. Hello everyone,

    Is it normal that there is some latency in the STK1A32SC (is slow) using the respun ISO from the first post of March?

    It shows the WiFi signal is strong (even though the router is in the adjacent room, behind a closed door), but it is really slow when downloading pages (images, videos snaps).

    I'm thinking on using a 6ft HDMI cable extension, so I can place this compute stick away from behind the TV but I don't know if it can drive the cable.

    Any advice will be greatly, greatly appreciated.

    ReplyDelete
    Replies
    1. Do you really need Ubuntu as Lubuntu runs faster as it is lightweight so it might be better for you?

      Delete
    2. Is the first one that finally fully works (the audio fix worked like a charm) on my compute stick and I don't really have enough time to try in respinning a Lubuntu.

      I've been absent from this scene for a long time and I don't know if there is already a Lubuntu re-spun floating around.

      If there isn't, I'll see if I can find the time and follow your documents on spinning ISOs.

      Very, very much appreciated for your work and the time you dedicate in helping all us.

      As soon as I have a chance I'll show my appreciation.

      Thanks again.

      Delete
  6. Good day, me again,

    Which version you'll recommend to spin, Version 16.04.4 LTS or current 17.10.1 release, Artful Aardvark?

    I'm tempted to use 16.04.4 LTS, just because that's the Ubuntu version installed on my stick, meaning your script worked fine with 16.04.4 LTS.

    ReplyDelete
    Replies
    1. Try Lubuntu 16.04.4 first then.

      Delete
    2. Hi again,

      Tried Lubuntu 16.04.4; not better!
      I'll say it's as slow as Ubuntu 16.04.4 LST (my feeling).

      Has anybody, or yourself tried a USB Ethernet network adapter that actually works with this stick and your work? It just occured to me.

      I thought by just adding the HDMI audio fix script, when respinning the audio would work out of the box; had to perform all the steps you indicated. Is working!

      Delete
    3. Because you have a posted questions across a number of posts I suggested we reset and confirm what your requirements are so I can suggest the best solution.

      I know you have a STK1A32SC but will Ubuntu be the only OS installed on the device? I also know you have an SD card but is that just for storing data on?

      If you can explain what would be the best setup for you we can start from there.

      Delete
    4. Hi Ian,

      Thank you very much for your time and patience.

      I will only be running Ubuntu from the SD card. I want to keep the stick's memory as much free as possible.

      Delete
    5. From memory you can't run Ubuntu from the SD card as in running the kernel as the SD card isn't recognised by the bootloader. This means as a minimum you need to have the kernel (and initram) stored on the stick's eMMC and then run the filesystem from the SD card. However this presents problems when updating the kernel as updates have to be manually copied to where the kernel is stored on eMMC and as it is not automated then risks include running an outdated (from a security viewpoint) kernel. The alternative is to run Ubuntu from the eMMC but have mount points to on the SD card for various core directories. This keeps your footprint small for the installed Ubuntu on the eMMC and effectively allows you to run on the SD card. If you adopt this latter approach the installation is configurable through the 'Installation Type' screen (select 'Something else'). Try experimenting and see how you get on.

      Delete
    6. Thanks for your reply.

      I manage to put my hands at work on a USB3.0/Ethernet adapter (fosmon: HD8009 (chipset AX88179)), connected it and speed improved a lot, what leads me to think my suspicions where right. The way I have place the wifi hardware at home is affecting the connection.

      I'll start reading again on how to setup mount points (I'll see if I can find my BSD notes, from when I use to set it up).

      Thanks again.

      Delete
  7. Hey @linuxium love the project. I am getting this error on version of isorespin from 7.x to 8.1.3

    isorespin.sh local package rtl8723bs_4.12.0_amd64.deb failed to install correctly

    any suggestions?

    ReplyDelete
    Replies
    1. and this one depending on the version: /bin/bash: line 12: gdebi: command not found

      Ive tried every fix you have offered in the comments. none worked.

      Im running Ubuntu 17.04 x64

      Delete
    2. What ISO are you trying to respin?

      Delete
    3. KDE Plasma Mobile test ISO. http://images.plasma-mobile.org/iso/

      I was able to get an older version of isorespin to work, but it didnt have many of the atom fixes.

      Delete
    4. Just tested on ubuntu-gnome 17.04 ISO (on two different machines), same error

      Delete
    5. You are getting the error because 17.04 ISOs are EOL so adding the required package 'gdebi' to install the Atom wifi and bluetooth packages fails. I'll put a test in to prevent attempts to respin EOL ISOs.

      Delete
    6. Interesting. Plasma Mobile is 16.04 based. Any idea why it would have the same error?

      Delete
    7. I'll take a look into it.

      Delete
    8. Awesome, thank you. Your time and effort are appreciated.

      Delete
    9. Fixed! Also I've posted about Plasma Mobile here 'http://linuxiumcomau.blogspot.com.au/2018/04/an-initial-look-at-plasma-mobile.html'.

      Delete
  8. I tried this on my 2in1 tablet pc(z8300 processor) but i have got this error message:
    sudo: fix-STK1A32SC-and-STK1AW32SC-hdmilpeaudio.sh: command not found

    what should i do?
    distro: xubuntu 17.01
    kernel version: 4.13.0-37-generic

    ReplyDelete
    Replies
    1. There was a type above. The command should be 'sudo ./fix-STK1A32SC-and-STK1AW32SC-hdmilpeaudio.sh' obviously without the quotes around it.

      Delete
    2. Thank you for your answer, it did not give error this time but did not work either. I have bought a device which has a sound card(usb to jack), i can use with my headphones. I also tried your isorespin script with lots of distro and kernel combination, most of them did not even be able to open 'try xubuntu without install' option. Some open that option but did not see my eMMC so i could not install xubuntu on my 2in1 laptop.

      Looks i am hopeless. I have to buy a better laptop. Thank you so much for your help, effort.

      Delete
    3. Use 'pastebinit' to post links to your 'isorespin.log' and 'dmesg' after booting so I can see if anything is missing.

      Delete
  9. Hi!

    I was install respined ubuntu 16.04 ISO on subject tablet. Most useful
    things are work. But have a problem with sound. Sound card detected by
    kernel as intel HDMI/DP LPE Audio. But no sound trough it. Not from
    speakers not from headphones. I try solution from
    https://linuxiumcomau.blogspot.com/2017/10/fixing-broken-hdmi-audio.html
    but still no luck. Please help me make that shit sounds.:)

    ReplyDelete
  10. Oh, sorry for the ' subject tablet'. It was copy from email. Subject tablet is Lenovo Yoga 2 1051L (CPU Atom Z3745)

    ReplyDelete
    Replies
    1. great to see another person with the lenovo yoga tab 2. i didn't get solved yet problems with sound, gps-sensor and the right klick on the touch-screen. so i gave up and hope it will be fixed in the future .... many luck!

      Delete
    2. I am looking at audio issues again so keep an eye out soon for another post on 'fixing broken audio'.

      Delete
    3. Ready to provide any additional information, including access via ssh.

      Delete
    4. Can you post a link (using 'pastebinit') of a 'dmes' immediately after booting?

      Delete
    5. hi, there is my pastebin. i've installed a new ubuntu-mate-18.04 with kernel 4.17

      http://paste.ubuntu.com/p/ZNTSf6QyWf/

      thank you

      Delete
    6. Here is my dmesg out http://paste.ubuntu.com/p/RgJ5pcjswb/

      Release:
      DISTRIB_ID=Ubuntu
      DISTRIB_RELEASE=16.04
      DISTRIB_CODENAME=xenial
      DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
      NAME="Ubuntu"
      VERSION="16.04.4 LTS (Xenial Xerus)"
      ID=ubuntu
      ID_LIKE=debian
      PRETTY_NAME="Ubuntu 16.04.4 LTS"
      VERSION_ID="16.04"
      HOME_URL="http://www.ubuntu.com/"
      SUPPORT_URL="http://help.ubuntu.com/"
      BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
      VERSION_CODENAME=xenial
      UBUNTU_CODENAME=xenial

      uname:
      Linux GSLP 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

      lshw: http://paste.ubuntu.com/p/xPjdccTYGV/


      Delete
    7. Your device uses the WM5102 audio codec. Try this https://github.com/Kitsune2222/Android_Yoga_Tablet_2 otherwise you may need to compile a kernel with the 'ASoC: Intel: add bytcr-wm5102 machine driver' patch first.

      Delete
    8. The "https://github.com/Kitsune2222/Android_Yoga_Tablet_2"
      not work.
      About "compile a kernel with the 'ASoC: Intel: add bytcr-wm5102 machine driver' patch first." - is there any suitable instruction, because im not familiar with 'patching & compiling'.

      Delete
    9. I had a look at the patch and it needs rework before applying to the current mainline kernel. As I don't have the device I suggest contacting the patch author to see if they have a final working solution.

      Delete
  11. Hi,

    I can confirm that this fix is required with Ubuntu 18.04 LTS on STK1AW32SC.
    Audio over HDMI is now working !

    But I haven't understood how to respin the ISO directly with the script.
    Could you please clarify ?

    Many thanks

    ReplyDelete