Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7) might be all you need.
#!/bin/bash
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823
# Prereq: Install Linux 5.3 or newer
# NOTE: run this script as root and at your own risk.
firmware_version=v1.4.1
echo Copy https://github.com/thesofproject/sof/releases/download/${firmware_version}/sof-cnl-${firmware_version}.ri to /lib/firmware/intel/sof/ as sof-cnl.ri
mkdir -p /lib/firmware/intel/sof/
curl -L https://github.com/thesofproject/sof/releases/download/${firmware_version}/sof-cnl-${firmware_version}.ri -o /lib/firmware/intel/sof/sof-cnl.ri
echo Copy https://github.hamidzare.xyz/dl/sof-hda-generic.tplg to /lib/firmware/intel/sof-tplg/ as sof-hda-generic-4ch.tplg
mkdir -p /lib/firmware/intel/sof-tplg/
curl -L https://github.hamidzare.xyz/dl/sof-hda-generic.tplg -o /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg
ln -s /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg /lib/firmware/intel/sof-tplg/sof-hda-generic.tplg
echo creating file /etc/modprobe.d/alsa-base.conf ------
cat <<EOT >> /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 being loaded as first soundcard
options snd-usb-audio index=-2
EOT
echo finished creating /etc/modprobe.d/alsa_base.conf ------
echo creating file /etc/modprobe.d/blacklist.conf -------
cat <<EOT >> /etc/modprobe.d/blacklist.conf
blacklist snd_hda_intel
blacklist snd_soc_skl
EOT
echo finished creating /etc/modprobe.d/blacklist.conf -------
echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------
mkdir -p /usr/share/alsa/ucm/sof-skl_hda_card
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf
# Use case Configuration for skl-hda-card
SectionVerb {
EnableSequence [
cdev "hw:sofsklhdacard"
cset "name='Master Playback Switch' on"
cset "name='Capture Switch' on"
]
DisableSequence [
cdev "hw:sofsklhdacard"
]
}
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"
PlaybackChannels "2"
JackName "sof-skl_hda_card Headphone"
JackType "gpio"
JackSwitch "12"
JackControl "Headphone Jack"
}
}
SectionDevice."Speaker" {
Comment "Speaker"
EnableSequence [
cdev "hw:sofsklhdacard"
cset "name='Speaker Playback Switch' on"
]
DisableSequence [
cset "name='Speaker Playback Switch' off"
]
Value {
PlaybackPCM "hw:sofsklhdacard,0"
JackHWMute "Headphone"
PlaybackChannels "2"
}
}
SectionDevice."Headset" {
Comment "Headset Mic"
ConflictingDevice [
"DMIC Stereo"
]
EnableSequence [
cdev "hw:sofsklhdacard"
]
DisableSequence [
cdev "hw:sofsklhdacard"
]
Value {
CapturePCM "hw:0,0"
CaptureChannels "2"
JackControl "Mic Jack"
}
}
SectionDevice."Dmic" {
Comment "DMIC Stereo"
ConflictingDevice [
"Headset Mic"
]
EnableSequence [
cdev "hw:sofsklhdacard"
]
DisableSequence [
cdev "hw:sofsklhdacard"
]
Value {
CapturePCM "hw:0,6"
CaptureChannels "2"
}
}
SectionDevice."HDMI1" {
Comment "HDMI1/DP1 Output"
EnableSequence [
cdev "hw:sofsklhdacard"
cset "name='hif5-0 Jack Switch' on"
cset "name='Pin5-Port0 Mux' 1"
]
DisableSequence [
cdev "hw:sofsklhdacard"
cset "name='Pin5-Port0 Mux' 0"
cset "name='hif5-0 Jack Switch' off"
]
Value {
PlaybackPCM "hw:0,3"
PlaybackChannels "2"
JackControl "HDMI/DP, pcm=11 Jack"
}
}
SectionDevice."HDMI2" {
Comment "HDMI2/DP2 Output"
EnableSequence [
cdev "hw:sofsklhdacard"
cset "name='hif6-0 Jack Switch' on"
cset "name='Pin6-Port0 Mux' 2"
]
DisableSequence [
cdev "hw:sofsklhdacard"
cset "name='Pin6-Port0 Mux' 0"
cset "name='hif6-0 Jack Switch' off"
]
Value {
PlaybackPCM "hw:0,4"
PlaybackChannels "2"
JackControl "HDMI/DP, pcm=12 Jack"
}
}
SectionDevice."HDMI3" {
Comment "HDMI3/DP3 Output"
EnableSequence [
cdev "hw:sofsklhdacard"
cset "name='hif7-0 Jack Switch' on"
cset "name='Pin7-Port0 Mux' 3"
]
DisableSequence [
cdev "hw:sofsklhdacard"
cset "name='Pin7-Port0 Mux' 0"
cset "name='hif7-0 Jack Switch' off"
]
Value {
PlaybackPCM "hw:0,5"
PlaybackChannels "2"
JackControl "HDMI/DP, pcm=13 Jack"
}
}
EOT
echo finished creating /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------
echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf ------
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf
SectionUseCase."HiFi" {
File "HiFi.conf"
Comment "Play HiFi quality Music"
}
EOT
echo finished creating /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf -------
echo "Reboot and run alsamixer. Use F6 to select the sound card and F4 to go to Capture, then turn all of the channels up to 100"
echo "If there is no sound card detected, ‘dmesg | grep sof’ can be used to see what went wrong"
@cdcastro

This comment has been minimized.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Oct 15, 2019

actually we might need to host that elsewhere, I wasn't hosting that and now it's not available.
updated.

@cdcastro

This comment has been minimized.

Copy link

@cdcastro cdcastro commented Oct 15, 2019

@hamidzr, I saw you changed the file link. Thank you very much.

Now i have a problem :) I'm running Ubuntu 18.04 and after run your script, I've no sound at all :(

Do you have some advice?

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Oct 15, 2019

I've only tested this on 64bit x86 Arch. Reversing the process should be simple but would have some manual work. just go through the steps in reverse? I'm only automating someone else's work on Arch.

@EBoisseauSierra

This comment has been minimized.

Copy link

@EBoisseauSierra EBoisseauSierra commented Oct 16, 2019

I've had the same issue as @cdcastro on Fedora 30 (Linux x1 5.3.6-200.fc30.x86_64): no sound card was detected at all.

$ dmesg | grep sof
[   16.888911] sof-audio-pci 0000:00:1f.3: warning: No matching ASoC machine driver found
[   16.888917] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   16.889020] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[   16.893330] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   16.897091] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
[   16.897092] sof-audio-pci 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[   16.916602] sof-audio-pci 0000:00:1f.3: unexpected ipc interrupt raised!
[   16.916603] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[   19.982061] sof-audio-pci 0000:00:1f.3: error: load fw failed ret: -110
[   19.982086] sof-audio-pci 0000:00:1f.3: error: status = 0x0000002c panic = 0x00000000
[   19.982102] sof-audio-pci 0000:00:1f.3: error: failed to reset DSP
[   19.982103] sof-audio-pci 0000:00:1f.3: error: failed to boot DSP firmware -110
[   19.982103] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -110

Screenshot from 2019-10-16 12-41-53

To revert the effect, I've found that simply deleting/commenting out /etc/modprobe.d/blacklist.conf (+ restart) does the job. Doesn't solve the mic issue, though…

@PaulVanSchayck

This comment has been minimized.

Copy link

@PaulVanSchayck PaulVanSchayck commented Oct 20, 2019

So.. on Ubuntu 19.10, with the 5.3.0-18-generic kernel I'm getting this after following these instructions:

$ dmesg | grep sof
[   10.067961] sof-audio-pci 0000:00:1f.3: warning: No matching ASoC machine driver found
[   10.067965] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   10.068296] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[   10.073342] sof-audio-pci 0000:00:1f.3: No ASoC machine driver found - using nocodec
[   10.081756] sof-audio-pci 0000:00:1f.3: unexpected ipc interrupt raised!
[   10.081758] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[   10.164686] sof-audio-pci 0000:00:1f.3: Firmware info: version 1:1:0-5dd9a
[   10.164688] sof-audio-pci 0000:00:1f.3: Firmware: ABI 3:7:0 Kernel ABI 3:8:0
[   10.164932] sof-audio-pci 0000:00:1f.3: firmware boot complete
[   10.167303] sof-audio-pci 0000:00:1f.3: Direct firmware load for intel/sof-tplg/sof-cnl-nocodec.tplg failed with error -2

From reading elsewhere, I suspect that it's loading the nocodec machine driver, when it shouldn't. I don't know how to fix this.

I'm starting to suspect, from reading this SOF issue, that this stock Ubuntu 19.10 is kernel missing these two kernel options: CONFIG_SND_SOC_SOF_HDA_LINK=y and CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC=y.

$ grep CONFIG_SND_SOC_SOF_HDA config-5.3.0-18-generic 
CONFIG_SND_SOC_SOF_HDA_COMMON=m
CONFIG_SND_SOC_SOF_HDA_LINK_BASELINE=m
@hsanjuan

This comment has been minimized.

Copy link

@hsanjuan hsanjuan commented Oct 20, 2019

Mind there is a typo here: https://gist.github.com/hamidzr/dd81e429dc86f4327ded7a2030e7d7d9#file-sof-audio-setup-carbonx1-sh-L58

Also, it should probably create the folder /usr/share/alsa/ucm/sof-skl_hda_card/

and re-running the script will append the content again to already created files which only break things.

Other than that, this works well for OpenSUSE.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Oct 20, 2019

@hsanjuan

Mind there is a typo here: https://gist.github.com/hamidzr/dd81e429dc86f4327ded7a2030e7d7d9#file-sof-audio-setup-carbonx1-sh-L58

Also, it should probably create the folder /usr/share/alsa/ucm/sof-skl_hda_card/

and re-running the script will append the content again to already created files which only break things.

Other than that, this works well for OpenSUSE.

Thanks for catching those. I updated the script and also added some description.

@DesmondZhong

This comment has been minimized.

Copy link

@DesmondZhong DesmondZhong commented Nov 16, 2019

@hamidzr

I use the latest Arch and after running the script (and try the method in the forum back and forth several times), I notice there's no output of "dmesg | grep sof". It seems that the sof firmware is not loaded at all. I must have missed something. Do you have any idea of why this is happening?

Thanks!

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Nov 17, 2019

I have also lost the microphone with recent updates (on Arch). I haven't had a chance to look into it yet. Let me know if you find something

@DesmondZhong

This comment has been minimized.

Copy link

@DesmondZhong DesmondZhong commented Nov 18, 2019

It's good to know that it's because of recent updates. I haven't found anything related yet. I'll keep you posted if I do. Thanks!

@EBoisseauSierra

This comment has been minimized.

Copy link

@EBoisseauSierra EBoisseauSierra commented Nov 18, 2019

@DesmondZhong you're aware of the dedicated thread on Lenovo's forums, right?

@DesmondZhong

This comment has been minimized.

Copy link

@DesmondZhong DesmondZhong commented Nov 20, 2019

@EBoisseauSierra Yes, I mainly focused on the thread you mentioned and this thread in Archlinux forum.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Dec 6, 2019

I've made some fixes:

  1. curl needs -L to follow the redirect otherwise it downloads just an html file instead of the firmware
  2. sof-hda-generic-4ch.tplg must be symlinked to sof-hda-generic.tplg
#!/bin/bash

## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823

# Prereq: Install Linux 5.3 or newer

# NOTE: run this script as root and at your own risk.


echo Copy https://github.com/thesofproject/sof/releases/download/v1.3/sof-cnl-signed-intel.ri to /lib/firmware/intel/sof/ as sof-cnl.ri
mkdir -p /lib/firmware/intel/sof/
curl -L https://github.com/thesofproject/sof/releases/download/v1.3/sof-cnl-signed-intel.ri -o /lib/firmware/intel/sof/sof-cnl.ri

echo Copy https://github.hamidzare.xyz/dl/sof-hda-generic.tplg to /lib/firmware/intel/sof-tplg/ as sof-hda-generic-4ch.tplg
mkdir -p /lib/firmware/intel/sof-tplg/
curl -L https://github.hamidzare.xyz/dl/sof-hda-generic.tplg -o /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg
ln -s /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg /lib/firmware/intel/sof-tplg/sof-hda-generic.tplg

echo creating file /etc/modprobe.d/alsa-base.conf  ------

cat <<EOT >> /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 being loaded as first soundcard
options snd-usb-audio index=-2
EOT
 
echo finished creating  /etc/modprobe.d/alsa_base.conf  ------


echo creating file /etc/modprobe.d/blacklist.conf  -------
cat <<EOT >> /etc/modprobe.d/blacklist.conf
blacklist snd_hda_intel
blacklist snd_soc_skl
EOT
echo finished creating  /etc/modprobe.d/blacklist.conf  -------

echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------
mkdir -p /usr/share/alsa/ucm/sof-skl_hda_card
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf
# Use case Configuration for skl-hda-card
SectionVerb {
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Master Playback Switch' on"
  cset "name='Capture Switch' on"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
}
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"
  PlaybackChannels "2"
  JackName "sof-skl_hda_card Headphone"
  JackType "gpio"
  JackSwitch "12"
  JackControl "Headphone Jack"
 }
}
SectionDevice."Speaker" {
 Comment "Speaker"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Speaker Playback Switch' on"
 ]
 DisableSequence [
  cset "name='Speaker Playback Switch' off"
 ]
 Value {
  PlaybackPCM "hw:sofsklhdacard,0"
  JackHWMute "Headphone"
  PlaybackChannels "2"
 }
}
SectionDevice."Headset" {
 Comment "Headset Mic"
 ConflictingDevice [
  "DMIC Stereo"
 ]
 EnableSequence [
  cdev "hw:sofsklhdacard"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
 Value {
  CapturePCM "hw:0,0"
  CaptureChannels "2"
  JackControl "Mic Jack"
 }
}
SectionDevice."Dmic" {
 Comment "DMIC Stereo"
 ConflictingDevice [
  "Headset Mic"
 ]
 EnableSequence [
  cdev "hw:sofsklhdacard"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
 Value {
  CapturePCM "hw:0,6"
  CaptureChannels "2"
 }
}
SectionDevice."HDMI1" {
 Comment "HDMI1/DP1 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif5-0 Jack Switch' on"
  cset "name='Pin5-Port0 Mux' 1"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin5-Port0 Mux' 0"
  cset "name='hif5-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,3"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=11 Jack"
 }
}
SectionDevice."HDMI2" {
 Comment "HDMI2/DP2 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif6-0 Jack Switch' on"
  cset "name='Pin6-Port0 Mux' 2"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin6-Port0 Mux' 0"
  cset "name='hif6-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,4"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=12 Jack"
 }
}
SectionDevice."HDMI3" {
 Comment "HDMI3/DP3 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif7-0 Jack Switch' on"
  cset "name='Pin7-Port0 Mux' 3"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin7-Port0 Mux' 0"
  cset "name='hif7-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,5"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=13 Jack"
 }
}
EOT
echo finished creating  /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------

echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf ------
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf
SectionUseCase."HiFi" {
 File "HiFi.conf"
 Comment "Play HiFi quality Music"
}
EOT
echo finished creating  /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf   -------


echo "Reboot and run alsamixer. Use F6 to select the sound card and F4 to go to Capture, then turn all of the channels up to 100"

echo "If there is no sound card detected, ‘dmesg | grep sof’ can be used to see what went wrong"
@hsanjuan

This comment has been minimized.

Copy link

@hsanjuan hsanjuan commented Dec 6, 2019

You may also start using release 1.4.1 firmware.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Dec 6, 2019

i cannot find the intel signed one, which i don't really know if it's needed.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Dec 6, 2019

@paolomainardi thanks I'll review it and add the changes in

@hsanjuan

This comment has been minimized.

Copy link

@hsanjuan hsanjuan commented Dec 6, 2019

@paolomainardi the ones here https://github.com/thesofproject/sof/releases are signed (even if name does not say)

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Dec 7, 2019

thanks @hsanjuan and @paolomainardi. I added the changes and tested it on my machine both mic and speakers work.
Arch Linux. Kernel 5.4.2

dmesg | grep sof

[    0.987352] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    1.495284] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    1.495287] software IO TLB: mapped [mem 0x6226a000-0x6626a000] (64MB)
[   16.262129] sof-audio-pci 0000:00:1f.3: warning: No matching ASoC machine driver found
[   16.262138] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   16.262322] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[   16.262485] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   16.270882] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
[   16.270884] sof-audio-pci 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[   16.377914] sof-audio-pci 0000:00:1f.3: unexpected ipc interrupt raised!
[   16.377917] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[   16.480137] sof-audio-pci 0000:00:1f.3: Firmware info: version 1:1:0-fcf6c
[   16.480139] sof-audio-pci 0000:00:1f.3: Firmware: ABI 3:11:0 Kernel ABI 3:10:0
[   16.480140] sof-audio-pci 0000:00:1f.3: warn: FW ABI is more recent than kernel
[   16.480509] sof-audio-pci 0000:00:1f.3: firmware boot complete
[   16.487680] sof-audio-pci 0000:00:1f.3: Topology: ABI 3:7:0 Kernel ABI 3:10:0
[   16.487686] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp3 Tx not handled
[   16.488640] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec0_in not handled
[   16.488644] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp2 Tx not handled
[   16.489555] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec1_in not handled
[   16.489557] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp1 Tx not handled
[   16.490624] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec0_out not handled
[   16.490627] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Analog CPU Playback not handled
[   16.491549] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec1_out not handled
[   16.491552] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Digital CPU Playback not handled
[   16.491554] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec2_in not handled
[   16.491556] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Alt Analog CPU Playback not handled
[   16.491557] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec2_out not handled
[   16.491559] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Analog CPU Capture not handled
[   16.492484] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp1_out not handled
[   16.492487] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Digital CPU Capture not handled
[   16.493445] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp2_out not handled
[   16.493449] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Alt Analog CPU Capture not handled
[   16.494418] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp3_out not handled
[   16.502580] sof-audio-pci 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred
[   16.573601] input: sof-skl_hda_card Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input15
[   16.573648] input: sof-skl_hda_card Headphone as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input16
[   16.573688] input: sof-skl_hda_card HDMI/DP, pcm=11 Jack as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input17
[   16.573727] input: sof-skl_hda_card HDMI/DP, pcm=12 Jack as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input18
[   16.573765] input: sof-skl_hda_card HDMI/DP, pcm=13 Jack as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input19
[   26.799801] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[   26.897603] sof-audio-pci 0000:00:1f.3: firmware boot complete
[  349.312055] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[  349.409156] sof-audio-pci 0000:00:1f.3: firmware boot complete
@dadosch

This comment has been minimized.

Copy link

@dadosch dadosch commented Dec 7, 2019

does the mic work properly or does the sound recorded sound "like in slow-motion"? Also, is 4.0 / 4.1 sound detected (or only 2.0 stereo)? @hamidzr

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Dec 7, 2019

They work both but just bottom stereo speaker gets detected.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Dec 7, 2019

Anyway just to add all the info, I’m testing it on Ubuntu 18.04 LTS with the standard 5.3 kernel.

@MfCrizz

This comment has been minimized.

Copy link

@MfCrizz MfCrizz commented Dec 8, 2019

Thank you, the script and sound is working on Linux Mint 19.2 with kernel 5.3.0-24.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Dec 9, 2019

Upgraded to 1.4.1 and everything is working fine, now is there a way to configure also the other speakers as well ? RIght now i can see just the 2 bottom ones.

@yunjae2

This comment has been minimized.

Copy link

@yunjae2 yunjae2 commented Dec 10, 2019

Speaker and mic works properly on 19.10 with 5.3 kernel.

@yunjae2

This comment has been minimized.

Copy link

@yunjae2 yunjae2 commented Dec 10, 2019

But I can see only two front speakers in the sound option.

@Tbaut

This comment has been minimized.

Copy link

@Tbaut Tbaut commented Dec 20, 2019

Thank you so much for the script. I did manually each step and I get the mic and audio working well on Linux Mint 19.2 using kernel 5.4.5

@Tbaut

This comment has been minimized.

Copy link

@Tbaut Tbaut commented Dec 20, 2019

One thing I realized is that the keyboard LED that indicated if mic or sound are muted don't work any more. (on the F2 and F4 keys). Not a hug deal though.

@kopax

This comment has been minimized.

Copy link

@kopax kopax commented Dec 22, 2019

Hi, I have a x1c7 and I want to get my microphone working. I see that there is updated snippet in the comment, which one should I take? Is the first one updated? I took the last one.

Was it safe to run on Debian buster? I did it and I have both microphone and speaker working, thanks!

They work both but just bottom stereo speaker gets detected.

@paolomainardi Does the version I have installed also include that bug ?

@ Thanks and merry xmas!

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Dec 23, 2019

@kopax I have included any fixes or updates people posted here. Happy holidays

@frade

This comment has been minimized.

Copy link

@frade frade commented Dec 23, 2019

@kopax

This comment has been minimized.

Copy link

@kopax kopax commented Dec 23, 2019

Thanls all for the quick reply, I confirm it is OK, is this the expected startup logs?

Dec 23 10:56:55 dka kernel: [   41.183136] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
Dec 23 10:56:55 dka kernel: [   41.277948] sof-audio-pci 0000:00:1f.3: firmware boot complete
@ulises-castro

This comment has been minimized.

Copy link

@ulises-castro ulises-castro commented Dec 23, 2019

Thanks all man, it's works in Pop os 19.10 (Ubuntu 19.10).

@tjkopena

This comment has been minimized.

Copy link

@tjkopena tjkopena commented Jan 1, 2020

Running this script fixed the mic, speakers (bass and regular), and headphones on my Lenovo Carbon X1 7th (Fedora 31 5.5.0-0.rc4.git0.1.vanilla.knurd.1.fc31.x86, pulseaudio 13.0-97-gcdcb, alsa-lib-1.2.1.2-4.fc31).

I had previously not gotten mic+speakers to work following the linked manual instructions some time ago. Installing the packages in this RH bug report enabled them briefly, but a subsequent regular dnf upgrade broke everything again, this time including headphones. Issue did not seem to be simply that PulseAudio reverted. Running this script restored all functionality.

Thanks!

@akvadrako

This comment has been minimized.

Copy link

@akvadrako akvadrako commented Jan 2, 2020

I've followed these instructions on Ubuntu and my speakers + mic almost work. The only problem is pitch is too high. Should I adjust the sample rate somewhere?

@cdysthe

This comment has been minimized.

Copy link

@cdysthe cdysthe commented Jan 2, 2020

The script fixed my audio problems on Ubuntu 19.10. One question, the devices have very long names like "sof-skl_hda_card Speaker + Headphones". Is there a way to get the names shorter and more readable? I use an output switcher and the names are so long that all they are cut off and look the same.

@Markuzcha

This comment has been minimized.

Copy link

@Markuzcha Markuzcha commented Jan 8, 2020

Thank you for the script. It works pretty well for my X1Y4 in Manjaro (Gnome, non-free drivers), except for one issue I am having big trouble with.
I also would like to propose to change the "cat <<EOT >>" lines to "cat <<EOT >", so the script can be repeatedly executed.

Here's my issue I hope somebody can help me with:
When I use my headphones connected to the audio jack and hear audio with certain sounds like male (i.e. deep) voices or sudden deep sounds in general (volume set to 30-100%) it causes annoying click (or crackling, popping) sounds at the beginning and the end of each of the sounds. The best example to reproduce is the beginning of this test video: https://youtu.be/2ZrWHtvSog4 (Youtube: "1-Minute Audio Test for Stereo Speakers & Headphones").
Even with the internal speakers the click sound is hearable, but it is much lower and doesn't bother.

Before I executed this script the click sounds were even worse and occured also during volume changes, they got even summarized when I played several videos at the same time in YouTube for instance.
I tried in a Live USB stick for Windows 10 (using WinToUSB) if the hardware was okay and I was glad to see that the click sound there was hardly hearable so it didn't bother.

I'm pretty sure I'm not the only one having this issue.
Any help is appreciated. If you need further HW info please ask.

@sagi

This comment has been minimized.

Copy link

@sagi sagi commented Jan 8, 2020

The script works out of the box for Ubuntu 19.10 with kernel 5.3.0-26-generic.

For posterity, here's the script I used:

#!/bin/bash

## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823

# Prereq: Install Linux 5.3 or newer

# NOTE: run this script as root and at your own risk.

firmware_version=v1.4.1

echo Copy https://github.com/thesofproject/sof/releases/download/${firmware_version}/sof-cnl-${firmware_version}.ri to /lib/firmware/intel/sof/ as sof-cnl.ri
mkdir -p /lib/firmware/intel/sof/
curl -L https://github.com/thesofproject/sof/releases/download/${firmware_version}/sof-cnl-${firmware_version}.ri -o /lib/firmware/intel/sof/sof-cnl.ri

echo Copy https://github.hamidzare.xyz/dl/sof-hda-generic.tplg to /lib/firmware/intel/sof-tplg/ as sof-hda-generic-4ch.tplg
mkdir -p /lib/firmware/intel/sof-tplg/
curl -L https://github.hamidzare.xyz/dl/sof-hda-generic.tplg -o /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg
ln -s /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg /lib/firmware/intel/sof-tplg/sof-hda-generic.tplg

echo creating file /etc/modprobe.d/alsa-base.conf  ------

cat <<EOT >> /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 being loaded as first soundcard
options snd-usb-audio index=-2
EOT
 
echo finished creating  /etc/modprobe.d/alsa_base.conf  ------


echo creating file /etc/modprobe.d/blacklist.conf  -------
cat <<EOT >> /etc/modprobe.d/blacklist.conf
blacklist snd_hda_intel
blacklist snd_soc_skl
EOT
echo finished creating  /etc/modprobe.d/blacklist.conf  -------

echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------
mkdir -p /usr/share/alsa/ucm/sof-skl_hda_card
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf
# Use case Configuration for skl-hda-card
SectionVerb {
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Master Playback Switch' on"
  cset "name='Capture Switch' on"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
}
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"
  PlaybackChannels "2"
  JackName "sof-skl_hda_card Headphone"
  JackType "gpio"
  JackSwitch "12"
  JackControl "Headphone Jack"
 }
}
SectionDevice."Speaker" {
 Comment "Speaker"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Speaker Playback Switch' on"
 ]
 DisableSequence [
  cset "name='Speaker Playback Switch' off"
 ]
 Value {
  PlaybackPCM "hw:sofsklhdacard,0"
  JackHWMute "Headphone"
  PlaybackChannels "2"
 }
}
SectionDevice."Headset" {
 Comment "Headset Mic"
 ConflictingDevice [
  "DMIC Stereo"
 ]
 EnableSequence [
  cdev "hw:sofsklhdacard"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
 Value {
  CapturePCM "hw:0,0"
  CaptureChannels "2"
  JackControl "Mic Jack"
 }
}
SectionDevice."Dmic" {
 Comment "DMIC Stereo"
 ConflictingDevice [
  "Headset Mic"
 ]
 EnableSequence [
  cdev "hw:sofsklhdacard"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
 ]
 Value {
  CapturePCM "hw:0,6"
  CaptureChannels "2"
 }
}
SectionDevice."HDMI1" {
 Comment "HDMI1/DP1 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif5-0 Jack Switch' on"
  cset "name='Pin5-Port0 Mux' 1"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin5-Port0 Mux' 0"
  cset "name='hif5-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,3"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=11 Jack"
 }
}
SectionDevice."HDMI2" {
 Comment "HDMI2/DP2 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif6-0 Jack Switch' on"
  cset "name='Pin6-Port0 Mux' 2"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin6-Port0 Mux' 0"
  cset "name='hif6-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,4"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=12 Jack"
 }
}
SectionDevice."HDMI3" {
 Comment "HDMI3/DP3 Output"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='hif7-0 Jack Switch' on"
  cset "name='Pin7-Port0 Mux' 3"
 ]
 DisableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Pin7-Port0 Mux' 0"
  cset "name='hif7-0 Jack Switch' off"
 ]
 Value {
  PlaybackPCM "hw:0,5"
  PlaybackChannels "2"
  JackControl "HDMI/DP, pcm=13 Jack"
 }
}
EOT
echo finished creating  /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf -------

echo creating file /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf ------
cat <<EOT >> /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf
SectionUseCase."HiFi" {
 File "HiFi.conf"
 Comment "Play HiFi quality Music"
}
EOT
echo finished creating  /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf   -------


echo "Reboot and run alsamixer. Use F6 to select the sound card and F4 to go to Capture, then turn all of the channels up to 100"

echo "If there is no sound card detected, ‘dmesg | grep sof’ can be used to see what went wrong"
@haogroot

This comment has been minimized.

Copy link

@haogroot haogroot commented Jan 11, 2020

Thank you! This script is working. I am using Ubuntu 19.10 with kernel 5.3.0-26-generic.

But after rebooting, I have to switch output device to Speaker Cannon Point-LP High Definition Audio Controller. (after reboot, default is HDMI3/DP3 Output)
Also the microphone sound is too low, but I use alsamixer to adjust and all is good for me now.

@ulises-castro

This comment has been minimized.

Copy link

@ulises-castro ulises-castro commented Jan 11, 2020

Same for me, always when i disconnect via Bluetooth "HDMI3/DP4 Output" it was selected and i have to change manually to speaks output.
Also when connect to Bluetooth device i have to select to speaks and then select the Bluetooth device again and then it can works.

Also my microphone sound is too low..

My computer: Lenovo Carbon x1 Gen 7, i7 u10710
O.S = Pop os 19.10 (Based on Ubuntu 19.10)

@paulocosta-gmu

This comment has been minimized.

Copy link

@paulocosta-gmu paulocosta-gmu commented Jan 11, 2020

Thank you. This has been a major drawback of an otherwise awesome notebook.
I do have the same configuration and issues of ulises-castro and others above. Pop_OS 19.10, gen 7, 16gb, and have been getting this after a boot:

  • default speaker is "HDMI3/DP4 Output" regardless of what default sink I set in /etc/pulse/defaults.pa
  • very low microphone sound
  • same bluetooth issues
    I tried to edit various settings, all to no avail.
    No big deal, since I can manually fix in alsamixer, but somewhat still a minor annoyance.
    Any hints would be quite welcomed!
@rwlove

This comment has been minimized.

Copy link

@rwlove rwlove commented Jan 11, 2020

Does anyone have all 4 audio channels working? On my system (Ubuntu 19.10) the script only enables the bottom two speakers and not the top ones (near the hinges).

@paulocosta-gmu

This comment has been minimized.

Copy link

@paulocosta-gmu paulocosta-gmu commented Jan 11, 2020

Thanks for reminding, rwlove. I did forget to mention that, in addition to the issues above, I only get two speakers working.

@hsanjuan

This comment has been minimized.

Copy link

@hsanjuan hsanjuan commented Jan 12, 2020

hey all,

FYI:

  • Latest version of alsa (1.2.1.2) include the necessary UCM files https://github.com/alsa-project/alsa-ucm-conf/tree/master/ucm2/sof-hda-dsp (which I think include fixes over what was originally provided).
  • The 5.4.x kernel releases have been giving me lots of trouble with SOF v1.4.1. 5.5.0-rc5 works a little bit better. Mics works and 4 speakers produce sound. HDMI seems to not work (dissapeared from lists).
  • 5.5.x renames sof-skl_hda_card to sof-hda-dsp which means it won't pick up the UCM in this script anymore and things will break if using the new kernels but not the newer alsa ucm files.
@d-rowe

This comment has been minimized.

Copy link

@d-rowe d-rowe commented Jan 12, 2020

Working great on Manjaro (5.4.6). Thanks @hamidzr!

@drejohnson

This comment has been minimized.

Copy link

@drejohnson drejohnson commented Jan 17, 2020

Just tried this on a fresh Manjaro (5.4.12) install configured with Architect and now no soundcard detected

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Jan 17, 2020

Just tried this on a fresh Manjaro (5.4.12) install configured with Architect and now no soundcard detected

To reverse the effect you can probably just remove the two lines that the script adds from /etc/modprobe.d/blacklist.conf to reverse the effect. If that doesn't work the steps should be easily reversible following the script.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 17, 2020

I agree, just did the manjaro update today and now the sound card is not recognized anymore.
It worked very well before the update.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 17, 2020

~ >>> sudo dmesg| grep sof                                                                                                                                                                                                                 
[sudo] password for alexxx: 
[    1.593383] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    1.593385] software IO TLB: mapped [mem 0x61701000-0x65701000] (64MB)
[    9.988150] uvcvideo 1-8:1.2: Entity type for entity Microsoft Extended Controls Uni was not initialized!
[   10.562029] sof-audio-pci 0000:00:1f.3: warning: No matching ASoC machine driver found
[   10.562037] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   10.562203] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[   10.562930] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   10.572047] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
[   10.572048] sof-audio-pci 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[   10.623377] sof-audio-pci 0000:00:1f.3: unexpected ipc interrupt raised!
[   10.623379] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[   10.709346] sof-audio-pci 0000:00:1f.3: Firmware info: version 1:1:0-fcf6c
[   10.709347] sof-audio-pci 0000:00:1f.3: Firmware: ABI 3:11:0 Kernel ABI 3:10:0
[   10.709348] sof-audio-pci 0000:00:1f.3: warn: FW ABI is more recent than kernel
[   10.709589] sof-audio-pci 0000:00:1f.3: firmware boot complete
[   10.712815] sof-audio-pci 0000:00:1f.3: Topology: ABI 3:7:0 Kernel ABI 3:10:0
[   10.712818] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp3 Tx not handled
[   10.713412] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec0_in not handled
[   10.713413] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp2 Tx not handled
[   10.713984] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec1_in not handled
[   10.713985] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp1 Tx not handled
[   10.714614] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec0_out not handled
[   10.714616] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Analog CPU Playback not handled
[   10.715244] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec1_out not handled
[   10.715245] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Digital CPU Playback not handled
[   10.715246] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec2_in not handled
[   10.715247] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name Alt Analog CPU Playback not handled
[   10.715248] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name codec2_out not handled
[   10.715249] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Analog CPU Capture not handled
[   10.715843] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp1_out not handled
[   10.715844] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Digital CPU Capture not handled
[   10.716465] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp2_out not handled
[   10.716466] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name Alt Analog CPU Capture not handled
[   10.717188] sof-audio-pci 0000:00:1f.3: warning: widget type 1 name iDisp3_out not handled
[   10.726252] sof-audio-pci 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred
[   10.779445] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sof-skl_hda_card late_probe() failed: -22

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 17, 2020

Reverting to kernel 5.4.6 fixed the issue :

$ /var/cache/pacman/pkg
$ sudo pacman -U  linux54-5.4.6-2-x86_64.pkg.tar.xz linux54-headers-5.4.6-2-x86_64.pkg.tar.xz

The latest 5.4.12 introduce an incompatibility with the sof driver I guess.

@pswu11

This comment has been minimized.

Copy link

@pswu11 pswu11 commented Jan 24, 2020

Thank you! I used this script to fix my issue too.
Setup:
Fedora 31, Carbon X1C7
Note:
It works with kernel 5.3.7, however when upgraded to 5.4.10 or 5.4.12 the fix is then broken.
I am currently staying with 5.3.7.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 24, 2020

Kernel 5.5 on Arch is working fine for the record.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Jan 25, 2020

@zaggash do you mean with or without this patch ?

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 25, 2020

Kernel 5.5 with the patch 🤭

@Markuzcha

This comment has been minimized.

Copy link

@Markuzcha Markuzcha commented Jan 25, 2020

Thank you for the script. It works pretty well for my X1Y4 in Manjaro (Gnome, non-free drivers), except for one issue I am having big trouble with.
I also would like to propose to change the "cat <>" lines to "cat <", so the script can be repeatedly executed.

Here's my issue I hope somebody can help me with:
When I use my headphones connected to the audio jack and hear audio with certain sounds like male (i.e. deep) voices or sudden deep sounds in general (volume set to 30-100%) it causes annoying click (or crackling, popping) sounds at the beginning and the end of each of the sounds. The best example to reproduce is the beginning of this test video: https://youtu.be/2ZrWHtvSog4 (Youtube: "1-Minute Audio Test for Stereo Speakers & Headphones").
Even with the internal speakers the click sound is hearable, but it is much lower and doesn't bother.

Before I executed this script the click sounds were even worse and occured also during volume changes, they got even summarized when I played several videos at the same time in YouTube for instance.
I tried in a Live USB stick for Windows 10 (using WinToUSB) if the hardware was okay and I was glad to see that the click sound there was hardly hearable so it didn't bother.

I'm pretty sure I'm not the only one having this issue.
Any help is appreciated. If you need further HW info please ask.

I got these annoying click/pop sounds fixed ! :-)

I created a script in /usr/local/bin/clicksoundfix.sh
#!/bin/bash
hda-verb /dev/snd/hwC0D0 0x1d SET_PIN_WIDGET_CONTROL 0x0

sudo chmod +x /usr/local/bin/clicksoundfix.sh
running it as sudo fixes immediately.

then, to make it persistent after reboots,
sudo crontab -e
enter:
@reboot sleep 10s; /usr/local/bin/clicksoundfix.sh

and to make it persistent after sleep mode

ln -s /usr/local/bin/clicksoundfix.sh /lib/systemd/system-sleep/

Source:
https://bugzilla.redhat.com/show_bug.cgi?id=1660581
(comment 8)

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 27, 2020

Am I the only one with X1C7 that experience bad quality sound.
So with the script it is working but the sound it not deep, like there is no bass.

@yunjae2

This comment has been minimized.

Copy link

@yunjae2 yunjae2 commented Jan 29, 2020

Am I the only one with X1C7 that experience bad quality sound.
So with the script it is working but the sound it not deep, like there is no bass.

Same here.
Seems like only front speakers are working.

@dadosch

This comment has been minimized.

Copy link

@dadosch dadosch commented Jan 29, 2020

Am I the only one with X1C7 that experience bad quality sound.
So with the script it is working but the sound it not deep, like there is no bass.

Same here.
Seems like only front speakers are working.

Try setting your speaker to 2.0 or 4.0 sound. Also try to change the volume of the rear speakers. You can do that for example in pavucontrol

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 29, 2020

I actually already tried the following changes:

In /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf

SectionDevice."Speaker" {
 Comment "Speaker"
 EnableSequence [
  cdev "hw:sofsklhdacard"
  cset "name='Speaker Playback Switch' on"
 ]
 DisableSequence [
  cset "name='Speaker Playback Switch' off"
 ]
 Value {
  PlaybackPCM "hw:sofsklhdacard,0"
  JackHWMute "Headphone"
  PlaybackChannels "2"
 }
}

Tried to change PlaybackChannels "2" to PlaybackChannels "4"
Nothing changed, the sound still work the same way.

Using alsamixer, like in the script output, selecting the card and then raising all the volumes to the max didn't help either.

@akvadrako

This comment has been minimized.

Copy link

@akvadrako akvadrako commented Jan 29, 2020

@dadosch Are you using the script above? I am and I have no controls for changing between 2.0 and 4.0. The only available profile is "Play HiFi quality Music" and it's two channels. For me all 4 speakers are working.

My suggestion to @zaggash is to run alsamixer and check that the bass isn't muted.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 29, 2020

@yunjae2
Check if you have sof-firmware and alsa-ucm-conf installed.
Then after you applied the script, replace :
/usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf by /usr/share/alsa/ucm2/sof-hda-dsp/HiFi.conf
/usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf by /usr/share/alsa/ucm2/sof-hda-dsp/sof-hda-dsp.conf

$ sudo cp -f /usr/share/alsa/ucm2/sof-hda-dsp/HiFi.conf /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf
$ sudo cp -f /usr/share/alsa/ucm2/sof-hda-dsp/sof-hda-dsp.conf /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf

reboot
Let me know what you feel about the sound after.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Jan 29, 2020

Note that if you have Alsa 1.2.1, you should be able to download everything needed from ftp://ftp.alsa-project.org/pub/misc/sof/ which contains both the firmwares, the UCM files and the topology files. I didn't test it yet myself.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 29, 2020

The thing is with arch you can download this through pacman.

$ sudo pacman -Ss alsa-ucm-conf
extra/alsa-ucm-conf 1.2.1.2-1 [installed]
$ sudo pacman -Ss sof-firmware 
extra/sof-firmware 1.4.2-1 [installed]

But doing so, alsa is starting correctly but pulseaudio failed to find the ucm config for some reason and do not load.

@yunjae2

This comment has been minimized.

Copy link

@yunjae2 yunjae2 commented Jan 29, 2020

@zaggash
I can't find /usr/share/alsa/ucm2 folder :(
I'm using Ubuntu 19.10 with 5.3.0-29-generic kernel.

Is there any quick way to check if the sof-firmware and alsa-ucm-conf are installed on Ubuntu?
I have checked the files the script modifies, and they all look fine.

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Jan 29, 2020

On ubuntu I think the UCM files are installed as part of alsa-lib through the libasound2-data dependency.
https://packages.ubuntu.com/eoan/all/libasound2-data/filelist
For some reason version 1.2.x is not available yet on Ubuntu.

Interesting update is https://www.alsa-project.org/wiki/Detailed_changes_v1.1.9_v1.2.1#Changelog_between_1.0.29_and_1.2.1_releases_2

  • merge config for Lenovo Carbon X1 7th gen to main HiFi.conf

But I do not know why when installed, the ucm2 files are not found by pulseaudio.
I searched a few hours this afternoon with no result.

Here is the issue I ran into if someone is passing by and have an idea, I take it:

pulseaudio[30048]: E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
anv. 29 14:48:10 X1-Carbon pulseaudio[30048]: E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
janv. 29 14:48:10 X1-Carbon pulseaudio[30048]: E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="pci-0000_00_1f.3-platform-skl_hda_dsp_generic" card_name="alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
janv. 29 14:48:10 X1-Carbon pulseaudio[30048]: W: [pulseaudio] module-udev-detect.c: Tried to configure /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0 (alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic) more often than 5 times in 10s

The sof driver 1.4.1 is loaded and detected but I have no sound because of the issue above, just the dummy output !

@tjkopena

This comment has been minimized.

Copy link

@tjkopena tjkopena commented Jan 30, 2020

Fedora 31, sound & mic were working after applying this script, but updating to kernel 5.6 just broke both. Switching back to 5.5 (5.5.0-0.rc6.git1.1.vanilla.knurd.1.fc31.x86_64) returned sound & mic.

@srwareham

This comment has been minimized.

Copy link

@srwareham srwareham commented Jan 30, 2020

@zaggash @yunjae2 I am also having the same terrible sound quality on my x1 carbon gen 7. After running this script on linux 5.5 with manjaro, I at least have sound when I didn't before. Looking in alsamixer, it seems the bass is entirely undetected:

image

Perhaps relatedly, I am only able to see "Front Left" and "Front Right" and there is no option to switch to 4 channels, which did fully work on previous kernels without this patch.

Here's my dmesg if interesting: https://pastebin.com/zWKRGFYS

The microphone works quite well, however.

@moreka

This comment has been minimized.

Copy link

@moreka moreka commented Feb 3, 2020

@zaggash @yunjae2 I am also having the same terrible sound quality on my x1 carbon gen 7. After running this script on linux 5.5 with manjaro, I at least have sound when I didn't before. Looking in alsamixer, it seems the bass is entirely undetected:

image

Perhaps relatedly, I am only able to see "Front Left" and "Front Right" and there is no option to switch to 4 channels, which did fully work on previous kernels without this patch.

Here's my dmesg if interesting: https://pastebin.com/zWKRGFYS

The microphone works quite well, however.

I also have the exact same issue on my Thinkpad X1 Carbon 7th gen. It's been a huge headache...
I tried to force pulseaudio to use 4 channels (in default.pa), no progress.
I guess the problem is either in UCM files or in the topology file, but I have no idea how to work on those files.
(I'm on 5.5 kernel as well, having sof-firmware 1.4.2; running Arch)

@yunjae2

This comment has been minimized.

Copy link

@yunjae2 yunjae2 commented Feb 3, 2020

On ubuntu I think the UCM files are installed as part of alsa-lib through the libasound2-data dependency.
https://packages.ubuntu.com/eoan/all/libasound2-data/filelist
For some reason version 1.2.x is not available yet on Ubuntu.

Interesting update is https://www.alsa-project.org/wiki/Detailed_changes_v1.1.9_v1.2.1#Changelog_between_1.0.29_and_1.2.1_releases_2

  • merge config for Lenovo Carbon X1 7th gen to main HiFi.conf

But I do not know why when installed, the ucm2 files are not found by pulseaudio.
I searched a few hours this afternoon with no result.

Here is the issue I ran into if someone is passing by and have an idea, I take it:

pulseaudio[30048]: E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
anv. 29 14:48:10 X1-Carbon pulseaudio[30048]: E: [pulseaudio] module-alsa-card.c: Failed to find a working profile.
janv. 29 14:48:10 X1-Carbon pulseaudio[30048]: E: [pulseaudio] module.c: Failed to load module "module-alsa-card" (argument: "device_id="0" name="pci-0000_00_1f.3-platform-skl_hda_dsp_generic" card_name="alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
janv. 29 14:48:10 X1-Carbon pulseaudio[30048]: W: [pulseaudio] module-udev-detect.c: Tried to configure /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0 (alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic) more often than 5 times in 10s

The sof driver 1.4.1 is loaded and detected but I have no sound because of the issue above, just the dummy output !

Thanks for the information, I have no deep understanding in audio things.
So it seems that Ubuntu users need to wait for the UCM 1.2.1 to be released?

@PaulVanSchayck

This comment has been minimized.

Copy link

@PaulVanSchayck PaulVanSchayck commented Feb 3, 2020

Things are in flux at ALSA to move from ucm to ucm2. At Ubuntu they are working on a backwards compatible fix for bionic en eoan for this reasons.
See this bug report: https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/1859754

The bug report also lists that for 20.04 they are planning to use ucm2 and alsa-lib-1.2.1.

They also give this alternative location for the UCM1 files: https://github.com/thesofproject/alsa-ucm-conf

@dnck

This comment has been minimized.

Copy link

@dnck dnck commented Feb 3, 2020

I'm on Ubuntu 19.10, X1C7. Out of the box clean install of Ubuntu, only the sound on the bottom two speakers worked. I used the bash script posted by @sagi, which resulted in "Speaker Cannon Point-LP High Definition Audio Controller" being listed as options for sound, and all four speakers + microphone working. However, recent firmware updates in the last two days reverted the four working speakers and microphone to non-functioning status. I un-did the bash script by removing the created directories and files. After several reboots, the four speakers are microphone are functioning. As a side note, I also added the file /usr/share/X11/xorg.conf.d/20-intel.conf as suggested here. For posterity, here's the undo:

#!/bin/bash
# undo changes made by bash script, 
# https://gist.github.com/hamidzr/dd81e429dc86f4327ded7a2030e7d7d9#gistcomment-3131600
rm -rf /lib/firmware/intel/sof/
rm -rf /lib/firmware/intel/sof-tplg/
rm /etc/modprobe.d/alsa-base.conf 
rm /etc/modprobe.d/blacklist.conf  
rm /usr/share/alsa/ucm/sof-skl_hda_card/HiFi.conf
rm /usr/share/alsa/ucm/sof-skl_hda_card
rm /usr/share/alsa/ucm/sof-skl_hda_card/sof-skl_hda_card.conf 
@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Feb 5, 2020

With Linux 5.5.1, 1.4.2 firmware from Alsa and Alsa 1.2.1, everything seems fine with alsamixer but I am also hitting E: [pulseaudio] module-alsa-card.c: Failed to find a working profile. I did not try to switch to Intel driver for X. I didn't tried earlier kernels. I have tried 1.4.1 firmware, without any success either. I have also updated the ucm2 files from Alsa HEAD, no luck. Since I am running Alsa 1.2.1, I think I have to use UCM2 files.

@moreka

This comment has been minimized.

Copy link

@moreka moreka commented Feb 5, 2020

With Linux 5.5.1, 1.4.2 firmware from Alsa and Alsa 1.2.1, everything seems fine with alsamixer but I am also hitting E: [pulseaudio] module-alsa-card.c: Failed to find a working profile. I did not try to switch to Intel driver for X. I didn't tried earlier kernels. I have tried 1.4.1 firmware, without any success either. I have also updated the ucm2 files from Alsa HEAD, no luck. Since I am running Alsa 1.2.1, I think I have to use UCM2 files.

I have the same issue. You can add these two lines to /etc/pulse/default.pa and get a working solution (however, you don't get a profile as per check in pavucontrol, say):

load-module module-alsa-sink device=hw:0,0 channels=4
load-module module-alsa-source device=hw:0,7 channels=4
@woutdp

This comment has been minimized.

Copy link

@woutdp woutdp commented Feb 6, 2020

@zaggash @yunjae2 I am also having the same terrible sound quality on my x1 carbon gen 7. After running this script on linux 5.5 with manjaro, I at least have sound when I didn't before. Looking in alsamixer, it seems the bass is entirely undetected:
image
Perhaps relatedly, I am only able to see "Front Left" and "Front Right" and there is no option to switch to 4 channels, which did fully work on previous kernels without this patch.
Here's my dmesg if interesting: https://pastebin.com/zWKRGFYS
The microphone works quite well, however.

I also have the exact same issue on my Thinkpad X1 Carbon 7th gen. It's been a huge headache...
I tried to force pulseaudio to use 4 channels (in default.pa), no progress.
I guess the problem is either in UCM files or in the topology file, but I have no idea how to work on those files.
(I'm on 5.5 kernel as well, having sof-firmware 1.4.2; running Arch)

Same issue here with 5.5 kernel, sof-firmware 1.4.2 and running arch.
It seems by default all 4 speakers are working but the sound has almost no bass making the sound quality really bad. When muting the speakers in alsa, the bass turns on for the bottom speakers, but the top speakers stop working.
No idea how to fix. I'm guessing the settings in the HiFi.conf file will fix it, but I'm not familiar with it. Been looking at this problem for the last day...

@carlosmcodes

This comment has been minimized.

Copy link

@carlosmcodes carlosmcodes commented Feb 6, 2020

yeah hey how do you reverse this??? i now have no sound :))) running pop_os 19.10, kernel 5.3+

@keevie

This comment has been minimized.

Copy link

@keevie keevie commented Feb 7, 2020

I am running arch on my gen 7 x1 carbon, and the speakers were working great without
running this script before kernel 5.5. Mic was totally broken, but I could live with that.

After kernel 5.5, everything broke--running this script brought back sound, but I now have the same issue as @woutdp and @moreka. Very frustrating!

On the plus side, my mic works now!

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Feb 8, 2020

I think you can rollback to the situation in 5.4 by using options snd_hda_intel dmic_detect=0 in a file in /etc/modprobe.d (just tested and it works for me).

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Feb 10, 2020

Still not confirmed but it seems that using this setup Bluetooth headset microphone is not correctly recognized, testing with apple airpods.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Feb 10, 2020

Screenshot from 2020-02-10 15-09-29

I can see the mic under pavucontrol, i guess it should "routed" in some way under alsa ?

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Feb 12, 2020

Still not confirmed but it seems that using this setup Bluetooth headset microphone is not correctly recognized, testing with apple airpods.

I disagree, I am using it and my bluetooth headset is working fine.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Feb 13, 2020

@zaggash yes it seems that it's just related to Airpods' microphone, false alarm sorry.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Feb 13, 2020

Still not confirmed but it seems that using this setup Bluetooth headset microphone is not correctly recognized, testing with apple AirPods.

Bluetooth mic works fine for me although I'm still on kernel 5.4 on that machine. 🤔

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Feb 13, 2020

FYI, linux kernel commits d2cd795c4ece and 54a6a7dc107d (released in mainline kernel 5.5 and backported to stable kernel 5.4.12) change the legacy snd_hda_codec_realtek driver to assign the rear speakers on the X1 Carbon to the same internal output as the front speakers. This makes the mixer control work but it reduces the max output volume to ~60% of what it used to be.
https://lore.kernel.org/alsa-devel/20200210025249.GA2700@f3/

I submitted patches to move the rear speakers to a different internal output which brings back the max volume and allows independent control of front and back speakers. So far the audio maintainer doesn't seem eager to make that change and I haven't had the time to test with the latest pulseaudio, alsa, and so on as requested.
https://patchwork.kernel.org/patch/11374849/

Just mentioning this in case some other people notice that reduction in volume and are wondering where it comes from.

@Markuzcha

This comment has been minimized.

Copy link

@Markuzcha Markuzcha commented Feb 13, 2020

FYI, linux kernel commits d2cd795c4ece and 54a6a7dc107d (released in mainline kernel 5.5 and backported to stable kernel 5.4.12) change the legacy snd_hda_codec_realtek driver to assign the rear speakers on the X1 Carbon to the same internal output as the front speakers. This makes the mixer control work but it reduces the max output volume to ~60% of what it used to be.
https://lore.kernel.org/alsa-devel/20200210025249.GA2700@f3/

I submitted patches to move the rear speakers to a different internal output which brings back the max volume and allows independent control of front and back speakers. So far the audio maintainer doesn't seem eager to make that change and I haven't had the time to test with the latest pulseaudio, alsa, and so on as requested.
https://patchwork.kernel.org/patch/11374849/

Just mentioning this in case some other people notice that reduction in volume and are wondering where it comes from.

...and in the second commit 54a6a7dc107d I see a typo "Thinkpad X1 Yoga 7th" instead of "... Yoga 4th". Can someone tell them?

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Feb 13, 2020

...and in the second commit 54a6a7dc107d I see a typo "Thinkpad X1 Yoga 7th" instead of "... Yoga 4th". Can someone tell them?

Oh, that's right, the most recent X1 Yoga is "4th" gen!
Can you post data similar to what I've posted in https://patchwork.kernel.org/patch/11374847/; ie. the output of

dmidecode -t system | grep "System Information" -A3
lspci -d ::0403 -vnn
grep Subsystem /proc/asound/card0/codec#0
@kopax

This comment has been minimized.

Copy link

@kopax kopax commented Feb 13, 2020

Hi all, happy new year. I am reading the discussion and I am wondering.... I am on Linux dka 5.3.0-0.bpo.2-amd64 #1 SMP Debian 5.3.9-2~bpo10+1 (2019-11-13) x86_64 GNU/Linux and I my driver worked fine. Will I be able to upgrade Linux safely or it will break my sound because of those commit?

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Feb 13, 2020

Will I be able to upgrade Linux safely or it will break my sound because of those commit?

Commits d2cd795c4ece and 54a6a7dc107d (and their backports) don't "break" sound (as far as I know). They reduce the max output volume and actually improve the mixer controls (see the comparison between "no quirk" and ALC285_FIXUP_SPEAKER2_TO_DAC1 here for details). However, those commits affect the snd_hda_codec_realtek driver only.

Newer kernels (I believe from 5.5 onwards?) by default use a different driver (from the sof project), which is in fact what the script at the top of this thread was enabling. I haven't tried it but the arch wiki says that it works.

Also note that even on a newer kernel, you can still use the older driver. As Vincent posted earlier:

I think you can rollback to the situation in 5.4 by using options snd_hda_intel dmic_detect=0 in a file in /etc/modprobe.d (just tested and it works for me).

This, in effect, makes the kernel use the legacy snd_hda_codec_realtek.

My system still uses the legacy driver. It can be identified by looking at the content of /proc/asound/pcm
00-00: ALC285 Analog : ALC285 Analog : playback 1 : capture 1

and dmesg | grep snd

[   21.287535] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   21.411457] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC285: line_outs=2 (0x14/0x17/0x0/0x0/0x0) type:speaker

I guess that will be different with the newer sof driver.

@Markuzcha

This comment has been minimized.

Copy link

@Markuzcha Markuzcha commented Feb 13, 2020

...and in the second commit 54a6a7dc107d I see a typo "Thinkpad X1 Yoga 7th" instead of "... Yoga 4th". Can someone tell them?

Oh, that's right, the most recent X1 Yoga is "4th" gen!
Can you post data similar to what I've posted in https://patchwork.kernel.org/patch/11374847/; ie. the output of

Of course mate ;-) ...this is the output of my Yoga 4th gen

dmidecode -t system | grep "System Information" -A3

System Information
Manufacturer: LENOVO
Product Name: 20QGS00A00
Version: ThinkPad X1 Yoga 4th

lspci -d ::0403 -vnn

00:1f.3 Audio device [0403]: Intel Corporation Cannon Point-LP High Definition Audio Controller [8086:9dc8] (rev 11) (prog-if 80)
Subsystem: Lenovo Cannon Point-LP High Definition Audio Controller [17aa:2292]
Flags: bus master, fast devsel, latency 64, IRQ 149
Memory at ea23c000 (64-bit, non-prefetchable) [size=16K]
Memory at ea000000 (64-bit, non-prefetchable) [size=1M]
Capabilities:
Kernel driver in use: sof-audio-pci
Kernel modules: snd_hda_intel, snd_sof_pci

grep Subsystem /proc/asound/card0/codec#0

Subsystem Id: 0x17aa2292

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Feb 26, 2020

Come back here again, i've tried today to route the audio to the hdmi outputs but of course, not worked as expected, trying to use of of the 4 hdmi outputs i get as a result a new "dummy output" device and no sound at all. Am i missing something ?

@srwareham

This comment has been minimized.

Copy link

@srwareham srwareham commented Mar 3, 2020

UPDATE SOLVED:
I've got full-volume, normal-sounding, with-bass audio by taking the following steps. Running manjaro linux on a Lenovo X1 Carbon Gen 7 with kernel 5.5.7-1. Microphone works great, too.

  1. Remove the out-of-date sof package installed by script
  2. Install the sof-firmware package
  3. Blacklist snd_hda_intel and snd_soc_skl
  4. Configure PulseAudio to load Alsa modules with the correct device and channel
  5. Reboot
  6. Switch to the sof-hda-dsp card in alsamixer AND MUTE the "Speaker" item. This is necessary for normal sound

Here are the concrete steps for each of the above:

1.)

Open terminal, switch to any working directory where you'd like to store the files you'll be removing (just in case). Run the following:

sudo mv /lib/firmware/intel/sof/sof-cnl.ri .
sudo mv /lib/firmware/intel/sof-tplg/ .
sudo mv /usr/share/alsa/ucm/sof-skl_hda_card .

2.)

sudo pacman -S sof-firmware

3.)

Ensure /etc/modprobe.d/blacklist.confcontains the below (already will if you ran this gist)

blacklist snd_hda_intel
blacklist snd_soc_skl

4.)

Add these two lines to /etc/pulse/default.pa

load-module module-alsa-sink device=hw:0,0 channels=4
load-module module-alsa-source device=hw:0,6 channels=4

5.)

sudo reboot

6.)

alsamixer
<press f6>
<select sof-hda-dsp>

Modify your settings to look like the below. Press the "M" key on the third column, this is essential to have bass sound.
image

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Mar 4, 2020

UPDATE SOLVED:
I've got full-volume, normal sounding, with-bass audio working by taking the following steps. Running manjaro linux on a Lenovo X1 Carbon Gen 7 with kernel 5.5.7-1.

Can someone verify this? I can also give it a go this weekend.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 4, 2020

For me, I still need to tell PulseAudio where to find the source and the sink. Blacklisting snd_hda_intel and snd_soc_skl doesn't make a difference. But I am running Debian. I have opened the issue in PulseAudio bug tracker: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/817.

@DonnieWest

This comment has been minimized.

Copy link

@DonnieWest DonnieWest commented Mar 4, 2020

UPDATE SOLVED:
I've got full-volume, normal sounding, with-bass audio working by taking the following steps. Running manjaro linux on a Lenovo X1 Carbon Gen 7 with kernel 5.5.7-1.

Can someone verify this? I can also give it a go this weekend.

Works perfectly fine for me on an X1 Carbon Gen 7 on Archlinux w/ linux-zen 5.5.7-1

@lermert

This comment has been minimized.

Copy link

@lermert lermert commented Mar 4, 2020

Thanks so much, seems to have worked well on X1 Carbon Gen 7 ubuntu 19.10 with 5.3.0-40-generic

@srwareham

This comment has been minimized.

Copy link

@srwareham srwareham commented Mar 4, 2020

For me, I still need to tell PulseAudio where to find the source and the sink. Blacklisting snd_hda_intel and snd_soc_skl doesn't make a difference. But I am running Debian. I have opened the issue in PulseAudio bug tracker: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/817.

You're right, I had forgotten I did that a while ago. I've updated my post to reflect this one additional step. Only difference between what worked for me and that post is that I used hw:0,6 for the source, not hw:0,7.

@PaulVanSchayck

This comment has been minimized.

Copy link

@PaulVanSchayck PaulVanSchayck commented Mar 4, 2020

@vincentbernat Thanks for reporting that to the PulseAudio people. From the comments on PulseAudio bug tracker it seems like this fix will now make it into Linux 5.5. Too bad that Ubuntu 20.04 LTS will most likely be on Linux 5.4 so that this fix will not end up in that unless its backported once more. Would we need to notify the Ubuntu kernel maintainers of that again?

It's really quite amazing to see how many moving parts there are required to get this microphone to work. Many more months will be needed for all parts to align and for all distro's to have it work out of the box.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 4, 2020

According to PulseAudio people, we should use hw:0,6. hw:0,7 as a lower sample rate. Maybe the fix will be backported to 5.4 as well and Ubuntu would automatically pick it (with a delay), but from my understanding 5.4 doesn't default to SOF and maybe would also need more backports.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 4, 2020

Also, when letting PulseAudio determines the profile, I am losing the bass speaker. The tricker to disable "Speaker" to get it back doesn't work as it also mutes "Master".

@chen42

This comment has been minimized.

Copy link

@chen42 chen42 commented Mar 4, 2020

I followed the scripts above and also changed the /etc/pulse/default.pa file. Works well on X1 Yoga Gen 4, Manjaro Linux 5.5.7-1. However, the alsamixer setting does not persist between reboots.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Mar 4, 2020

I can confirm that following this archlinux wiki guide I have mic and 4 speakers working on Arch and 5.5.7 kernel. Same as a few posts up

@Tbaut

This comment has been minimized.

Copy link

@Tbaut Tbaut commented Mar 5, 2020

Being on linux mint, I can't install the sof-firmware with pacman (or with apt).
I downloaded the sof-cnl-v1.4.2.ri from the release page and executed the following again:

curl -L https://github.hamidzare.xyz/dl/sof-hda-generic.tplg -o /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg
ln -s /lib/firmware/intel/sof-tplg/sof-hda-generic-4ch.tplg /lib/firmware/intel/sof-tplg/sof-hda-generic.tplg

I made sure to follow what was given a few posts above with aslamixer.

The sound is working, but I can't use the keyboard to set the volume level or mute it. Also the mic isn't working.

Would you mind letting me know @vincentbernat how you did it on Ubuntu?

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 6, 2020

@hamidzr if you don't mind, would you be able to show your output for pacmd list-sinks and an alsamixer screenshot?

On my side I'm on 5.5.7 with latest firmware/tplg, I managed to get 4 channels on the microphone (but I needed to bypass UCM for that), but I'm still stuck with 2 speakers, and no sound on HDMI
I tried with and without UCM, with old and recent pulseaudio.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 6, 2020

@Tbaut, I am on Debian unstable. I have:

So, not really something mainstream. And I don't have the bass speaker working.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 6, 2020

Hey @vincentbernat if you have a minute, I'm curious as I'm running almost the same config as you do (currently running 5.6-rc4)
So you have the 4 other speakers working?
When you play pasuspender -- speaker-test -D plughw:0,0 -t wav -c 4 you can hear things on all 4 speakers? If you do I'd be super interested in the output of pacmd list-sinks (and pulseaudio -v if you can). For some reason I can't get the rear speakers to produce sound no matter what. I'll keep digging into it...

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 6, 2020

@vikmik You are right, no sound from rear speakers either.

@hamidzr

This comment has been minimized.

Copy link
Owner Author

@hamidzr hamidzr commented Mar 6, 2020

@vikmik

@hamidzr if you don't mind, would you be able to show your output for pacmd list-sinks and an alsamixer screenshot?

On my side I'm on 5.5.7 with latest firmware/tplg, I managed to get 4 channels on the microphone (but I needed to bypass UCM for that), but I'm still stuck with 2 speakers, and no sound on HDMI
I tried with and without UCM, with old and recent pulseaudio.

pacmd list-sinks output: https://pastebin.com/Ru9tr9GT

Linux x 5.5.7-arch1-1 #1 SMP PREEMPT Sat, 29 Feb 2020 19:06:02 +0000 x86_64 GNU/Linux

DeepinScreenshot_select-area_20200306152048

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

Thanks @hamidzr . Yeah more or less same boat here (comparing what you posted to my output)

Looking at your list-sinks output, I see sample spec: s16le 2ch 48000Hz, so 2 channels (I have the same)
This seems to imply load-module module-alsa-sink device=hw:0,0 channels=4 in /etc/pulse/default.pa doesn't have the intended effect. I suspect you could use channels=2 and get the exact same sound.

Using pasuspender -- speaker-test -D plughw:0,0 -t wav -c 4 (bypassing pulseaudio and trying to play on the rear speakers), I get only output on the 2 front speakers - I suspect you will too.
I'm not entirely sure I understand what PulseAudio does when we play 4-channel sound, and how/when the rear speakers are used

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 7, 2020

In this bug report for Fedora, there are people saying they were able to get the 4 speakers work. However, this is not confirmed. https://bugzilla.redhat.com/show_bug.cgi?id=1772498#c164 It seems the UCM file has to be modified to add a PlaybackChannels "4" into the Speaker section. No luck for me (dunno if speaker-test would use these files). Fedora is adding patches to its kernels, so one of them may be the key. But I suppose it would be in 5.6-rc4.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 7, 2020

Also, maybe hdajackretask would help to enable these speakers.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

As far as I understand, in general the UCM files are only used by PulseAudio to create the profiles. This is just a much nicer way to add all the sinks/sources/etc than manually adding stuff via load-module module-alsa-sink <...>, and it integrates with headphone jacks, etc.
But the PlaybackChannels "4" is equivalent to manually specifying channels=4 in PA config. In the end, what we see in pavucontrol/pacmd list shows what has an effect, and if the channels settings are properly applied - keeping in mind that an invalid setting can be silently ignored.

When we use speaker-test, if we don't specify a device (speaker-test -t wav -c 4 - or specify -D default) that'll go straight to PulseAudio if it's running, so the UCM files matter in that case. When I do so, I get full sound for the "front" samples on the front speakers, and a muted sound on the front speakers for the "rear" samples... I'd need to try again in a quiet environment though - it's hard to be 100% sure if the rear aren't firing up a little as well

However if we do speaker-test with -D plughw:0,0, PulseAudio doesn't come into play (that's why pasuspender -- is required as it would otherwise conflict with PulseAudio and return EBUSY if we were playing something with PA at the same time). In this case we can clearly hear that the rear samples are totally silent

But I'm also suspicious of something at a lower level. I tried to understand how all the pins work as well but I'm far from it :)
For future reference, this is what I have (init_pin_configs is setup by the BIOS, version N2QET21W / 1.15 )

for f in /sys/class/sound/hwC0D0/*pin_configs; do echo $f; cat $f; echo; done
/sys/class/sound/hwC0D0/driver_pin_configs

/sys/class/sound/hwC0D0/init_pin_configs
0x12 0x411111f0
0x13 0x40000000
0x14 0x90170110
0x16 0x411111f0
0x17 0x90170111
0x18 0x411111f0
0x19 0x04a11040
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x40600001
0x1e 0x411111f0
0x21 0x04211020

/sys/class/sound/hwC0D0/user_pin_configs

On the other hand, I may also be totally confused... this commit message in particular makes me wonder what we're looking for: torvalds/linux@d2cd795

because the shared output to all speakers produces the sufficient
and well balanced sound. The stereo support is enough for this
purpose (laptop).

Since this was merged (5.5-rc6), then I don't understand how we could ever get 4 channels in PulseAudio.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

So I think stereo controls makes total sense for a laptop (I don't really want 4 channels in PA honestly), but somehow the sound needs to be mixed properly to use all available speakers in a decent way. To me, a speaker-test through PulseAudio seems to indicate that is not the case - or even trying https://www2.iis.fraunhofer.de/AAC/multichannel.html . I'd be curious to hear if someone managed to get these to produce decent results.

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Mar 7, 2020

On the other hand, I may also be totally confused... this commit message in particular makes me wonder what we're looking for: torvalds/linux@d2cd795

because the shared output to all speakers produces the sufficient
and well balanced sound. The stereo support is enough for this
purpose (laptop).

Since this was merged (5.5-rc6), then I don't understand how we could ever get 4 channels in PulseAudio.

@vikmik commit d2cd795c4ece is misleading. See my earlier comments about that commit in this thread.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

Yep I saw - thanks for mentioning this commit :)

Anyway, I think this is the question (and answer) I was looking for: https://forums.lenovo.com/t5/ThinkPad-X-Series-Laptops/X1-Carbon-7th-gen-speaker-problem/m-p/4504142?page=1 . Only some specific stuff will be rendered through the rear speakers (explanation in that forum thread, with some samples), so I really shouldn't expect them to play everything like the front speakers with speaker-test

Morale of the story, it's not a real 4.1 system as 2 speakers don't support the full usual frequency bandwidth.

Playing actual music/movies, it's actually pretty good. 2 channels in PulseAudio makes sense, and I still get sound on all 4 speakers as long as I don't try to play sine waves or artificial sound samples (for which the rear speakers may barely be used). In any case, providing channels=4 / PlaybackChannels=4 does not make any difference in my setup - it reverts to 2 under the covers anyway.
I'd still be super curious to know about the setup of folks who have 4 actual channels in PulseAudio (4ch in pactl list-sinks output), but from all that I've read having 4 channels there shouldn't necessarily be the goal. I suppose that was possible with the old snd_hda_intel but not with the new SOF driver?

The good news is that things (speakers, 4 channel microphone) work almost entirely out of the box (for me) with all the latest bits (alsa-ucm, pulseaudio, firmware, topology, kernel 5.6). The only missing piece is the CaptureChannels=4 in alsa-ucm to get a full microphone functionality.

@Tbaut

This comment has been minimized.

Copy link

@Tbaut Tbaut commented Mar 7, 2020

Do you know what installing sof-firmware with pacman does differently than manually copying and linking files the way it's done in this gist's script? Would anyone mind summing things up independantly from a distro?

I'm still struggling to understand / sum up what has been said in the past comments. Following the step from this comment except point 2), after having executed the script, results in the soundcard not being discovered.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 7, 2020

@vikmik From my understanding, CaptureChannels=4 shouldn't be needed for you since 5.6 got https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8cd9956f61c65022209ce6d1e55ed12aea12357d.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

@vincentbernat no it's the test condition to check for cfg-dmics that used to be broken in older kernels, not the actual setting of channels by PA in userspace.
However, the newest alsa-ucm config actually already specifies CaptureChannels=4, so what I said is incorrect: there was no need for me to edit it. But this CaptureChannels line is actually needed, otherwise everything falls apart and the UCM-based profile is not created in PulseAudio, at least on my setup.

@Tbaut take this with a grain of salt, but if you install sof-firmware normally there are 2 gotchas I know of:

  • Before torvalds/linux@68b953a (kernel 5.4), just installing sof-firmware still requires you to create the topology symlink sof-hda-generic.tplg manually from so it uses the right number of channels for your microphone. It is not needed anymore with Linux 5.4+ (the kernel will automatically load sof-hda-generic-4ch.tplg)
  • After torvalds/linux@653c28a (kernel 5.5) the kernel will attempt to load a Comet Lake-specific firmware blob. However on some versions of sof-firmware (name of the package is distro-dependent, alsa-firmware on Fedora, no package that I know of in Debian...) the file does not exist, and a symlink sof-cml.ri -> sof-cnl.ri was needed. The most recent versions of sof-firmware should work out of the box in that regard as the symlink should be included. (see thesofproject/linux-firmware@beff732 )
@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 7, 2020

@vikmik I have just updated to current master (soon 5.6-rc5) and everything seems to work out of the box.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 7, 2020

Nice, so that makes 2 of us :) This seems to be the past of least resistance now
I'm on debian testing so I guess I'll have to live with a bunch of backports (alsa-ucm / PulseAudio) for quite a long time ;)

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Mar 8, 2020

Anyway, I think this is the question (and answer) I was looking for: https://forums.lenovo.com/t5/ThinkPad-X-Series-Laptops/X1-Carbon-7th-gen-speaker-problem/m-p/4504142?page=1 . Only some specific stuff will be rendered through the rear speakers (explanation in that forum thread, with some samples), so I really shouldn't expect them to play everything like the front speakers with speaker-test

Morale of the story, it's not a real 4.1 system as 2 speakers don't support the full usual frequency bandwidth.

Playing actual music/movies, it's actually pretty good. 2 channels in PulseAudio makes sense, and I still get sound on all 4 speakers as long as I don't try to play sine waves or artificial sound samples (for which the rear speakers may barely be used). [...]

That's an interesting quote (in https://forums.lenovo.com/topic/findpost/1301/4504142/4526221).

FYI, in my case, still using the old snd_hda_codec_realtek driver with a self-compiled 5.4 kernel with the patches I posted earlier (https://salsa.debian.org/bpoirier-guest/linux/-/tree/sid-snd_hda_codec_realtek), I get clear four-channel definition and the rear speakers sound louder than the front.

With the test tracks at https://www2.iis.fraunhofer.de/AAC/multichannel.html (played via the browser through pulseaudio set to "Analog Surround 4.0 Output"), FC is center mixed and the LFE track is inaudible, the other announcements (FL, FR, RS, LS) are clearly audible on the expected single speakers. RS and LS sound louder than FL and FR.

When you play pasuspender -- speaker-test -D plughw:0,0 -t wav -c 4 you can hear things on all 4 speakers? [...]

When using speaker-test as above, each channel plays individually and the rear speakers sound louder, as in the Fraunhofer tracks. However, both rear speakers are labeled as "LFE".

I hope the result is at least as good with the sof driver.

@vikmik I have just updated to current master (soon 5.6-rc5) and everything seems to work out of the box.

@vincentbernat If you don't mind, can you post an overview of the steps to test on Debian unstable?

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 8, 2020

@gobenji:

That's all for me. I also find the loudness is not the same as with the hda codec but it's hard to know if it's what expected. As for the channels, I als

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 9, 2020

Thanks for the feedback @gobenji ! What you describe seems totally different from what I have here.

I hope the result is at least as good with the sof driver.

You'll probably be disappointed! I should try the old driver to compare (and your patches). That being said, the messages in the Lenovo forum thread I posted above seem to match exactly what I have. And I suppose most (if not all) of these folks were running Windows... so that's interesting at the very least :)
It'd be nice to get to the bottom of it (especially the thread you started there - https://lore.kernel.org/alsa-devel/20200211054150.GA3119@f3/ , though I understand 10% of it :) )
Not sure if it's relevant, but could you paste the output of for f in /sys/class/sound/hwC0D0/*pin_configs; do echo $f; cat $f; echo; done on your machine? It might yield some interesting info (I posted my output above)

@vincentbernat
With kernel 5.6 and latest UCM config you shouldn't need the pulseaudio patch: the combination of latest UCM config + kernel commit torvalds/linux@8cd9956 should compensate the issue. With this, PulseAudio from Debian experimental should just work

Just for reference, on Debian testing (bullseye), I have:

  • Linux 5.6-rc4
  • PulseAudio backported straight from experimental (nothing compiled by hand), that is:
libpulse0_13.99.1-1_amd64.deb
libpulsedsp_13.99.1-1_amd64.deb
libpulse-mainloop-glib0_13.99.1-1_amd64.deb
pulseaudio_13.99.1-1_amd64.deb
pulseaudio-utils_13.99.1-1_amd64.deb
  • ALSA 1.2.2 - especially important to install alsa-ucm-conf 1.2.2-1 (it's the same in testing/unstable/experimental).
  • SOF firmware 1.4.2

Also one other thing I noticed while parsing all the various threads this week, is that not all X1C7 have the exact same audio chip. Mine identifies as:

$ sudo lspci -s 1f.3 -vnn
00:1f.3 Audio device [0403]: Intel Corporation Device [8086:02c8] (prog-if 80)
	Subsystem: Lenovo Device [17aa:2292]

It seems others have a different device ID (9dc8 instead of 02c8), like: 00:1f.3 Audio device [0403]: Intel Corporation Cannon Point-LP High Definition Audio Controller [8086:9dc8] (rev 11). Wondering if that makes any difference.

Also for reference, this is the laptop I have:

Base Board Information
        Manufacturer: LENOVO
        Product Name: 20R1S04100
        Version: SDK0J40697 WIN
@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 9, 2020

Actually, the answer to my PCI device ID question is there: https://patchwork.kernel.org/patch/10932285/#22626941 .

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 9, 2020

@gobenji I just tested with your patch and the snd_hda_intel driver on a 5.6 kernel - it definitely makes a difference compared to using SOF:

  • In speaker-test (and in general) it reverses the notion of "rear" and "front" speakers. To be clear, until now I was referring to the "front" speakers as the closest to me (at the bottom), and the rear ones the ones near the screen (on top). I was a little confused when you said the rear speakers were louder, because for me it's always been the front (the closest to me). That clears it up - and you might be correct with the terminology... :)
  • speaker-test clearly plays sound on all 4 speakers indeed, with the front (under the laptop) still being louder
  • I also get 4 output channels in PA, and I can control every speaker volume individually, as you described
  • I don't know how to compare the loudness - all the ALSA settings are totally different so it felt like comparing oranges and apples. I could always adjust to the desired loudness. However, when playing multichannel sound, the "rear right / surround right" and "rear left / surround left" are relatively MUCH quieter with SOF - even with headphones on.
  • When testing your patch with the headphones, multiple times I had some instability come up after I played with the settings for too long, not sure out to repro. The volume would spuriously drop and come back up multiple times in the middle of a track. The whole thing also became confused sometimes, and played on the headphones AND the speakers, using the headphones as the "front" channels.

Besides volume and instability with headphones with your patch, hard to say for me which was better between sof and snd-hda-intel and - I also asked my wife who has a much better ear and she didn't see a noticeable difference. But it's difficult to compare with a reboot in the middle. For me most of the difference is when playing multichannel sound, but I couldn't care less on that laptop :)
I also compared with another old laptop, and the sound on the X1C7 was actually pretty bad in comparison, in all cases. Very obvious even with my relatively poor audition. The bass just gets eaten up almost entirely, SOF or non-SOF.

It's been mentioned before, but it's also worth noting that for multi-channel sound, LFE remixing in PulseAudio is required even when wearing headphones.
Playing https://www2.iis.fraunhofer.de/AAC/multichannel.html , with LFE remixing disabled or a too low crossover frequency, there's no subwoofer sound in the headphones. I'm not really sure what to use for crossover frequency (people here seem to be using 250), but it doesn't seem to matter as long as it's high enough in the audible range. But when enabled properly, we can clearly hear the subwoofer in headphones (but still nothing on speakers). The default setting in PulseAudio is disabled, so that's something to keep in mind when playing multichannel sound

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 9, 2020

In mine, I have:

00:1f.3 Audio device [0403]: Intel Corporation Cannon Point-LP High Definition Audio Controller [8086:9dc8] (rev 11) (prog-if 80)
@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 9, 2020

@vikmik With HDA intel, did you try to mute the speaker in ALSA? For me, it sounds better this way. Otherwise, the bass are missing. With SOF, it seems like the bass are only half way there.

@vikmik

This comment has been minimized.

Copy link

@vikmik vikmik commented Mar 9, 2020

@vincentbernat I tried: with snd_hda_intel, master, speaker and bass speaker are all linked in alsamixer. If I mute one, all the others are also muted. And I need to reenable all 3 to unmute the sound. I tried with the speaker volume maxed out (that trick is mentioned somewhere I believe), it made no difference. I did this test in 5.6-rc4 too.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 9, 2020

I did not try with 5.6-rc4, but with 5.5 and SOF modules blacklisted, I was able to mute/unmute "Speaker" separately. Maybe this is due to the difference between our sound chips.

It's sad to take so much time to just get sound working...

@theonlydoo

This comment has been minimized.

Copy link

@theonlydoo theonlydoo commented Mar 12, 2020

fully fixed my X1 7th gen w/ 5.5.8-200.fc31.x86_64 kernel, thanks 🎉

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 12, 2020

I am running vanilla 5.5.9, released yesterday, and everything from 5.6.0-rc5 has been backported, including the out-of-the-box support for PulseAudio and the synchronization with the LEDs on the keyboard. I didn't stay on 5.6.0-rc5 since the dual screen setup with the dock isn't working anymore.

@paolomainardi

This comment has been minimized.

Copy link

@paolomainardi paolomainardi commented Mar 12, 2020

Now would be nice to find a working solution for Ubuntu 18.04, where we are stuck with 5.3.

@PaulVanSchayck

This comment has been minimized.

Copy link

@PaulVanSchayck PaulVanSchayck commented Mar 12, 2020

I am running vanilla 5.5.9, released yesterday, and everything from 5.6.0-rc5 has been backported, including the out-of-the-box support for PulseAudio and the synchronization with the LEDs on the keyboard. I didn't stay on 5.6.0-rc5 since the dual screen setup with the dock isn't working anymore.

Did you test HDMI as output sink in PulseAudio?

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 12, 2020

5.3 not being a LTS release, I think you shouldn't hold your breath. You can test the mainline kernels available in a dedicated PPA. However, it is not enough, you also need ALSA 1.2.2 and PulseAudio 13.99.1. Your best luck is to upgrade to Ubuntu Focal which seems to have everything needed. However, it will only comes with 5.4 and I think SOF support is not being backported to 5.4. But then, you could use the mainline kernel PPA.

@vincentbernat

This comment has been minimized.

Copy link

@vincentbernat vincentbernat commented Mar 12, 2020

I am running vanilla 5.5.9, released yesterday, and everything from 5.6.0-rc5 has been backported, including the out-of-the-box support for PulseAudio and the synchronization with the LEDs on the keyboard. I didn't stay on 5.6.0-rc5 since the dual screen setup with the dock isn't working anymore.

Did you test HDMI as output sink in PulseAudio?

I did not. They appear "normally".

@PaulVanSchayck

This comment has been minimized.

Copy link

@PaulVanSchayck PaulVanSchayck commented Mar 12, 2020

Did you test HDMI as output sink in PulseAudio?

I did not. They appear "normally".

So they did do for me, when I last tested SOF couple of months a go, but they didn't actually work. Wondering if that's fixed as well now.

Your best luck is to upgrade to Ubuntu Focal which seems to have everything needed. However, it will only comes with 5.4 and I think SOF support is not being backported to 5.4. But then, you could use the mainline kernel PPA.

I wouldn't be surprised if we have to wait for Ubuntu 20.10 for a fully out of the box experience.

@gobenji

This comment has been minimized.

Copy link

@gobenji gobenji commented Mar 16, 2020

@gobenji:

* compile and install Linux 5.6-rc5 (`make deb-pkg` to get a package, you can reuse the `/boot/config-XX` from Debian, but you need to disable module signature)

[...]

I am running vanilla 5.5.9, released yesterday, and everything from 5.6.0-rc5 has been backported, including the out-of-the-box support for PulseAudio and the synchronization with the LEDs on the keyboard. I didn't stay on 5.6.0-rc5 since the dual screen setup with the dock isn't working anymore.

Thanks for these instructions. I tested with 5.5.9 and got it working as you describe. Sounds like we have a similar setup, I also run dual screens with the dock!

Personally, I mostly care about having the volume as loud as it used to be before commit d2cd795c4ece. Sadly, that's not the case at the moment with the sof driver. This is influenced by the connection of node 0x17 which can be seen by looking at /proc/asound/card0/codec#0. We can see that it is the same between snd_soc_skl_hda_dsp (the sof driver) and the (legacy) snd_hda_intel:

Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
[...]
  Connection: 3
     0x02* 0x03 0x06

I described the effect of the different connections in this (rejected) patch log

In order to test output volume objectively, I set all relevant mixer controls to 100%, play some samples and measure the sound level using an app on my phone. As long as I leave the laptop and phone in the same position between tests, the numbers are reproducible within 2-3dB. Specifically, I used the following apps:
https://play.google.com/store/apps/details?id=kr.sira.sound&hl=en
https://play.google.com/store/apps/details?id=com.keuwl.spectrumanalyzer&hl=en

I tested with white noise generated by Audacity at amplitude 1. This should show up as a horizontal line on the spectrum analyzer.

However, what I really care about is to have a loud and clear terminal bell! I noticed that the difference in volume of the terminal bell is more proeminent than the difference of white noise. That's the reason I'm annoyed by the lower sound volume! In my case, I use the following config for the terminal bell:

pactl upload-sample /usr/share/sounds/freedesktop/stereo/window-attention.oga x11-bell
pactl load-module module-x11-bell sample=x11-bell display=$DISPLAY

For these tests, I simply open a bash shell, press and hold the tab key to have a busy-loop of bells.

Sound Sample Node 0x17 Connection 0x02 (mainline) Node 0x17 Connection 0x03 (patched driver)
White Noise (Audacity, amplitude=1) conn_0x02_white conn_0x03_white
Bell Loop (window-attention.oga) conn_0x02_bell conn_0x03_bell

As we can see, the sound output is louder when using connection 0x03, especially with the bell sample.

Furthermore, with the patched driver, when setting the pulseaudio mixer level to 65%, I get a reading of 52dB for the bell loop. This corresponds to the level of the mainline driver at 100%. That's where I got the "Weak (~60%) max output volume" figure that I wrote in the patch log.

Finally, here's what the spectrum looks like:

Node 0x17 Connection 0x02 (mainline) Node 0x17 Connection 0x03 (patched driver)
conn_0x02_white_spectrum conn_0x03_white_spectrum

The green bars are the instant transform and should be ignored. You should look at the yellow line which is a 60s average.

Note that the vertical scale is not exactly the same between the two graphs and also that these measurements were just done with my phone, not a scientific instrument!

Nevertheless, it's interesting to see that the low end (40-1000Hz) response is what differs the most between the two connections. In particular, with 0x03, the peak is at a lower frequency and higher amplitude.

To end on a positive note, I can also confirm that the mic works with the sof driver.

@buscon

This comment has been minimized.

Copy link

@buscon buscon commented Mar 18, 2020

hi,

I'm on Linux Mint with a 5.3 Kernel. I run the script and the dmesg output looks good, I do see the sound card as
hw:sofsklhdacard,0 [HDA Analog ()]
hw:sofsklhdacard,1 [HDA Analog (
)]

But I am using Jack (with Cadence) and when I try to start Jack here is the error I get:
Wed Mar 18 09:41:00 2020: Starting jack server...
Wed Mar 18 09:41:00 2020: JACK server starting in realtime mode with priority 10
Wed Mar 18 09:41:00 2020: self-connect-mode is "Don't restrict self connect requests"
Wed Mar 18 09:41:00 2020: Acquired audio card Audio0
Wed Mar 18 09:41:00 2020: creating alsa driver ... hw:sofsklhdacard,0|hw:sofsklhdacard,0|512|3|48000|0|0|nomon|swmeter|-|32bit
Wed Mar 18 09:41:01 2020: configuring for 48000Hz, period = 512 frames (10.7 ms), buffer = 3 periods
Wed Mar 18 09:41:01 2020: ALSA: final selected sample format for capture: 32bit integer little-endian
Wed Mar 18 09:41:01 2020: ERROR: ALSA: cannot set period size to 512 frames for capture
Wed Mar 18 09:41:01 2020: ERROR: ALSA: cannot configure capture channel
Wed Mar 18 09:41:01 2020: Released audio card Audio0
Wed Mar 18 09:41:01 2020: ERROR: Cannot initialize driver
Wed Mar 18 09:41:01 2020: ERROR: JackServer::Open failed with -1
Wed Mar 18 09:41:01 2020: ERROR: Failed to open server
Wed Mar 18 09:41:01 2020: Saving settings to "/home/marcello/.config/jack/conf.xml" ...

Here is the error I get in the dmesg:
[11276.589313] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI
[11276.589314] snd_hda_codec_realtek ehdaudio0D0: ASoC: can't open codec Digital Codec DAI: -22
[11276.589315] Digital Playback and Capture: ASoC: BE open failed -22
[11276.589316] HDA Digital: ASoC: failed to start some BEs -22

did anyone manage to run Jack together with the configuration of the script?
Or any suggestion what I should try?

thank you!

@zaggash

This comment has been minimized.

Copy link

@zaggash zaggash commented Mar 19, 2020

Using default 5.5.10 arch kernel.
Default sound config, it is working but with this weird behavior.

When I unplug the headset, I have to manually set the profile from Off to Hifi with pavucontrol.
The profile automatically change to Off when I unplug the headset from the Jack.
Anyone with that issue ?

@sne4ky

This comment has been minimized.

Copy link

@sne4ky sne4ky commented Mar 21, 2020

Confirmed, @srwareham answer works as a charm.

Muting the "speaker" with alsamixer solved the volume not being loud enough issue.

Tested on Lenovo x1 Carbon, Manjaro with Linux kernel 5.5

@bleiva

This comment has been minimized.

Copy link

@bleiva bleiva commented Mar 23, 2020

Hello guys, thanks a lot for helping me.

I'm using Fedora 31, kernel 5.5.9-200.fc31.x86_64, UEFI enabled. I've just done the followings steps to make work the microphone and the 4 speakers without running the script.

Remove alsa-firmware if you've installed it previously
sudo dnf remove alsa-firmware

Using the new alsa-sof-firmware package released in fedora 32:
sudo dnf install --releasever 32 alsa-firmware alsa-sof-firmware

Edit the Microphone section to 2 channels:
sudo vim /usr/share/alsa/ucm2/sof-hda-dsp/HiFi.conf

Hifi.conf

SectionDevice."Mic" {
        Comment "Digital Microphone"

        Value {
                CapturePriority 100
                CapturePCM "hw:${CardId},6"
                If.chn {
                        Condition {
                                Type String
                                Haystack "${CardComponents}"
                                # Modified to 2. Default 4
                                Needle "cfg-dmics:2"
                        }
                        True {
                                # Modified to 2. Default 4
                                CaptureChannels 2
                        }
                }


Add these two lines to /etc/pulse/default.pa

load-module module-alsa-sink device=hw:0,0 channels=4
load-module module-alsa-source device=hw:0,6 channels=4

Reboot the computer.

Once is up again:

Setting the Speaker to mute (Check out the value using alsamixer):
amixer set Speaker mute -c 0

To store the amix config for the next reboot: (Avoid to set to mute again)
sudo alsactl store

Any questions, let me know!.

Updates:
03/24 - Added the step for removing alsa-firmware and add load-module in default.pa

@anabneri

This comment has been minimized.

Copy link

@anabneri anabneri commented Mar 23, 2020

Guys, anyone can help me/? I tried to run the script and doesn't works...
I have a Lenovo Carbon X1 too, this error started with ubuntu version 19, I went back to an 18.04 LTS version and no sound yet

@bdarcus

This comment has been minimized.

Copy link

@bdarcus bdarcus commented Mar 23, 2020

Hello guys, thanks a lot for helping me.

I'm using Fedora 31, kernel 5.5.9-200.fc31.x86_64, I've just done the followings steps to make work the microphone and the 4 speakers without running the script.

Using the new alsa-sof-firmware package released in fedora 32:
sudo dnf install --releasever 32 alsa-sof-firmware

I'm getting stuck on here @bleiva:

file /usr/lib/firmware/intel/sof-tplg from install of alsa-sof-firmware-1.4.2-4.fc32.noarch conflicts with file from package alsa-firmware-1.2.1-4.fc31.noarch

Any suggestions?

@bdarcus

This comment has been minimized.

Copy link

@bdarcus bdarcus commented Mar 23, 2020

Nevermind; I removed the alsa-firmware package, and then reinstalled the fc32 package.

But while I can select the correct sof-hda-dsp card in alsamixer and adjust the volumes as above, I only get "dummy" as option in the gnome sound setting panel.

@bleiva

This comment has been minimized.

Copy link

@bleiva bleiva commented Mar 23, 2020

Great @bdarcus. I'm updating the steps. Trying to reboot the computer and check out again.

@lkesler

This comment has been minimized.

Copy link

@lkesler lkesler commented Mar 24, 2020

I installed this program to try to fix my microphone issue, and it's not working. I'd like to uninstall, but I can't seem to find instructions/a script for that. Any ideas?

@bdarcus

This comment has been minimized.

Copy link

@bdarcus bdarcus commented Mar 24, 2020

Works now @bleiva, but I only get stereo, it seems.

@moldach

This comment has been minimized.

Copy link

@moldach moldach commented Mar 24, 2020

First I installed Ubuntu 18.04 on my Lenovo X1 Carbon Gen 7 but the wifi driver and audio drivers were not detected. Spent 3 hours trying to solve the missing wifi driver and audio driver issue to find that the microphone did not work. Spent a few more hours before trying a new OS. I switched over to POP!_OS (which is built off Ubuntu 19.01). First impressions were good as the wifi and audio driver were detected and worked immediately. I followed EVERY SINGLE tutorial to fix the kernel bug for the microphone but none worked. Tried following gist but the solution also does not work for me.

Here are my system specifications:

mtg@pop-os:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Pop!_OS 19.10
Release:	19.10
Codename:	eoan
mtg@pop-os:~$ inxi -Fxz
System:
  Host: pop-os Kernel: 5.3.0-7642-generic x86_64 bits: 64 compiler: gcc 
  v: 9.2.1 Desktop: Gnome 3.34.3 Distro: Pop!_OS 19.10 
  base: Ubuntu 19.10 Eoan 
Machine:
  Type: Laptop System: LENOVO product: 20R1S04100 v: ThinkPad X1 Carbon 7th 
  serial: <filter> 
  Mobo: LENOVO model: 20R1S04100 v: SDK0J40697 WIN serial: <filter> 
  UEFI: LENOVO v: N2QET19W (1.13 ) date: 01/15/2020 
Battery:
  ID-1: BAT0 charge: 45.5 Wh condition: 53.1/51.0 Wh (104%) 
  model: SMP 02DL005 status: Discharging 
  Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M325 
  charge: 55% (should be ignored) status: Discharging 
CPU:
  Topology: 6-Core model: Intel Core i7-10710U bits: 64 type: MT MCP 
  arch: N/A L2 cache: 12.0 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 38399 
  Speed: 856 MHz min/max: 400/4700 MHz Core speeds (MHz): 1: 800 2: 801 
  3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 801 12: 800 
Graphics:
  Device-1: Intel vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0 
  Display: x11 server: X.Org 1.20.5 driver: i915 resolution: 1920x1080~60Hz 
  OpenGL: renderer: Mesa DRI Intel UHD Graphics (Comet Lake 3x8 GT2) 
  v: 4.5 Mesa 19.2.8 direct render: Yes 
Audio:
  Device-1: Intel vendor: Lenovo driver: snd_hda_intel v: kernel 
  bus ID: 00:1f.3 
  Sound Server: ALSA v: k5.3.0-7642-generic 
Network:
  Device-1: Intel driver: iwlwifi v: kernel port: 2000 bus ID: 00:14.3 
  IF: wlp0s20f3 state: up mac: <filter> 
  Device-2: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: 3.2.6-k 
  port: efa0 bus ID: 00:1f.6 
  IF: enp0s31f6 state: down mac: <filter> 
Drives:
  Local Storage: total: 953.87 GiB used: 14.53 GiB (1.5%) 
  ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKKF010T8L size: 953.87 GiB 
Partition:
  ID-1: / size: 929.54 GiB used: 12.29 GiB (1.3%) fs: ext4 
  dev: /dev/nvme0n1p3 
  ID-2: swap-1 size: 4.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-0 
Sensors:
  System Temperatures: cpu: 41.0 C mobo: N/A 
  Fan Speeds (RPM): cpu: 0 
Info:
  Processes: 314 Uptime: 42m Memory: 15.31 GiB used: 1.39 GiB (9.1%) 
  Init: systemd runlevel: 5 Compilers: gcc: 9.2.1 Shell: bash v: 5.0.3 
  inxi: 3.0.36 
mtg@pop-os:~$ uname -a
Linux pop-os 5.3.0-7642-generic #34~1584408018~19.10~21df4b1-Ubuntu SMP Tue Mar 17 13:38:51 UTC  x86_64 x86_64 x86_64 GNU/Linux

I would appreciate if anyone knows the solution to fix the internal microphone!

@tomasbulva

This comment has been minimized.

Copy link

@tomasbulva tomasbulva commented Mar 24, 2020

@moldach I'm on exact same configuration as you x1c7 pop!_os 19.10. And I have everything working perfectly. Including finger print reader. It's been a while since I installed audio drivers via this script. But it works. I have 4 speakers audio that sounds really good as well as multi-channel microphons that work well. For the longest time I had issues with a bluetooth audio switching from speakers to bt headset. But it all has been working perfectly well lately. I'd say better than my macbook audio and bt works. One of the things that are important is to have all the latest firmwares installed (I have the experimental firmware enabled ). As well as all pop!_os updates. The audio actually got a lot better in the last few months (via latest updates). I'll try to post as many details as I can. Let me know if you'd also like to see some configs but I followed this script so it should be all the same.
I also found very usefull these articles:
https://support.system76.com/articles/audio/
https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7)#Audio

uname -a
Linux pop-os 5.3.0-7629-generic #31~1581628825~19.10~f90b7d5-Ubuntu SMP Fri Feb 14 19:56:45 UTC  x86_64 x86_64 x86_64 GNU/Linux
inxi -Fxz            
System:    Host: pop-os Kernel: 5.3.0-7629-generic x86_64 bits: 64 compiler: gcc v: 9.2.1 Desktop: Gnome 3.34.3 
           Distro: Pop!_OS 19.10 base: Ubuntu 19.10 Eoan 
Machine:   Type: Laptop System: LENOVO product: 20QDCTO1WW v: ThinkPad X1 Carbon 7th serial: <filter> 
           Mobo: LENOVO model: 20QDCTO1WW v: SDK0R32862 WIN serial: <filter> UEFI: LENOVO v: N2HET46W (1.29 ) date: 02/21/2020 
Battery:   ID-1: BAT0 charge: 52.0 Wh condition: 52.0/51.0 Wh (102%) model: LGC 02DL004 status: Full 
CPU:       Topology: Quad Core model: Intel Core i7-8565U bits: 64 type: MT MCP arch: Kaby Lake rev: C L2 cache: 8192 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 31999 
           Speed: 800 MHz min/max: 400/4600 MHz Core speeds (MHz): 1: 796 2: 799 3: 799 4: 787 5: 800 6: 796 7: 800 8: 794 
Graphics:  Device-1: Intel UHD Graphics 620 vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0 
           Display: x11 server: X.Org 1.20.5 driver: i915 resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa DRI Intel UHD Graphics (Whiskey Lake 3x8 GT2) v: 4.5 Mesa 19.2.8 direct render: Yes 
Audio:     Device-1: Intel Cannon Point-LP High Definition Audio vendor: Lenovo driver: sof-audio-pci bus ID: 00:1f.3 
           Sound Server: ALSA v: k5.3.0-7629-generic 
Network:   Device-1: Intel Cannon Point-LP CNVi [Wireless-AC] driver: iwlwifi v: kernel port: 2000 bus ID: 00:14.3 
           IF: wlp0s20f3 state: up mac: <filter> 
           Device-2: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: 3.2.6-k port: efa0 bus ID: 00:1f.6 
           IF: enp0s31f6 state: down mac: <filter> 
           IF-ID-1: br-3122640b5a66 state: down mac: <filter> 
           IF-ID-2: br-ab4c9770cd22 state: down mac: <filter> 
           IF-ID-3: docker0 state: down mac: <filter> 
Drives:    Local Storage: total: 476.94 GiB used: 160.83 GiB (33.7%) 
           ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKKF512G8L size: 476.94 GiB 
Partition: ID-1: / size: 466.94 GiB used: 160.63 GiB (34.4%) fs: ext4 dev: /dev/nvme0n1p3 
Sensors:   System Temperatures: cpu: 59.0 C mobo: N/A 
           Fan Speeds (RPM): cpu: 2682 
Info:      Processes: 479 Uptime: 13d 18h 43m Memory: 15.32 GiB used: 8.73 GiB (57.0%) Init: systemd runlevel: 5 Compilers: 
           gcc: 9.2.1 Shell: zsh v: 5.7.1 inxi: 3.0.36 
fwupdmgr get-devices
20QDCTO1WW
│
├─Thunderbolt Controller:
│     Device ID:           cf55e6e796044cdbb824112b0366bbadc81a3817
│     Summary:             Unmatched performance for high-speed I/O
│     Current version:     43.00
│     Vendor:              Lenovo (TBT:0x0109)
│     GUIDs:               0f11f23b-ccfc-5bac-9a41-405429734903
│                          7cd686e2-04fd-5868-aec9-65c2dc6eff2b
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Supported on remote server
│                          • Device stages updates
│   
├─Prometheus:
│ │   Device ID:           51a5f0521bddd3e9d93388f831b2b5ffdf225d9a
│ │   Summary:             Fingerprint reader
│ │   Current version:     10.01.3073367
│ │   Vendor:              Synaptics (USB:0x06CB)
│ │   Install Duration:    2 seconds
│ │   GUIDs:               09e8bf16-3e69-50f5-bb66-c7a040248352
│ │                        8088f861-6318-5b1e-9ce4-fbddbedb09ac
│ │   Device Flags:        • Updatable
│ │                        • Cryptographic hash verification is available
│ │ 
│ └─Prometheus IOTA Config:
│       Device ID:         a717531e28f0288a4e7af638b8e6afc0a1c8743e
│       Current version:   0021
│       Minimum Version:   0021
│       Vendor:            Synaptics (USB:0x06CB)
│       GUID:              7c5a1e62-38fa-5859-9337-09dbac6377e4
│       Device Flags:      • Updatable
│     
├─INTEL SSDPEKKF512G8L:
│     Device ID:           3743975ad7f64f8d6575a9ae49fb3a8856fe186f
│     Summary:             NVM Express Solid State Drive
│     Current version:     L12P
│     Vendor:              Intel Corporation (NVME:0x8086)
│     GUIDs:               79517f86-8df8-5d6e-a18b-33f0b36a78e9
│                          68db11e5-b0cf-5bc9-a94e-17e28496e505
│                          87fd9fec-f447-5ec6-a1cd-d55fac0d3d30
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Needs a reboot after installation
│                          • Device is usable for the duration of the update
│   
├─System Firmware:
│     Device ID:           f09b748a98b31bb5c7c64d83f24ddbc80dff7c5f
│     Current version:     0.1.29
│     Minimum Version:     0.0.1
│     Vendor:              LENOVO (DMI:LENOVO)
│     GUID:                4bbc40fa-f81e-4206-bc70-a1f7b744d964
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Supported on remote server
│                          • Needs a reboot after installation
│                          • Cryptographic hash verification is available
│                          • Device is usable for the duration of the update
│   
├─Touchpad:
│     Device ID:           91961e6ddc950eb21e71db6f33ec09a133933a95
│     Current version:     1.3.3013412
│     Bootloader Version:  8.0
│     Vendor:              Synaptics (HIDRAW:0x06CB)
│     GUIDs:               10010313-27c0-5c7f-bd99-955028fd3a01
│                          71463ccd-7553-5d7d-9fac-7ed8073a7853
│                          981824ee-4283-595b-a2e4-46eae92dba40
│                          0957b08b-b580-5c3a-8073-98b9bb15bc7f
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Supported on remote server
│   
├─UEFI Device Firmware:
│     Device ID:           0ec6a2d51c2c55a649247d119ffb8e229168d6c9
│     Current version:     192.47.1524
│     Minimum Version:     192.47.1524
│     Vendor:              DMI:LENOVO
│     GUID:                c3e4be53-e714-4ea1-bb9c-7fe13a98b556
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Supported on remote server
│                          • Needs a reboot after installation
│                          • Device is usable for the duration of the update
│   
├─UEFI Device Firmware:
│     Device ID:           c085a3cbf4dc1d60d110b7616816e2ffd279b64e
│     Current version:     0.1.15
│     Minimum Version:     0.1.15
│     Vendor:              DMI:LENOVO
│     GUID:                f72e048b-65bd-4e71-9071-1ac7045223e5
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Supported on remote server
│                          • Needs a reboot after installation
│                          • Device is usable for the duration of the update
│   
├─UEFI Device Firmware:
│     Device ID:           b596f8dec94a959248534b35641fe2341e27ed06
│     Current version:     1.0.8343
│     Minimum Version:     0.0.1
│     Vendor:              DMI:LENOVO
│     GUID:                9045ae09-34ab-46d6-826d-b02f859dd20b
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Needs a reboot after installation
│                          • Device is usable for the duration of the update
│   
├─UEFI Device Firmware:
│     Device ID:           f61a138e8240c473a88d703babf7be5bc0e098e6
│     Current version:     0.73.8
│     Minimum Version:     0.73.8
│     Vendor:              DMI:LENOVO
│     GUID:                db246b7d-a882-4e0e-984f-23ac1b0270db
│     Device Flags:        • Internal device
│                          • Updatable
│                          • Requires AC power
│                          • Needs a reboot after installation
│                          • Device is usable for the duration of the update
│   
└─UEFI Device Firmware:
      Device ID:           97d441c3228fe8615f883b166a8809389803f9e2
      Current version:     0.0.26403
      Minimum Version:     0.0.1
      Vendor:              DMI:LENOVO
      GUID:                68d3b08f-6ed2-43ca-86f0-f1ad6e41b390
      Device Flags:        • Internal device
                           • Updatable
                           • Requires AC power
                           • Needs a reboot after installation
                           • Device is usable for the duration of the update
apt list --installed | grep pulseaudio

gstreamer1.0-pulseaudio/eoan,now 1.16.1-1ubuntu1 amd64 [installed,automatic]
pulseaudio-module-bluetooth/eoan,now 1:12.2-9~eoan1 amd64 [installed]
pulseaudio-module-gsettings/eoan,now 1:12.2-9~eoan1 amd64 [installed,automatic]
pulseaudio-module-zeroconf/eoan,now 1:12.2-9~eoan1 amd64 [installed,automatic]
pulseaudio-utils/eoan,now 1:12.2-9~eoan1 amd64 [installed]
pulseaudio/eoan,now 1:12.2-9~eoan1 amd64 [installed]

---
apt list --installed | grep alsa 

alsa-base/eoan,eoan,now 1.0.25+dfsg-0ubuntu5 all [installed]
alsa-utils/eoan,now 1.1.9-0ubuntu1 amd64 [installed,automatic]
gstreamer1.0-alsa/eoan,now 1.16.1-1 amd64 [installed]

---
apt list --installed | grep linux-sound-base

linux-sound-base/eoan,eoan,now 1.0.25+dfsg-0ubuntu5 all [installed,automatic]

---
apt list --installed | grep libasound2      

libasound2-data/eoan-proposed,eoan-proposed,now 1.1.9-0ubuntu1.2 all [installed,automatic]
libasound2-plugins/eoan,now 1.1.9-0ubuntu1 amd64 [installed,automatic]
libasound2-plugins/eoan,now 1.1.9-0ubuntu1 i386 [installed,automatic]
libasound2/eoan-proposed,now 1.1.9-0ubuntu1.2 amd64 [installed,automatic]
libasound2/eoan-proposed,now 1.1.9-0ubuntu1.2 i386 [installed,automatic]

here is alsa-info dump

!!################################
!!ALSA Information Script v 0.4.64
!!################################

!!Script ran on: Tue Mar 24 16:49:36 UTC 2020


!!Linux Distribution
!!------------------

Ubuntu 19.10 \n \l DISTRIB_ID=Ubuntu ID=ubuntu ID_LIKE=debian UBUNTU_CODENAME=eoan


!!DMI Information
!!---------------

Manufacturer:      LENOVO
Product Name:      20QDCTO1WW
Product Version:   ThinkPad X1 Carbon 7th
Firmware Version:  N2HET46W (1.29 )
Board Vendor:      LENOVO
Board Name:        20QDCTO1WW


!!ACPI Device Status Information
!!---------------

/sys/bus/acpi/devices/ACPI0003:00/status 	 15
/sys/bus/acpi/devices/ACPI000C:00/status 	 15
/sys/bus/acpi/devices/ACPI000E:00/status 	 15
/sys/bus/acpi/devices/INT0E0C:00/status 	 15
/sys/bus/acpi/devices/INT3400:00/status 	 15
/sys/bus/acpi/devices/INT3403:00/status 	 15
/sys/bus/acpi/devices/INT34BB:00/status 	 15
/sys/bus/acpi/devices/INT3F0D:00/status 	 15
/sys/bus/acpi/devices/LEN0100:00/status 	 15
/sys/bus/acpi/devices/LEN0111:00/status 	 15
/sys/bus/acpi/devices/LEN0268:00/status 	 15
/sys/bus/acpi/devices/LEN0300:00/status 	 15
/sys/bus/acpi/devices/LNXPOWER:00/status 	 1
/sys/bus/acpi/devices/LNXPOWER:01/status 	 15
/sys/bus/acpi/devices/LNXPOWER:02/status 	 1
/sys/bus/acpi/devices/LNXPOWER:03/status 	 1
/sys/bus/acpi/devices/LNXPOWER:04/status 	 1
/sys/bus/acpi/devices/LNXPOWER:05/status 	 1
/sys/bus/acpi/devices/NXP1001:00/status 	 15
/sys/bus/acpi/devices/PNP0103:00/status 	 15
/sys/bus/acpi/devices/PNP0C02:00/status 	 3
/sys/bus/acpi/devices/PNP0C02:01/status 	 3
/sys/bus/acpi/devices/PNP0C02:05/status 	 3
/sys/bus/acpi/devices/PNP0C0A:00/status 	 31
/sys/bus/acpi/devices/PNP0C60:00/status 	 15
/sys/bus/acpi/devices/PRP00001:00/status 	 11
/sys/bus/acpi/devices/STM7308:00/status 	 15
/sys/bus/acpi/devices/SYNA8005:00/status 	 15
/sys/bus/acpi/devices/USBC000:00/status 	 15
/sys/bus/acpi/devices/device:17/status 	 15
/sys/bus/acpi/devices/device:26/status 	 15
/sys/bus/acpi/devices/device:27/status 	 15


!!Kernel Information
!!------------------

Kernel release:    5.3.0-7629-generic
Operating System:  GNU/Linux
Architecture:      x86_64
Processor:         x86_64
SMP Enabled:       Yes


!!ALSA Version
!!------------

Driver version:     k5.3.0-7629-generic
Library version:    1.1.9
Utilities version:  1.1.9


!!Loaded ALSA modules
!!-------------------

snd_soc_skl_hda_dsp