add ucm to make alsa/sof driver work under PA (variants of Lenovo X1 Carbon 7th, Dell cnl and cml machines)

Bug #1859754 reported by Hui Wang on 2020-01-15
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
High
Hui Wang
Bionic
Undecided
Unassigned
Eoan
Undecided
Unassigned

Bug Description

This ucm is only for Eoan and Bionic, for focal and future versions, we plan to integrate the ucm2 instead of this ucm, and the ucm2 depends on the alsa-lib-1.2.1 and pluseaudio-v14, the ucm2 is under developing by the community, is not ready yet.

[Impact]
In the oem project, we have a couple of Lenovo and Dell machines which
connect the digital mic to PCH directly, this design needs the new
sound driver soc/sof, and this driver can't work under pulseaudio
automatically, we need to integrate the ucm for the driver, then the
sof dirver could work under pulseaudio and gnome.

This ucm is maintained by intel audio team, and it is not upstreamed
and will not be upstreamed, since the community is developing the ucm2
which is based on at least alsa-lib-1.2.1 and pulseaudio-v14.0 (still
under developing), for bionic and eoan, we have to integrate this ucm
since the alsa-lib version is too low. For focal and future version, we
are going to integrate the ucm2 after the ucm2 is ready.

This ucm is already verified in the oem project, now it is time to put it
into the stock ubuntu.

[Fix]
These ucm files are backported from sof_ucm1 branch of
https://github.com/thesofproject/alsa-ucm-conf.git

[Test Case]
Boot the eoan kernel or oem-osp1-bionic kernel, then check the log of
pulseaudio, the ucm files are loaded successfully, then check the
gnome-sound-setting, both output and input devices work well.

[Regression Risk]
Low, just add some new ucm files, and this will not affect other machines,
and those new added ucm files are only used by specific machines which enable
the sof driver.

Hui Wang (hui.wang) on 2020-01-15
Changed in alsa-lib (Ubuntu):
importance: Undecided → High
tags: added: originate-from-1856130 somerville
Hui Wang (hui.wang) wrote :

This is the debdiff for eoan:

Hui Wang (hui.wang) wrote :

This is the debdiff for bionic:

Hui Wang (hui.wang) on 2020-01-15
description: updated
Sebastien Bacher (seb128) wrote :

Thanks, I'm going to sponsor that, including to focal since by SRU rules we need to get the fix there first. That's going to be replaced by the alsa update at some point but that one is not ready yet

Changed in alsa-lib (Ubuntu):
status: New → Fix Committed
Hui Wang (hui.wang) wrote :

Thanks Seb.

Łukasz Zemczak (sil2100) wrote :

Is the same change still present in the current focal-proposed alsa-lib 1.2.1.2-2 ?

Hui Wang (hui.wang) wrote :

Reply #5:

No, the change is not in the 1.2.1 and will not apply to 1.2.1. these confs are ucm1 version, they are only for eoan and bionic. For alsa-lib 1.2.1, the upstream is writing ucm2 confs and it is not finished yet. So let's SRU the ucm confs for eoan and bionic first. And in future the ucm2 conf are not in the alsa-lib anymore, they are moved to https://github.com/alsa-project/alsa-ucm-conf.

In order to help us enable the dmic on eoan and bionic, Intel is maintaining these ucm1 confs (https://github.com/thesofproject/alsa-ucm-conf.git).

Hello Hui, or anyone else affected,

Accepted alsa-lib into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/alsa-lib/1.1.9-0ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in alsa-lib (Ubuntu Eoan):
status: New → Fix Committed
tags: added: verification-needed verification-needed-eoan
Changed in alsa-lib (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed-bionic
Timo Aaltonen (tjaalton) wrote :

Hello Hui, or anyone else affected,

Accepted alsa-lib into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/alsa-lib/1.1.3-5ubuntu0.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Hui Wang (hui.wang) wrote :

Recently some users reported the headset-mic input volume is too low, after installing the 1.1.9-0ubuntu1.1 on eoan and 1.1.3-5ubuntu0.3 on bionic, I reproduced the issue of "headset-mic input volume is too low", so please drop the debdiff of #1 and #2, I will upload new debdiffs which put the input volume higher.

Verification failed on Eoan (input volume is to low):
On a machine of Lenovo X1 Carbon 7th, I already installed 19.10 (eoan) on it, then run sudo apt install libasound2, then the libasound is upgraded to 1.1.9-0ubuntu1.1, check the /usr/share/alsa/ucm, all expected folders and files are there. upgrade the linux-firmware to 1.183.4, put snd_hda_intel and snd_soc_skl in the /etc/modporbe.d/blacklist.conf, reboot

now we could see speaker, dmic from gnome-sound-setting, if plug headset, we could see headphone and headset-mic from UI, if we plug hdmi monitor with audio capability, we could see hdmi-audio from UI, all worked as expected.

But there is one issue, for headset-mic, we need to set the input volume to maximum from UI, otherwise I couldn't record any sound.

Verification failed on Bionic (input volume is to low):
On a machine of Dell vistro 5390, I already installed 18.04 (bionic) on it, then run sudo apt install libasound2, then the libasound is upgraded to 1.1.3-5ubuntu0.3, check the /usr/share/alsa/ucm, all expected folders and files are there. upgrade the linux-firmware to 1.173.15, Install the linux-oem-osp1 kernel, put snd_soc_skl in the /etc/modporbe.d/blacklist.conf, reboot

now we could see speaker, dmic from gnome-sound-setting, if plug headset, we could see headphone and headset-mic from UI, if we plug hdmi monitor with audio capability, we could see hdmi-audio from UI, all worked as expected.

But there is one issue, for headset-mic, we need to set the input volume to maximum from UI, otherwise I couldn't record any sound.

tags: added: verification-failed verification-failed-bionic verification-failed-eoan
removed: verification-needed verification-needed-bionic verification-needed-eoan
Hui Wang (hui.wang) wrote :

This is the updated debdiff for eoan (adjust the input volume). thx.

Hui Wang (hui.wang) wrote :

This is the updated debdiff for bionic (adjust the input volume). thx.

All autopkgtests for the newly accepted alsa-lib (1.1.9-0ubuntu1.1) for eoan have finished running.
The following regressions have been reported in tests triggered by the package:

openjdk-lts/11.0.6+10-1ubuntu1~19.10.1 (armhf)
openjdk-lts/blacklisted (arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/eoan/update_excuses.html#alsa-lib

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Hui Wang (hui.wang) wrote :

For the regression of openjdk-lts/11.0.6+10-1ubuntu1~19.10.1 (armhf), it is a "jdk FLAKY timed out"

For the regression of openjdk-lts/blacklisted (arm64), I can't open the log, it always reports "This package is blacklisted. To get the entry removed, contact a member of the release team." I guess it is a FLAKY test too.

And I checked the log of the 1st regression, it has nothing to do with alsa-lib or libasound2.

If it is OK to enqueue the SRU, please enqueue the debdiff of #10 and #11.

thx.

Hui Wang (hui.wang) wrote :

I opened a similar bug for focal, we need to put the alsa-ucm-conf and alsa-topology-conf to the focal image.

This is the bug link: https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/1862505

Paolo Mainardi (paolomainardi) wrote :

Any changes to have this backported to 18.04 ?

Hui Wang (hui.wang) wrote :

For 18.04 and 19.10, the alsa-lib only supports ucm, Intel audio team write the ucm confs and this is sth I plan to SRU to Eoan and Bionic in this bug.

For 20.04, we choose alsa-lib-1.2.1.2, it supports ucm2, and upstream writes the ucm2 confs based on the Intel audio team's work, we use #1862505 to track it.

So the ucm for bionic and eoan is not backported from ucm2 of 1.2.1.2, it is maintained by Intel: https://github.com/thesofproject/alsa-ucm-conf.git

the ucm2 for focal is maintained by upstream: https://github.com/alsa-project/alsa-ucm-conf.git, it is written based on the Intel's work.

Paolo Mainardi (paolomainardi) wrote :
Download full text (5.6 KiB)

On a machine Lenovo Thinkpad X1 Carbon 7th, running Bionic, verification failed.

What i did:

1) Enabled Proposed repository
2) Installed libasound2:

```
> dpkg -l | grep libasound2
ii libasound2:amd64 1.1.3-5ubuntu0.3 amd64 shared library for ALSA applications
ii libasound2-data 1.1.3-5ubuntu0.3 all Configuration files and profiles for ALSA drivers
ii libasound2-plugins:amd64 1.1.1-1ubuntu1 amd64 ALSA library additional plugins

```

3) Upgraded linux-firmware to "1.173.15"
4) Installed "linux-oem-osp1" - "5.0.0-1038-oem-osp1"
5) Verified that all the UCM files are there:

```
ucm
├── apq8064-tabla-snd-card
├── broadwell-rt286
├── chtrt5645
├── DAISY-I2S
├── DB410c
├── Dell-WD15-Dock
├── GoogleNyan
├── HDAudio-Lenovo-DualCodecs
├── LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC
├── LENOVO-20QESITR05-ThinkPadX1Carbon7th-20QESITR05
├── LENOVO-20UB0SIT17-ThinkPadX1YogaGen5-20UB0SIT17
├── LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO
├── Manta-I2S
├── Manta-SPDIF
├── msm8974-taiko-mtp-snd-card
├── PandaBoard
├── PandaBoardES
├── PAZ00
├── SDP4430
├── skylake-rt286
├── sof-skl_hda_card
├── tegraalc5632
├── tegra-rt5640
├── Tuna
└── VEYRON-I2S
```

6) Blacklisted "snd_soc_skl" and "snd_hda_intel" on "/etc/modprobe.d/blacklist.conf"
7) Verified that SOF firmware has been loaded correctly:

```
  dmesg | grep sof | grep -iv microsoft
[ 3.558639] sof-audio-pci 0000:00:1f.3: warning: No matching ASoC machine driver found
[ 3.558647] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[ 3.558800] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[ 3.567161] sof-audio-pci 0000:00:1f.3: Linked as a consumer to 0000:00:02.0
[ 3.567247] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 3.607451] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
[ 3.607454] sof-audio-pci 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[ 3.641575] sof-audio-pci 0000:00:1f.3: unexpected ipc interrupt raised!
[ 3.641577] sof-audio-pci 0000:00:1f.3: error: no reply expected, received 0x0
[ 3.723585] sof-audio-pci 0000:00:1f.3: Firmware info: version 1:1:0-0f736
[ 3.723587] sof-audio-pci 0000:00:1f.3: Firmware: ABI 3:7:0 Kernel ABI 3:6:0
[ 3.723588] sof-audio-pci 0000:00:1f.3: warn: FW ABI is more recent than kernel
[ 3.723793] sof-audio-pci 0000:00:1f.3: firmware boot complete
[ 3.969365] sof-audio-pci 0000:00:1f.3: Topology: ABI 3:7:0 Kernel ABI 3:6:0
[ 3.969366] sof-audio-pci 0000:00:1f.3: warn: topology ABI is more recent than kernel
[ 3.969369] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp3 Tx not handled
[ 3.970268] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec0_in not handled
[ 3.970269] sof-audio-pci 0000:00:1f.3: warning: widget type 7 name iDisp2 Tx not handled
[ 3.970986] sof-audio-pci 0000:00:1f.3: warning: widget type 0 name codec1_in not handled
[ 3.970989] sof-audio-pci 0000:00:1f.3: warning: widget t...

Read more...

Paolo Mainardi (paolomainardi) wrote :

Following my last comment, this is what i see from gnome audio settings.

Paolo Mainardi (paolomainardi) wrote :

It seems that adding "load-module module-alsa-source device=hw:0,7" to "/etc/pulse/default.pa" i have the mic recognized and working, see the attachment.

Hui Wang (hui.wang) wrote :

That is because the ucm is not loaded successfully.

please change cset "name='Headset Mic Boost Volume' 1" to cset "name='Mic Boost Volume' 2" in the all LENOVO_*/LENOVO_*.conf; then reboot.

If it doesn't work, please upload log of "pactl list cards", maybe your machine has a specific dmi string that those 4 folders doesn't match the cardlongname of your machine.

Paolo Mainardi (paolomainardi) wrote :
Download full text (3.4 KiB)

Thanks for your reply @hui.wang

So, i've tried to change "name='Mic Boost Volume' 2"" all the LENOVO files but nothing changed.

Your assumption about the cardlongname was right, because it seems that is different from the versioned ones, mine is "LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX".

  pactl list cards
Card #0
 Name: alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic
 Driver: module-alsa-card.c
 Owner Module: 7
 Properties:
  alsa.card = "0"
  alsa.card_name = "sof-skl_hda_card"
  alsa.long_card_name = "LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX"
  alsa.driver_name = "snd_soc_skl_hda_dsp"
  device.bus_path = "pci-0000:00:1f.3-platform-skl_hda_dsp_generic"
  sysfs.path = "/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0"
  device.bus = "pci"
  device.vendor.id = "8086"
  device.vendor.name = "Intel Corporation"
  device.product.id = "9dc8"
  device.string = "0"
  device.description = "sof-skl_hda_card"
  module-udev-detect.discovered = "1"
  device.icon_name = "audio-card-pci"
 Profiles:
  input:stereo-fallback: Stereo Input (sinks: 0, sources: 1, priority: 51, available: no)
  input:multichannel-input: Multichannel Input (sinks: 0, sources: 1, priority: 1, available: yes)
  output:stereo-fallback: Stereo Output (sinks: 1, sources: 0, priority: 5100, available: yes)
  output:stereo-fallback+input:stereo-fallback: Stereo Output + Stereo Input (sinks: 1, sources: 1, priority: 5151, available: yes)
  output:stereo-fallback+input:multichannel-input: Stereo Output + Multichannel Input (sinks: 1, sources: 1, priority: 5101, available: yes)
  output:multichannel-output: Multichannel Output (sinks: 1, sources: 0, priority: 100, available: yes)
  output:multichannel-output+input:stereo-fallback: Multichannel Output + Stereo Input (sinks: 1, sources: 1, priority: 151, available: yes)
  output:multichannel-output+input:multichannel-input: Multichannel Duplex (sinks: 1, sources: 1, priority: 101, available: yes)
  off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
 Active Profile: output:stereo-fallback+input:multichannel-input
 Ports:
  analog-input-mic: Microphone (priority: 8700, latency offset: 0 usec, not available)
   Properties:
    device.icon_name = "audio-input-microphone"
   Part of profile(s): input:stereo-fallback, output:stereo-fallback+input:stereo-fallback, output:multichannel-output+input:stereo-fallback
  multichannel-input: Multichannel Input (priority: 0, latency offset: 0 usec)
   Part of profile(s): input:multichannel-input, output:stereo-fallback+input:multichannel-input, output:multichannel-output+input:multichannel-input
  analog-output-speaker: Speakers (priority: 10000, latency offset: 0 usec)
   Properties:
    device.icon_name = "audio-speakers"
   Part of profile(s): output:stereo-fallback, output:stereo-fallback+input:stereo-fallback, output:stereo-fallback+input:multichannel-input
  analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, not available)
   Properties:
    device.icon_name = "audio-headphones"
   Part of profile(s): output:stereo-fallback, output:stereo-fallback+input:stereo-fallback, output:stereo-fallback+input:multichannel-input
  ...

Read more...

Hui Wang (hui.wang) wrote :

@Paolo,

That is easy to fix.

change cset "name='Headset Mic Boost Volume' 1" to cset "name='Mic Boost Volume' 2" in the all LENOVO_*/LENOVO_*.conf

sudo cp -rf /usr/share/alsa/ucm/LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO/ /usr/share/alsa/ucm/LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX/

sudo mv /usr/share/alsa/ucm/LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX/LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO.conf /usr/share/alsa/ucm/LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX/LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX.conf

reboot

Paolo Mainardi (paolomainardi) wrote :

@hui.wang thans for your reply.

 tree -L 1 .
.
├── apq8064-tabla-snd-card
├── broadwell-rt286
├── chtrt5645
├── DAISY-I2S
├── DB410c
├── Dell-WD15-Dock
├── GoogleNyan
├── HDAudio-Lenovo-DualCodecs
├── LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX
├── LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC
├── LENOVO-20QESITR05-ThinkPadX1Carbon7th-20QESITR05
├── LENOVO-20UB0SIT17-ThinkPadX1YogaGen5-20UB0SIT17
├── LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO
├── Manta-I2S
├── Manta-SPDIF
├── msm8974-taiko-mtp-snd-card
├── PandaBoard
├── PandaBoardES
├── PAZ00
├── SDP4430
├── skylake-rt286
├── sof-skl_hda_card
├── tegraalc5632
├── tegra-rt5640
├── Tuna
└── VEYRON-I2S

> grep -r "Headset Mic Boost Volume" LENOVO-*
LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX/LENOVO-20QD00LKIX-ThinkPadX1Carbon7th-20QD00LKIX.conf: cset "name='Headset Mic Boost Volume' 2"
LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC/LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC.conf: cset "name='Headset Mic Boost Volume' 2"
LENOVO-20QESITR05-ThinkPadX1Carbon7th-20QESITR05/LENOVO-20QESITR05-ThinkPadX1Carbon7th-20QESITR05.conf: cset "name='Headset Mic Boost Volume' 2"
LENOVO-20UB0SIT17-ThinkPadX1YogaGen5-20UB0SIT17/LENOVO-20UB0SIT17-ThinkPadX1YogaGen5-20UB0SIT17.conf: cset "name='Headset Mic Boost Volume' 1"
LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO/LENOVO-MFG_IN_GO-ThinkPad-MFG_IN_GO.conf: cset "name='Headset Mic Boost Volume' 2"

But nothing changed, i still need "load-module module-alsa-source device=hw:0,7" under "/etc/pulse/default.pa" to see a working mic.

How can i see which ucm files getting loaded by Alsa ?

Hui Wang (hui.wang) wrote :

@Paolo,

Just remove "Headset" from all LENOVO-*.conf, change that line to cset "name='Mic Boost Volume' 2"
reboot

Hui Wang (hui.wang) wrote :

@Paolo,

To check if ucm files getting loaded, what I know is to check the pusleaudio's log.

Paolo Mainardi (paolomainardi) wrote :

@hui.wang thanks, it's finally works, i've got both speakers and mic recognized as specified in the UCM files.

There is just another major drawback that affect thinkpad x1 carbon 7th which has 5 speakers 4+1, but only 2 of them gets recognized, as shown in the attachment.

Should the UCM file be in charge of this ?

Hui Wang (hui.wang) wrote :

@Paolo,

So far, both ucm2 from upstream and ucm from Intel only support 2 speakers, for Bass speakers support, the upstream is discussing it, please read this thread: https://mailman.alsa-project.org/pipermail/alsa-devel/2020-February/162701.html, if you have some idea, please reply that thread.

And after the Bass speakers support is ready, I will co-work with Intel audio team to backport it to ucm. (maybe need some change in the pulseaudio too.)

Hui Wang (hui.wang) wrote :

@sponsor team,

The change of 'Headset Mic Boost Volume' 1" to 'Mic Boost Volume' 2" in the all LENOVO_*/LENOVO_*.conf is already in the updated debdiff (#10 and #11).

And those 4 LENOVO folder names cover all machines we enabled in the oem projects.

If need to add new machines' support, I will collect a couple of new machines then open a new SRU.

So if possible, please help enqueue the #10 and #11.

thx.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers