Bug 212081 - SST driver dosen't work on ALC256M with DMIC
Summary: SST driver dosen't work on ALC256M with DMIC
Status: RESOLVED ANSWERED
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
: 212159 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-05 20:48 UTC by Xiaoliang Yu
Modified: 2021-03-13 19:56 UTC (History)
3 users (show)

See Also:
Kernel Version: 5.10.19-200.fc33.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments
output of alsa-info.sh script attached (40.92 KB, text/plain)
2021-03-05 20:48 UTC, Xiaoliang Yu
Details
alsa-info output (21.06 KB, text/plain)
2021-03-06 17:13 UTC, Xiaoliang Yu
Details
F33 stock configuration (224.00 KB, text/plain)
2021-03-08 21:18 UTC, Xiaoliang Yu
Details
alsa-info with dmesg after kernel re-build (246.85 KB, text/plain)
2021-03-10 05:53 UTC, Xiaoliang Yu
Details

Description Xiaoliang Yu 2021-03-05 20:48:45 UTC
Created attachment 295681 [details]
output of alsa-info.sh script attached

Running F33 kernel 5.10 on a 10th gen comet lake Xiaomi device, which has a ALC256M soundcard(8086:9d71 and subsystem 1d72:1947), dmesg shows skylake+ platform and dmic detected, so it drops to the intel SST driver(SOF seems not supported and i tried it with no effort).

  With the default firmware, no codec is loaded and no card can be found in aplay or inxi or whatever tools you can use, thus pulseaudio just generates a "dummy output" device.

  By Loading the legacy driver I can get the internal speakers working properly with no microphone, but the combo jack only works with 2ch headphones, if I jack a headset with mic into it, there is no stereo and no microphone. Some kind of pins retask needed.

  With other Xiaomi devices with ALC298, sound works perfectly as long as you choose model=alc298-dell1 in the snd options to fix the oem pin settings(this shall be patched as well I guess), but with new models which has a dmic, the sst driver fails, even the legacy driver won't work with combo jack.
  
  8086:9d71 should work since it's not a new device, maybe it lacks some vendor informations or just something goes wrong with this rather old soundcard on a new platform with intel DMIC.
Comment 1 Xiaoliang Yu 2021-03-06 17:13:50 UTC
Created attachment 295689 [details]
alsa-info output
Comment 2 Takashi Iwai 2021-03-08 15:27:26 UTC
It should be supported by SOF.  SST is there just for a transition to SOF, and we won't fix things like this.  So, please clarify what actually didn't work with SOF.  Did you install the necessary firmware files?

And, please try with 5.11.x if you retest with SOF.
Comment 3 Cezary Rojewski 2021-03-08 16:29:29 UTC
Hello,

PCH id of 0x9d71 points to KBL - which is only supported by snd_soc_skl. There is some level of confusion here: issue description touches on Cometlake subject yet lspci for audio multimedia device shows something entirely different - Kabylake PCH.

Log:
[   46.538206] snd_soc_core:soc_dai_link_sanity_check: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: codec component ehdaudio0D0 not found for link Analog Playback and Capture

and similar lead me to believe HDAudio Codec support for ASoC is not enabled in your kernel. And thus no sound card. Dump of modules loaded does backup this statement too - lack of snd_soc_hdac_hda.

Please see:
https://gist.github.com/crojewsk/4e6382bfb0dbfaaf60513174211f29cb

especially the kconfig part and attach your runtime .config file here. Thanks for your cooperation in advance.
Comment 4 Xiaoliang Yu 2021-03-08 21:15:53 UTC
(In reply to Cezary Rojewski from comment #3)
> Hello,
> 
> PCH id of 0x9d71 points to KBL - which is only supported by snd_soc_skl.
> There is some level of confusion here: issue description touches on
> Cometlake subject yet lspci for audio multimedia device shows something
> entirely different - Kabylake PCH.
> 
> Log:
> [   46.538206] snd_soc_core:soc_dai_link_sanity_check: skl_hda_dsp_generic
> skl_hda_dsp_generic: ASoC: codec component ehdaudio0D0 not found for link
> Analog Playback and Capture
> 
> and similar lead me to believe HDAudio Codec support for ASoC is not enabled
> in your kernel. And thus no sound card. Dump of modules loaded does backup
> this statement too - lack of snd_soc_hdac_hda.
> 
> Please see:
> https://gist.github.com/crojewsk/4e6382bfb0dbfaaf60513174211f29cb
> 
> especially the kconfig part and attach your runtime .config file here.
> Thanks for your cooperation in advance.

Thank you for replying. Yes you're right, I double-checked that and there's an old card in the new machine.
So that's all about SST rather than the SOF driver here.
I'm running on vanilla kernel from Fedora33 and the default Kconfig does not include such drivers options, but these soc&skl related modules for each kernel are actually in /lib/modules/ as if pre-compiled and provided by other rpms.
I tried the tplg from that github and manually probed snd_soc_hdac_hda and related codec mods during boot with no effort(same dmesg output).
Seems it dosn't know which of the existing modules are needed for the hardware even if manually loaded.
Shall I toggle these options on and recompile the kernel? It should generate no new modules than the distro defaults, but I don't know whether it make other differences. 
I noticed the correct module loaded with legacy driver is "snd_hda_codec_realtek " which contains functional hdaudioC0D0, but codecs in the soc folder are all named after precise models, there are no generic snd_soc_xxx_realtek or specific xxxx_alc256 in that folder. Hope this dosn't mean the card is only supported by legacy driver.
Thanks for helping, and you noteiced the real problem here.
Comment 5 Xiaoliang Yu 2021-03-08 21:18:09 UTC
Created attachment 295747 [details]
F33 stock configuration
Comment 6 Xiaoliang Yu 2021-03-08 21:30:44 UTC
(In reply to Takashi Iwai from comment #2)
> It should be supported by SOF.  SST is there just for a transition to SOF,
> and we won't fix things like this.  So, please clarify what actually didn't
> work with SOF.  Did you install the necessary firmware files?
> 
> And, please try with 5.11.x if you retest with SOF.


どもありがどございます、岩井さん

My bad, although the CPU is comet lake, the soundcard [8086:9d71]is actually based on kbl, so according to an official github issue, it's not and may not get supported by the SOF driver.

May I ask whether you have decided to deprecate SST driver once SOF is ready? 
There're still many Manufacturers fitting old soundcards, which are not supported by SOF, in their latest products, especially Chinese companies like Lenovo/HUAWEI/Xiaomi, and many users from forums reported their laptops from HP/DELL/ASUS have the same issue.
The final answer to this kind of problems for them is always "dspdriver=1", which is not a proper solution as it kills the microphone and leaves NIDs mismatches in various models.
Comment 7 Cezary Rojewski 2021-03-09 09:13:26 UTC
Hello,

Transition to SOF for SPT and APL based platforms (including Skylake and Kabylake) is not planned. I understand your concerns and we're here to help.

So, attached kconfig confirms my suspicions:
# CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set

Without it, Kconfig found in /sound/soc/intel/Kconfig:
`
config SND_SOC_INTEL_SKYLAKE_COMMON
...
    select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
`

In consequence, both ASoC HDAudio codec module is not being build and HDAudio support is disabled for Skylake driver.
Please, select said kconfig and rebuild the kernel.
Comment 8 Chris Chiu 2021-03-09 13:08:50 UTC
*** Bug 212159 has been marked as a duplicate of this bug. ***
Comment 9 Xiaoliang Yu 2021-03-10 05:50:34 UTC
(In reply to Cezary Rojewski from comment #7)
> Hello,
> 
> Transition to SOF for SPT and APL based platforms (including Skylake and
> Kabylake) is not planned. I understand your concerns and we're here to help.
> 
> So, attached kconfig confirms my suspicions:
> # CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
> 
> Without it, Kconfig found in /sound/soc/intel/Kconfig:
> `
> config SND_SOC_INTEL_SKYLAKE_COMMON
> ...
>     select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
> `
> 
> In consequence, both ASoC HDAudio codec module is not being build and
> HDAudio support is disabled for Skylake driver.
> Please, select said kconfig and rebuild the kernel.

Thanks for your concerning again, and I have tried re-compiling form fedora source tree with different configurations.

With the CODEC options on, it is working, but no better than the legacy driver.

There are lots of platform related issues with the SST driver. That may be the reason why most distributions turn it off. 

Whether I plug in or out the headset there are always speakers and heaset output/inout options, and it won't switch automatically when I do so, which means detection fails.

Dmic is actually loaded and presented, but isn't recording anything unless I make some huge noises,the volume seems to low for it to gather any sound. And it stops working after resuming from s0 state.

There's a combo jack on the laptop, but only works with headphones that dosn't have a microphone. With headsets with built-in microphone, it seems the NIDs are  wrong, there is no stereo output and no microphone support.
Comment 10 Xiaoliang Yu 2021-03-10 05:53:16 UTC
Created attachment 295785 [details]
alsa-info with dmesg after kernel re-build
Comment 11 Xiaoliang Yu 2021-03-10 07:03:52 UTC
(In reply to Cezary Rojewski from comment #7)
> Hello,
> 
> Transition to SOF for SPT and APL based platforms (including Skylake and
> Kabylake) is not planned. I understand your concerns and we're here to help.
> 
> So, attached kconfig confirms my suspicions:
> # CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
> 
> Without it, Kconfig found in /sound/soc/intel/Kconfig:
> `
> config SND_SOC_INTEL_SKYLAKE_COMMON
> ...
>     select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
> `
> 
> In consequence, both ASoC HDAudio codec module is not being build and
> HDAudio support is disabled for Skylake driver.
> Please, select said kconfig and rebuild the kernel.

Confirming the same issue with another new Xiaomi Device [1d72:1947] with dmic and realtek card 8086:9d71. SST driver works but not in a good manner. dmic stops after resuming, volume is too low and combo jack not working.

Jack problem might has something to do with Xiaomi BIOS but should be able to fix with a pin quirk.
Comment 12 Xiaoliang Yu 2021-03-10 20:08:43 UTC
(In reply to Cezary Rojewski from comment #7)
> Hello,
> 
> Transition to SOF for SPT and APL based platforms (including Skylake and
> Kabylake) is not planned. I understand your concerns and we're here to help.
> 
> So, attached kconfig confirms my suspicions:
> # CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC is not set
> 
> Without it, Kconfig found in /sound/soc/intel/Kconfig:
> `
> config SND_SOC_INTEL_SKYLAKE_COMMON
> ...
>     select SND_SOC_HDAC_HDA if SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC
> `
> 
> In consequence, both ASoC HDAudio codec module is not being build and
> HDAudio support is disabled for Skylake driver.
> Please, select said kconfig and rebuild the kernel.

Found the patch for all jacks to work with hda drvier, just one addition line (see: https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c#L8244-L8245) will do: 
      "SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),"

However I don't know how to make it happen when using SST driver, is it possible though?
Comment 13 Cezary Rojewski 2021-03-10 20:27:08 UTC
Hello,

DMIC quality might have to do with NHLT blobs present in BIOS. Without correct ones, user experience is hindered. Volume on the other hand, may be just an UCM issue - lack of proper configuration file. These are found in alsa-ucm-conf:
https://github.com/alsa-project/alsa-ucm-conf/tree/master/ucm2/hda-dsp

Quirk patches for any hda codec (e.g. realtek via patch_realtek.c) impact both legacy and dsp solution. While snd_soc_skl's location differs from snd_hda_intel, ASoC-codec which skylake driver is coupled with, is all but a wrapper and makes heavy use of code found within sound/pci/hda/. That is also why results of legacy vs asoc hda codec should not differ much if at all.

In regard to 'many issues with SST driver'. Most of these are a result of support for hda dsp+DMIC being added very late compared to the release dates of the products said solution is targeting. While several developers did spent a lot of time patching existing and adding missing stuff - note: UCMs, topology and kernel patches are all there and upstreamed - for many distos, this was probably too late and now we end up in situation where integration files are simply missing.
Comment 14 Cezary Rojewski 2021-03-10 20:43:36 UTC
Let me fix my wording: s/all but a wrapper/nothing but a wrapper/.
Comment 15 Xiaoliang Yu 2021-03-10 21:39:25 UTC
(In reply to Cezary Rojewski from comment #14)
> Let me fix my wording: s/all but a wrapper/nothing but a wrapper/.

Yes you're one thousand percent right, both the quirk and modifying related ucm file worked.

I've done too much compiling on this cml-y laptop, it is slow indeed. 
So I handed these to fedora kernel mantainers, and they pulled the request to merge required kconfig in next kernel, got prepared to package the tplg files, together with the patch it will make audio work out of the box.(well, for Xiaomi device at least)

I wonder can the patch be given a name like "{.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},", then be selected by options in /modprobe.d, not by 'options snd-hda-intel model' of course, thus users with similar hardware can get it fix without patching and rebuilding? Does snd_soc_skl accept one?

As for the UCMs, it's obviously not appropriate just to edit the generic one, so I may find out how to add and match one for particular model and try to raise the volume by default.

Manufacturers tends to put old cards which are not support by SOF in their new products with dsp/dmic, many no sound issues are about this, and amazingly none of the major distros have included above stuff in their kernel. That is important as such hardwares are coming.
Comment 16 Jaroslav Kysela 2021-03-11 07:16:13 UTC
(In reply to 尉晓亮 from comment #15)

> 
> Manufacturers tends to put old cards which are not support by SOF in their
> new products with dsp/dmic, many no sound issues are about this, and
> amazingly none of the major distros have included above stuff in their
> kernel. That is important as such hardwares are coming.

The problem is that there are too many hardware variants around and it's not easy to track all changes from Intel. It seems that things will settle down in the 5.12 kernel.
Comment 17 Xiaoliang Yu 2021-03-11 09:44:19 UTC
(In reply to Jaroslav Kysela from comment #16)
> (In reply to 尉晓亮 from comment #15)
> 
> > 
> > Manufacturers tends to put old cards which are not support by SOF in their
> > new products with dsp/dmic, many no sound issues are about this, and
> > amazingly none of the major distros have included above stuff in their
> > kernel. That is important as such hardwares are coming.
> 
> The problem is that there are too many hardware variants around and it's not
> easy to track all changes from Intel. It seems that things will settle down
> in the 5.12 kernel.

Yes there'are too many, with current modeule design, it seems every specific new model needs some fix, and I've verified that some Xiaomi laptops require two lines in the realtek patch file to work:

  "SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),"
  "SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),"

Fixes for old models work but needs to be added with new sub IDs. Should it be addresses directly up stream before settled down?

If things are to be settled down in 5.12, does that mean we won't need to add tons of quirks like this any more?

Note You need to log in before you can comment on or make changes to this bug.