8

Question

I am running Ubuntu 18.04 on a Lenovo Yoga ThinkPad X1 Gen4. The audio quality is noticeably lacking compared to what the same hardware shows off on windows. And the volume maximum on Ubuntu is quieter than 30% volume on Windows.
How can I improve this? Ideally while maintaining the functionality of the volume keys.

What I tried

alsamixer

Increasing the master volume in alsamixer does slightly raise the volume of the laptop, but not sufficiently. Also, it does not persist.

alsamixer reports only one sound card option when I press F6 (which is reasonable) and does not offer a slider for the often-mentioned "pcm" that some answers advised to modify. E.g. this answer.

Interestingly, none of the alsamixer sliders move when I use the volume keys on the keyboard to increase/decrease the volume, although they clearly do affect the volume level.

System Settings

The sound settings have a togglebutton for "Over-Amplification" which increases the volume level maximum by 50% at the cost of audio quality. This is not only not sufficiently loud, it is also even worse audio quality than before.

The speaker is the only device listed, called Speaker-sof-skl_hda_card.

pavucontrol

Increasing the volume in pavucontrol seems to be doing the same thing as increasing the master volume level in alsamixer.

upgrading PulseAudio to v13

I uninstalled PulseAudio v11 (latest in apt) and tried building the latest PulseAudio myself. The ../configure succeeded with warnings about d-bus being too old or not available. I think neither of those is true, so I didn't proceed due to feeling unsure.

PulseEffects with PulseAudio v12

Using the PPA advised for in this answer I could successfully install PulseAudio v12 and PulseEffects.
After a reboot, the update itself did not seem to have any noticeable effect.

I activated autogain in the PulseEffects GUI as advised in this comment on another answer but while it certainly did have an effect and maybe improved quality a little, the volume was decreased by having this option active.

Installing Correct Drivers

Lenovo only has drivers listed for windows, although lenovo states that the laptop is "linux certified". This includes "Proper functionality of the device" under "Audio".

It is maybe worth noting that the lenovo website talks about a "Realtek Audio Driver" while lspci only reports an "Intel Corporation Device 9dc8 (rev 11)" to me.

6.0.8854.1 (Realtek Audio)/ 10.23.0.3672 (Intel Smart Sound Technology)

According to certification.ubuntu.com the Audio hardware is

Audio

Intel Corp. Cannon Point-LP High Definition Audio Controller (8086:9dc8)

Intel Corp. Unknown

nomodeset

For a different issue, I booted with nomodeset as a grub parameter, which in turn broke my volume keys. But this seems to have been fixed in a recent kernel update. Both with and without nomodeset, the sound itself is low quality though.

System Information

uname -a

generic@motorbrot:~$ uname -a
Linux motorbrot 5.3.0-62-generic #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

lspci

generic@motorbrot:~$ lspci | grep -i Audio
00:1f.3 Audio device: Intel Corporation Device 9dc8 (rev 11)

aplay -l

generic@motorbrot:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofsklhdacard [sof-skl_hda_card], device 0: HDA Analog (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsklhdacard [sof-skl_hda_card], device 1: HDA Digital (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsklhdacard [sof-skl_hda_card], device 3: HDMI1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsklhdacard [sof-skl_hda_card], device 4: HDMI2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsklhdacard [sof-skl_hda_card], device 5: HDMI3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

/etc/modprobe.d/alsa-base.conf

# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7

Cause optional modules to be loaded above generic modules

install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }

Workaround at bug #499695 (reverted in Ubuntu see LP #319505)

install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; } install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; } install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }

install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }

Cause optional modules to be loaded above sound card driver modules

install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; } install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }

Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)

install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }

Prevent abnormal drivers from grabbing index 0

options bt87x index=-2 options cx88_alsa index=-2 options saa7134-alsa index=-2 options snd-atiixp-modem index=-2 options snd-intel8x0m index=-2 options snd-via82xx-modem index=-2 options snd-usb-audio index=-2 options snd-usb-caiaq index=-2 options snd-usb-ua101 index=-2 options snd-usb-us122l index=-2 options snd-usb-usx2y index=-2

Ubuntu #62691, enable MPU for snd-cmipci

options snd-cmipci mpu_port=0x330 fm_port=0x388

Keep snd-pcsp from being loaded as first soundcard

options snd-pcsp index=-2

Keep snd-usb-audio from beeing loaded as first soundcard

options snd-usb-audio index=-2

sound fix 03. Jun 2020

did help when combined with running "pulseaudio --start" after reboot.

But broke birghtness keys.

See askubuntu.com/questions/1245587/sound-card-not-detected-on-ubuntu-18.04/1246476

options snd-hda-intel dmic_detect=0

Loaded Audio Drivers

As per this question my loaded sound drivers are:

generic@motorbrot:~$ /sbin/lsmod | grep snd
snd_soc_skl_hda_dsp    24576  5
snd_soc_hdac_hdmi      32768  1 snd_soc_skl_hda_dsp
snd_soc_dmic           16384  1
snd_hda_codec_hdmi     57344  1
snd_hda_codec_realtek   118784  1
snd_hda_codec_generic    81920  1 snd_hda_codec_realtek
snd_sof_intel_hda_common    73728  1 sof_pci_dev
snd_soc_hdac_hda       24576  1 snd_sof_intel_hda_common
snd_sof_intel_hda      20480  1 snd_sof_intel_hda_common
snd_sof_intel_byt      24576  1 sof_pci_dev
snd_sof_intel_ipc      20480  1 snd_sof_intel_byt
snd_sof                98304  4 snd_sof_intel_hda_common,snd_sof_intel_byt,snd_sof_intel_ipc,sof_pci_dev
snd_sof_xtensa_dsp     16384  1 sof_pci_dev
snd_hda_ext_core       28672  4 snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda
snd_soc_acpi_intel_match    32768  2 snd_sof_intel_hda_common,sof_pci_dev
snd_soc_acpi           16384  2 snd_soc_acpi_intel_match,sof_pci_dev
snd_soc_core          241664  6 snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_soc_dmic,snd_soc_skl_hda_dsp
snd_compress           24576  1 snd_soc_core
ac97_bus               16384  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_hda_intel          53248  0
snd_intel_dspcfg       24576  2 snd_hda_intel,sof_pci_dev
snd_hda_codec         131072  6 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek,snd_soc_hdac_hda,snd_soc_skl_hda_dsp
snd_hda_core           90112  11 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_hda_codec_realtek,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda,snd_soc_skl_hda_dsp
snd_hwdep              20480  1 snd_hda_codec
snd_pcm               102400  11 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_core,snd_hda_core,snd_pcm_dmaengine
ledtrig_audio          16384  3 snd_hda_codec_generic,snd_hda_codec_realtek,thinkpad_acpi
snd_seq_midi           20480  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_rawmidi            36864  1 snd_seq_midi
snd_seq                69632  2 snd_seq_midi,snd_seq_midi_event
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
snd_timer              36864  2 snd_seq,snd_pcm
snd                    86016  23 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,thinkpad_acpi,snd_soc_core,snd_pcm,snd_rawmidi
soundcore              16384  1 snd

Reactions To Comments

Issue 207407

From bugzilla.kernel.org/show_bug.cgi?id=207407 you can test the patch to the file /usr/share/alsa/ucm2/sof-hda-dsp/HiFi.conf (comment #16) – laugeo

This file does not exist on my machine. What does exist however, is a file /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf. Notable differences:

  • it's ucm instead of ucm2
  • it's the card name as reported by aplay -l

The linked diff suggests changing the PlaybackMixerElem and PlaybackVolume entries for "Speaker" and for "Headphones" to PlaybackMixerElem "Master" and PlaybackVolume "Master Playback Volume".
In my file, this is already the case. Here is my complete file:

# Use case Configuration for skl-hda-card

SectionVerb {

EnableSequence [
    cdev "hw:sofsklhdacard"
]

DisableSequence [
    cdev "hw:sofsklhdacard"
]

}

SectionDevice."Speaker" { Comment "Speaker"

EnableSequence [
    cdev "hw:sofsklhdacard"
    cset "name='Speaker Playback Switch' on"
]

DisableSequence [
    cdev "hw:sofsklhdacard"
    cset "name='Speaker Playback Switch' off"
]

Value {
    PlaybackPCM "hw:sofsklhdacard,0"
    PlaybackVolume "Master"
    PlaybackSwitch "Master Playback Switch"
    JackHWMute "Headphone"
    PlaybackChannels "2"
    PlaybackPriority "100"
}

}

SectionDevice."Headphone" { Comment "Headphone"

EnableSequence [
    cdev "hw:sofsklhdacard"
    cset "name='Headphone Playback Switch' on"
]

DisableSequence [
    cdev "hw:sofsklhdacard"
    cset "name='Headphone Playback Switch' off"
]

Value {
    PlaybackPCM "hw:sofsklhdacard,0"
    PlaybackVolume "Master"
    PlaybackSwitch "Master Playback Switch"
    PlaybackChannels "2"
    JackName "sof-skl_hda_card Headphone"
    JackType "gpio"
    JackSwitch "12"
    JackControl "Headphone Mic Jack"
    PlaybackPriority "200"
}

}

<ucm/sof-skl_hda_card/Mics.conf>

The statement

I think firmware and EC aren't the issue here, since everything works correctly prior to kernel 5.4.10.

confuses me a bit, since my kernel is currently only 5.4.0 which is before that.

Reboot From Windows

However, since kernel 5.4.10 (as recent as 5.6.6) on Arch, the two speakers on the bottom does not work when the machine is booted directly into Linux. The same issue also exists on Ubuntu 20.04 beta. However, if I boot into Windows 10 first, then reboot into Linux, all speakers work correctly. I'm using the SOF firmware and PulseAudio 13.99.1, but the problem still exists if I boot with 'snd_intel_dspcfg.dsp_driver=1' or 'snd_hda_intel.dmic_detect=0'.

This comment from the bugtracker indicates that updating PulseAudio and upgrading to Ubuntu 20.04 does not resolve the issue. More importantly though, it says that the sound works on all speakers when rebooting from windows into linux instead of booting cold.
I can reproduce that - but on further inspection I'm pretty sure all four speakers have worked for me since the beginning. The problem is just the sound quality and volume.

Issue 208133

On the kernel bugtracker, there is another issue, marked as duplicate. Thinkpad X1 Yoga gen 4 sound issues: no bass, max volume too low, only stereo channels visible to PA

With a Thinkpad X1 Yoga gen 4, Kernel 5.6.14, and PulseAudio 14, The sound situation is as follows:

Good:

  • The microphone array works properly out of the box
  • The front and rear speakers all produce sound out of the box

Bad:

Possibly relevant useful: if I set snd_hda_intel.dmic_detect=0 in the kernel parameters, the mic array is no longer detected, but https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/914 and https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/913get fixed.

So I have tried what the effect of snd_hda_intel.dmic_detect=0 is on my laptop. The diff between (set -u && aplay -l && pacmd list-cards) &> out.txt before and after adding this kernel boot argument is hosted with coloring on github
There is quite some change in the profiles: section but I don't know if it's relevant and I'm having a hard time telling whether this modification changed the sound quality at all. It seems to be louder now, but that is hard to tell without an objective measure.
One of the changes that happened is that it is now a HDA Intel PCH instead of alsa.card_name = "sof-hda-dsp".

Contacting The Manufacturer

I have contacted lenovo through their customer support ticket system and their reply was

We are sorry to inform you we can only offer support for devices running Windows operating system.
If the device is working without an issue in Windows we can not provide any further service.

I am disappointed since the lenovo website explicitly states that this laptop is "linux certified" and that in general

Lenovo will also upstream device drivers directly to the Linux kernel, to help maintain stability and compatibility throughout the life of the workstation.
news.lenovo.com

but it seems like the just don't have set up any support team for linux.

(Edit:) I have now received another response from lenovo stating that I could contact their service partners in my country. They gave me two phone numbers which I will call once I get to it.

(Edit:) There is a new post on the bugtracker that I was not yet able to verify.

On kernel 5.8.12 with SOF firmware, the issue seems to be resolved. Big thanks to everyone involved!

lucidbrot
  • 1,311
  • 3
  • 18
  • 39
  • 1
    From https://bugzilla.kernel.org/show_bug.cgi?id=207407 you can test the patch to the file /usr/share/alsa/ucm2/sof-hda-dsp/HiFi.conf (comment #16) – laugeo Jul 20 '20 at 16:09
  • Thank you for that link @laugeo! I will check it as soon as I get the time. It could be promising since the X1 Carbon is a very similar laptop. – lucidbrot Jul 20 '20 at 18:56
  • @laugeo please see my edit at the end of my question - it didn't make sense to try put it as a comment :) – lucidbrot Jul 20 '20 at 20:36
  • @Nmath It was not my intention to throw blame with that "obviously". It is obvious to me that the quality is lacking when I hear the sound - as in "I have no technical measure that shows me the sound is bad but I hear it". Not meant as "It was to be expected and now here we are." – lucidbrot Jul 20 '20 at 21:51
  • I might contact the manufacturer if I don't find any other option that would actually be helpful to me. But I'd think I wouldn't be the first person with this problem - it's not an unpopular device. – lucidbrot Jul 20 '20 at 21:52
  • 1
    from the bugzilla kernel page, "However, if I boot into Windows 10 first, then reboot into Linux, all speakers work correctly" . Interesting fact is that your pc has 4 speaker but only 2 works with the current linux state. This a kernel problem (related to the new SOF audio layer on top of Alsa) , and from the kernel bugzilla page, you see that it is in the way to be solved . Anyway you will need the most recent kernel and Ubuntu 20.04 – laugeo Jul 21 '20 at 10:34
  • @Nmath: your reply is utterly useless and completely unhelpful. It does not contribute in any way. People like you are why the Linux community gets a bad reputation. – Kim Sep 24 '22 at 18:16

0 Answers0